Skip to content

Commit 71ec738

Browse files
committed
Clarify disabled static login state requires API-backed server - PR_26158_034-static-login-disabled-message
1 parent 7451844 commit 71ec738

7 files changed

Lines changed: 82 additions & 17 deletions

File tree

assets/theme-v2/js/login-session.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,12 @@ const modeButtons = Array.from(document.querySelectorAll("[data-login-mode]"));
1010
const modeTitle = document.querySelector("[data-login-mode-title]");
1111
const modeDescription = document.querySelector("[data-login-mode-description]");
1212
const modeStatus = document.querySelector("[data-login-mode-status]");
13+
const modeDisabledMessage = document.querySelector("[data-login-mode-disabled-message]");
1314
const userControls = document.querySelector("[data-login-user-controls]");
1415
const userStatus = document.querySelector("[data-login-user-status]");
1516
const continueLink = document.querySelector("[data-login-continue]");
1617
const apiBackedLoginDiagnostic = "Use the API-backed local server for login.";
18+
const staticModeDisabledMessage = "Use the API-backed local server for login. Local Mem and Local DB are disabled until the local API server is running.";
1719

1820
function currentReturnTo() {
1921
const params = new URLSearchParams(window.location.search);
@@ -121,6 +123,10 @@ function renderError(error) {
121123
if (modeStatus) {
122124
modeStatus.textContent = `Login/session diagnostic: ${message}`;
123125
}
126+
if (modeDisabledMessage) {
127+
modeDisabledMessage.hidden = message !== apiBackedLoginDiagnostic;
128+
modeDisabledMessage.textContent = message === apiBackedLoginDiagnostic ? staticModeDisabledMessage : "";
129+
}
124130
if (userStatus) {
125131
userStatus.textContent = "No local users are available until /api/session responds.";
126132
}
@@ -158,6 +164,10 @@ function render() {
158164
}
159165
modeStatus.textContent = statusParts.join(". ") + ".";
160166
}
167+
if (modeDisabledMessage) {
168+
modeDisabledMessage.hidden = true;
169+
modeDisabledMessage.textContent = "";
170+
}
161171
renderUserButtons(mode);
162172
updateContinueLink();
163173
} catch (error) {

docs_build/dev/reports/coverage_changed_js_guardrail.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ Missing changed runtime JS files are WARN, not FAIL.
66
Source: Playwright/Chromium built-in V8 coverage from the active Playwright run.
77

88
Changed runtime JS files considered:
9-
(53%) src/engine/api/server-api-client.js - executed lines 159/159; executed functions 10/19
9+
(100%) none changed - no changed runtime JS files
1010

1111
Guardrail warnings:
12-
(100%) none - no changed runtime JS coverage warnings
12+
(100%) none changed - no changed runtime JS files

docs_build/dev/reports/playwright_v8_coverage_report.txt

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ Exercised tool entry points detected:
1717
(81%) Theme V2 Shared JS - exercised 3 runtime JS files
1818

1919
Changed runtime JS files covered:
20-
(53%) src/engine/api/server-api-client.js - executed lines 159/159; executed functions 10/19
20+
(100%) none changed - no changed runtime JS files
2121

2222
Files with executed line/function counts where available:
2323
(53%) src/engine/api/server-api-client.js - executed lines 159/159; executed functions 10/19
@@ -29,14 +29,13 @@ Files with executed line/function counts where available:
2929
(83%) assets/theme-v2/js/gamefoundry-partials.js - executed lines 442/442; executed functions 33/40
3030
(85%) src/engine/api/mock-db-viewer-ui.js - executed lines 510/510; executed functions 82/96
3131
(88%) src/engine/api/session-api-client.js - executed lines 34/34; executed functions 7/8
32-
(89%) assets/theme-v2/js/login-session.js - executed lines 182/182; executed functions 16/18
32+
(89%) assets/theme-v2/js/login-session.js - executed lines 192/192; executed functions 16/18
3333
(100%) toolbox/project-journey/project-journey-api-client.js - executed lines 12/12; executed functions 2/2
3434

3535
Uncovered or low-coverage changed JS files:
36-
(100%) none - no low-coverage changed runtime JS files
36+
(100%) none changed - no changed runtime JS files
3737

3838
Changed JS files considered:
3939
(0%) tests/playwright/tools/StaticOnlyLoginApiRequired.spec.mjs - changed JS file not collected as browser runtime coverage
40-
(53%) src/engine/api/server-api-client.js - changed JS file with browser V8 coverage
4140
(83%) assets/theme-v2/js/gamefoundry-partials.js - changed JS file with browser V8 coverage
4241
(89%) assets/theme-v2/js/login-session.js - changed JS file with browser V8 coverage
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
# PR_26158_034 Static Login Disabled Message Report
2+
3+
## Executive Summary
4+
5+
Improved the static-only `127.0.0.1:5500` login state by adding a visible message next to the disabled Local Mem / Local DB buttons:
6+
7+
`Use the API-backed local server for login. Local Mem and Local DB are disabled until the local API server is running.`
8+
9+
No fallback behavior was added. API-backed Local Mem and Local DB behavior remains unchanged.
10+
11+
## Implementation
12+
13+
| Area | Change | Evidence |
14+
| --- | --- | --- |
15+
| Login mode sidebar | Added a hidden Theme V2 `status` paragraph near the Local Mem / Local DB buttons. | `login.html` |
16+
| Login runtime | Shows the sidebar message only for the static 5500 API-required state; hides it again on API-backed success. | `assets/theme-v2/js/login-session.js` |
17+
| Static Playwright | Verifies the message is visible beside the disabled mode controls. | `tests/playwright/tools/StaticOnlyLoginApiRequired.spec.mjs` |
18+
19+
## Requirement Checklist
20+
21+
| Requirement | Evidence | Status |
22+
| --- | --- | --- |
23+
| Read `docs_build/dev/PROJECT_INSTRUCTIONS.md` first. | Read before implementation. | PASS |
24+
| Improve static-only login page state from `127.0.0.1:5500`. | Added a nearby disabled-mode status message in the login sidebar. | PASS |
25+
| Keep Local Mem and Local DB disabled when required API server is unavailable. | Static Playwright verifies both mode buttons are disabled. | PASS |
26+
| Add visible text near disabled login mode buttons explaining API-backed local server is required. | Static Playwright verifies `[data-login-mode-disabled-message]` is visible and contains the API-backed server text. | PASS |
27+
| Do not add fallback behavior. | Static path still does not call session routes and does not enable controls. | PASS |
28+
| Do not make static-only 5500 login usable. | Static Playwright verifies buttons remain disabled and unselected. | PASS |
29+
| Preserve API-backed login behavior unchanged. | `LoginSessionMode.spec.mjs` passed 5/5. | PASS |
30+
| Run changed-file syntax checks. | `node --check` passed for changed JS/spec files. | PASS |
31+
| Run LoginSessionMode Playwright with API server running. | `npx playwright test tests/playwright/tools/LoginSessionMode.spec.mjs` passed 5/5. | PASS |
32+
| Run static-only login Playwright proving buttons are disabled and API-required message is visible. | `npx playwright test tests/playwright/tools/StaticOnlyLoginApiRequired.spec.mjs` passed 1/1. | PASS |
33+
34+
## Validation Commands
35+
36+
| Command | Result |
37+
| --- | --- |
38+
| `node --check assets/theme-v2/js/login-session.js` | PASS |
39+
| `node --check tests/playwright/tools/StaticOnlyLoginApiRequired.spec.mjs` | PASS |
40+
| `npx playwright test tests/playwright/tools/StaticOnlyLoginApiRequired.spec.mjs` | PASS, 1/1 |
41+
| `npx playwright test tests/playwright/tools/LoginSessionMode.spec.mjs` | PASS, 5/5 |
42+
| `git diff --check` | PASS, with Git line-ending warnings only |
43+
44+
## Skipped Lanes
45+
46+
| Lane | Decision | Reason |
47+
| --- | --- | --- |
48+
| ToolboxRoutePages Playwright | SKIP | Toolbox route rendering was not touched. |
49+
| AdminDbViewer Playwright | SKIP | DB Viewer routes and rendering were not touched. |
50+
| Full samples smoke | SKIP | No sample files, sample loader, or shared sample framework changed. |
51+
52+
## Notes
53+
54+
- No CSS was added; the new message uses existing Theme V2 `status` styling.
55+
- Playwright emitted existing Node SQLite experimental warnings during the API-backed login lane; they did not fail validation.
Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,29 @@
1-
# PR_26158_033 Testing Lane Execution Report
1+
# PR_26158_034 Testing Lane Execution Report
22

33
## Lanes Run
44

55
| Lane | Command | Result |
66
| --- | --- | --- |
7-
| Changed-file syntax | `node --check assets/theme-v2/js/login-session.js`; `node --check assets/theme-v2/js/gamefoundry-partials.js`; `node --check src/engine/api/server-api-client.js`; `node --check tests/playwright/tools/StaticOnlyLoginApiRequired.spec.mjs` | PASS |
7+
| Changed-file syntax | `node --check assets/theme-v2/js/login-session.js`; `node --check tests/playwright/tools/StaticOnlyLoginApiRequired.spec.mjs` | PASS |
88
| Static 127.0.0.1:5500 login Playwright | `npx playwright test tests/playwright/tools/StaticOnlyLoginApiRequired.spec.mjs` | PASS, 1/1 |
99
| LoginSessionMode Playwright | `npx playwright test tests/playwright/tools/LoginSessionMode.spec.mjs` | PASS, 5/5 |
10-
| ToolboxRoutePages Playwright | `npx playwright test tests/playwright/tools/ToolboxRoutePages.spec.mjs` | PASS, 1/1 |
1110
| Changed-file/static validation | `git diff --check` | PASS, with Git line-ending warnings only |
12-
| ShowOneChild/ActionableCoachmark reference audit | `Get-ChildItem -Path . -Recurse -Filter ShowOneChild.js -File`; scoped active HTML/JS `rg` | PASS |
1311
| Runtime JS V8 coverage | Playwright coverage generated by targeted runs | PASS/WARN; `docs_build/dev/reports/playwright_v8_coverage_report.txt` and `coverage_changed_js_guardrail.txt` generated. |
1412

1513
## Validation Notes
1614

1715
| Check | Evidence | Result |
1816
| --- | --- | --- |
19-
| Static `127.0.0.1:5500` login shows visible API-backed server diagnostic. | `StaticOnlyLoginApiRequired.spec.mjs` serves `login.html` on `127.0.0.1:5500` and verifies `Use the API-backed local server for login.` is visible. | PASS |
20-
| Static `127.0.0.1:5500` login does not call `/api/session/current`. | `StaticOnlyLoginApiRequired.spec.mjs` records all requests and asserts no request URL contains `/api/session/current` or `/api/session/`. | PASS |
21-
| Static `127.0.0.1:5500` login modes do not appear usable. | Static lane verifies Local Mem and Local DB buttons are disabled and not selected. | PASS |
22-
| API-backed Local Mem and Local DB behavior still works. | `LoginSessionMode.spec.mjs` passed 5/5, including Local DB session behavior. | PASS |
23-
| Toolbox route pages still render. | `ToolboxRoutePages.spec.mjs` passed 1/1 for Project Journey, Colors, and Assets `/tools/...` aliases. | PASS |
24-
| Repo-owned ShowOneChild/ActionableCoachmark errors are absent. | Static-only Playwright asserts no non-extension `ShowOneChild`, `showOneChild`, or `ActionableCoachmark` error text in page or console errors. | PASS |
17+
| Static `127.0.0.1:5500` login keeps Local Mem and Local DB disabled. | `StaticOnlyLoginApiRequired.spec.mjs` verifies both `[data-login-mode]` buttons are disabled and not selected. | PASS |
18+
| Static `127.0.0.1:5500` login shows API-required text near disabled mode buttons. | `StaticOnlyLoginApiRequired.spec.mjs` verifies `[data-login-mode-disabled-message]` is visible and contains `Use the API-backed local server for login.` plus `Local Mem and Local DB are disabled`. | PASS |
19+
| Static `127.0.0.1:5500` does not call session API routes. | Static lane records all requests and asserts no request URL contains `/api/session/current` or `/api/session/`. | PASS |
20+
| API-backed Local Mem and Local DB behavior is unchanged. | `LoginSessionMode.spec.mjs` passed 5/5, including Local DB session behavior. | PASS |
2521

2622
## Skipped Lanes
2723

2824
| Lane | Decision | Reason |
2925
| --- | --- | --- |
26+
| ToolboxRoutePages Playwright | SKIP | Toolbox route rendering was not changed by this PR. |
3027
| AdminDbViewer Playwright | SKIP | DB Viewer routes, DB adapters, and admin DB rendering were not changed. |
3128
| Full samples smoke | SKIP | No samples, shared sample loader, or sample framework files changed. |
32-
| Full Playwright suite | SKIP | Static 5500 login, API-backed login, toolbox route, syntax, static, and V8 coverage checks cover the changed surfaces. |
29+
| Full Playwright suite | SKIP | Static 5500 login and API-backed login cover the changed login/session behavior. |

login.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ <h1>Login</h1>
2525
<aside class="side-menu" aria-label="Session modes">
2626
<button class="btn btn--compact" type="button" data-login-mode="local-mem">Local Mem</button>
2727
<button class="btn btn--compact" type="button" data-login-mode="local-db">Local DB</button>
28+
<p class="status" role="status" data-login-mode-disabled-message hidden>Use the API-backed local server for login. Local Mem and Local DB are disabled until the local API server is running.</p>
2829
</aside>
2930
<div class="card">
3031
<div class="card-body content-stack">

tests/playwright/tools/StaticOnlyLoginApiRequired.spec.mjs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,9 @@ test("static 127.0.0.1:5500 login requires the API-backed local server", async (
104104
await expect(page.locator("[data-login-mode='local-db']")).toBeDisabled();
105105
await expect(page.locator("[data-login-mode='local-mem']")).not.toHaveClass(/primary/);
106106
await expect(page.locator("[data-login-mode='local-db']")).not.toHaveClass(/primary/);
107+
await expect(page.locator("[data-login-mode-disabled-message]")).toBeVisible();
108+
await expect(page.locator("[data-login-mode-disabled-message]")).toContainText("Use the API-backed local server for login.");
109+
await expect(page.locator("[data-login-mode-disabled-message]")).toContainText("Local Mem and Local DB are disabled");
107110
await expect(page.locator("[data-login-mode-title]")).toHaveText("Session API required");
108111
await expect(page.locator("[data-login-mode-description]")).toContainText("Start the API-backed local server");
109112
await expect(page.locator("[data-login-mode-status]")).toContainText("Login/session diagnostic");

0 commit comments

Comments
 (0)