Skip to content

Commit 4f6f58c

Browse files
committed
Make Admin Notes visible in local Admin menu only - PR_26158_046-admin-notes-menu-visible-local
1 parent 8c0395f commit 4f6f58c

7 files changed

Lines changed: 83 additions & 30 deletions

File tree

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
# PR_26158_046 Admin Notes Menu Visible Local Report
2+
3+
## Summary
4+
5+
Fixed the local API-backed Admin menu so Admin Notes is visibly available when the Admin menu is opened. The served local header now injects a normal `data-nav-link` Admin Notes entry that opens `/src/dev-runtime/admin/admin-notes.html`; the checked-in Theme V2 header partial remains production-clean.
6+
7+
## Requirement Checklist
8+
9+
| Requirement | Evidence | Status |
10+
| --- | --- | --- |
11+
| Read `docs_build/dev/PROJECT_INSTRUCTIONS.md` first. | Read before implementation. | PASS |
12+
| Fix Admin Notes so it is visible in the Admin menu during local API-backed testing. | `src/dev-runtime/admin/admin-notes-menu.mjs` now injects `data-nav-link data-admin-notes-local-menu`; LoginSessionMode Playwright hovers Admin menu and validates visibility. | PASS |
13+
| Preserve dev-only access to `/src/dev-runtime/admin/admin-notes.html`. | AdminNotesLocalViewer Playwright still loads the dev-runtime viewer and note content. | PASS |
14+
| Do not rely on static 5500 partial loading for Admin Notes menu injection. | Injection is applied by the API-backed local server and Playwright local server helper, not by static-only serving. | PASS |
15+
| Ensure the local server injects or renders the Admin Notes menu entry consistently. | `localAdminNotesMenuContent()` is used by `src/dev-runtime/server/local-api-server.mjs`; boundary test validates the served header content. | PASS |
16+
| Keep `assets/theme-v2/partials/header-nav.html` production-clean with no hardcoded Admin Notes link. | Static partial check and public exposure audit returned no matches. | PASS |
17+
| Do not expose Admin Notes in UAT/PROD. | Static audits over public/prod candidate paths returned no matches for Admin Notes exposure or `src/dev-runtime/admin` imports. | PASS |
18+
| Do not modify `start_of_day` folders. | `git diff --name-only \| rg "(^|/)start_of_day(/|$)"` returned no matches. | PASS |
19+
| Run changed-file syntax checks. | `node --check` and AdminNotesBoundary node test passed. | PASS |
20+
| Run AdminNotesLocalViewer Playwright. | Scoped Playwright run passed. | PASS |
21+
| Run Admin menu Playwright proving Admin Notes is visible locally and opens `/src/dev-runtime/admin/admin-notes.html`. | LoginSessionMode Playwright hovers Admin menu, sees the link, clicks it, and validates the viewer loaded `index.txt`. | PASS |
22+
| Verify production/public header partial remains clean. | `Select-String` and `rg` audits returned no matches. | PASS |
23+
24+
## Changed Files
25+
26+
| File | Purpose |
27+
| --- | --- |
28+
| `src/dev-runtime/admin/admin-notes-menu.mjs` | Makes the injected local Admin Notes anchor a normal nav link. |
29+
| `tests/dev-runtime/AdminNotesBoundary.test.mjs` | Validates the served header contains the local nav link marker while the source header stays clean. |
30+
| `tests/playwright/tools/LoginSessionMode.spec.mjs` | Proves the Admin Notes menu item is visible locally and opens the viewer. |
31+
| `docs_build/dev/reports/admin-notes-menu-visible-local-report.md` | PR046 requirement checklist and validation evidence. |
32+
| `docs_build/dev/reports/testing_lane_execution_report.md` | PR046 executed validation lanes. |
33+
| `docs_build/dev/reports/playwright_v8_coverage_report.txt` | Advisory V8 coverage from scoped Playwright. |
34+
| `docs_build/dev/reports/coverage_changed_js_guardrail.txt` | Advisory changed-runtime-JS guardrail. |
35+
36+
## Validation Evidence
37+
38+
| Validation | Result |
39+
| --- | --- |
40+
| Changed-file `node --check` lane | PASS |
41+
| `node --test tests/dev-runtime/AdminNotesBoundary.test.mjs` | PASS, 5/5 |
42+
| `npx playwright test tests/playwright/tools/AdminNotesLocalViewer.spec.mjs tests/playwright/tools/LoginSessionMode.spec.mjs --grep "Admin Notes local viewer loads\|Local users unlock" --workers=1` | PASS, 2/2 |
43+
| Public navigation exposure audit | PASS, no matches |
44+
| UAT/PROD dev-runtime admin import audit | PASS, no matches |
45+
| Production header partial clean check | PASS, no matches |
46+
| `Test-Path admin/notes.html` | PASS, returned `False` |
47+
| `git diff --check` | PASS, line-ending warnings only |
48+
49+
## Playwright Impact
50+
51+
Playwright impacted: Yes. This PR changes local API-backed Admin menu behavior. Expected pass behavior is that an Admin user can open the Admin menu, see `Admin Notes (Local Dev)`, click it, and land on `/src/dev-runtime/admin/admin-notes.html` with `docs_build/dev/admin-notes/index.txt` loaded. Expected fail behavior is a hidden menu item, a link that only exists in the DOM but cannot be seen/clicked, a wrong target, or any production/public Admin Notes exposure.
52+
53+
## Manual Test Notes
54+
55+
1. Start the API-backed local server with `npm run dev:local-api`.
56+
2. Log in locally as Admin.
57+
3. Open an Admin page and hover/open the Admin menu.
58+
4. Confirm `Admin Notes (Local Dev)` is visible and opens `/src/dev-runtime/admin/admin-notes.html`.
59+
5. Confirm `assets/theme-v2/partials/header-nav.html` does not contain an Admin Notes link.
60+
61+
## Skipped Lanes
62+
63+
- Full samples smoke: skipped because samples and game runtime were not touched.
64+
- Full Playwright suite: skipped because targeted Admin menu and Admin Notes local viewer lanes cover the changed behavior.

docs_build/dev/reports/coverage_changed_js_guardrail.txt

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +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-
(0%) src/dev-runtime/admin/admin-notes-directory.mjs - WARNING: changed runtime JS file was not collected by Playwright V8 coverage; advisory only
109
(0%) src/dev-runtime/admin/admin-notes-menu.mjs - WARNING: changed runtime JS file was not collected by Playwright V8 coverage; advisory only
11-
(0%) src/dev-runtime/server/local-api-server.mjs - WARNING: changed runtime JS file was not collected by Playwright V8 coverage; advisory only
12-
(96%) src/dev-runtime/admin/admin-notes-viewer.js - executed lines 501/501; executed functions 47/49
1310

1411
Guardrail warnings:
15-
(0%) src/dev-runtime/admin/admin-notes-directory.mjs - WARNING: changed runtime JS file missing from coverage; advisory only
1612
(0%) src/dev-runtime/admin/admin-notes-menu.mjs - WARNING: changed runtime JS file missing from coverage; advisory only
17-
(0%) src/dev-runtime/server/local-api-server.mjs - WARNING: changed runtime JS file missing from coverage; advisory only

docs_build/dev/reports/playwright_v8_coverage_report.txt

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -17,27 +17,16 @@ Exercised tool entry points detected:
1717
(75%) Theme V2 Shared JS - exercised 1 runtime JS files
1818

1919
Changed runtime JS files covered:
20-
(0%) src/dev-runtime/admin/admin-notes-directory.mjs - WARNING: changed runtime JS file was not collected by Playwright V8 coverage; advisory only
2120
(0%) src/dev-runtime/admin/admin-notes-menu.mjs - WARNING: changed runtime JS file was not collected by Playwright V8 coverage; advisory only
22-
(0%) src/dev-runtime/server/local-api-server.mjs - WARNING: changed runtime JS file was not collected by Playwright V8 coverage; advisory only
23-
(96%) src/dev-runtime/admin/admin-notes-viewer.js - executed lines 501/501; executed functions 47/49
2421

2522
Files with executed line/function counts where available:
2623
(75%) assets/theme-v2/js/gamefoundry-partials.js - executed lines 441/441; executed functions 30/40
2724
(96%) src/dev-runtime/admin/admin-notes-viewer.js - executed lines 501/501; executed functions 47/49
2825

2926
Uncovered or low-coverage changed JS files:
30-
(0%) src/dev-runtime/admin/admin-notes-directory.mjs - WARNING: uncovered changed runtime JS file; advisory only
3127
(0%) src/dev-runtime/admin/admin-notes-menu.mjs - WARNING: uncovered changed runtime JS file; advisory only
32-
(0%) src/dev-runtime/server/local-api-server.mjs - WARNING: uncovered changed runtime JS file; advisory only
3328

3429
Changed JS files considered:
35-
(0%) src/dev-runtime/admin/admin-notes-directory.mjs - changed JS file not collected as browser runtime coverage
3630
(0%) src/dev-runtime/admin/admin-notes-menu.mjs - changed JS file not collected as browser runtime coverage
37-
(0%) src/dev-runtime/server/local-api-server.mjs - changed JS file not collected as browser runtime coverage
3831
(0%) tests/dev-runtime/AdminNotesBoundary.test.mjs - changed JS file not collected as browser runtime coverage
39-
(0%) tests/helpers/playwrightRepoServer.mjs - changed JS file not collected as browser runtime coverage
40-
(0%) tests/playwright/tools/AdminNotesLocalViewer.spec.mjs - changed JS file not collected as browser runtime coverage
4132
(0%) tests/playwright/tools/LoginSessionMode.spec.mjs - changed JS file not collected as browser runtime coverage
42-
(75%) assets/theme-v2/js/gamefoundry-partials.js - changed JS file with browser V8 coverage
43-
(96%) src/dev-runtime/admin/admin-notes-viewer.js - changed JS file with browser V8 coverage
Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
1-
# PR_26158_045 Testing Lane Execution Report
1+
# PR_26158_046 Testing Lane Execution Report
22

33
## Lanes Run
44

55
| Lane | Command | Result |
66
| --- | --- | --- |
7-
| Changed-file syntax checks | `node --check src/dev-runtime/admin/admin-notes-directory.mjs`; `node --check src/dev-runtime/admin/admin-notes-menu.mjs`; `node --check src/dev-runtime/admin/admin-notes-viewer.js`; `node --check src/dev-runtime/server/local-api-server.mjs`; `node --check tests/helpers/playwrightRepoServer.mjs`; `node --check tests/dev-runtime/AdminNotesBoundary.test.mjs`; `node --check tests/playwright/tools/AdminNotesLocalViewer.spec.mjs`; `node --check tests/playwright/tools/LoginSessionMode.spec.mjs`; `node --test tests/dev-runtime/AdminNotesBoundary.test.mjs` | PASS, AdminNotesBoundary 5/5 |
7+
| Changed-file syntax checks | `node --check src/dev-runtime/admin/admin-notes-menu.mjs`; `node --check src/dev-runtime/server/local-api-server.mjs`; `node --check tests/helpers/playwrightRepoServer.mjs`; `node --check tests/dev-runtime/AdminNotesBoundary.test.mjs`; `node --check tests/playwright/tools/LoginSessionMode.spec.mjs`; `node --test tests/dev-runtime/AdminNotesBoundary.test.mjs` | PASS, AdminNotesBoundary 5/5 |
88
| Admin Notes local viewer Playwright | `npx playwright test tests/playwright/tools/AdminNotesLocalViewer.spec.mjs tests/playwright/tools/LoginSessionMode.spec.mjs --grep "Admin Notes local viewer loads\|Local users unlock" --workers=1` | PASS, 2/2 |
99
| Public navigation exposure audit | `rg -n "docs_build/dev/admin-notes\|docs_build\\dev\\admin-notes\|admin-notes-dev\|data-admin-notes-local-menu\|Admin Notes" account admin assets toolbox src/engine src/shared --glob '!archive/v1-v2/**' --glob '!tmp/**'` | PASS, no matches |
1010
| UAT/PROD dev-runtime admin import audit | `rg -n "src/dev-runtime/admin\|src\\dev-runtime\\admin" account admin assets toolbox src/engine src/shared --glob '!archive/v1-v2/**' --glob '!tmp/**'` | PASS, no matches |
11+
| Production header partial clean check | `Select-String -Path assets/theme-v2/partials/header-nav.html -Pattern "Admin Notes\|data-admin-notes-local-menu\|admin-notes\|docs_build/dev/admin-notes"` | PASS, no matches |
1112
| Production route absence check | `Test-Path admin/notes.html` | PASS, returned `False` |
1213
| Changed-file whitespace/static validation | `git diff --check` | PASS, Git line-ending warnings only |
1314
| start_of_day protection check | `git diff --name-only \| rg "(^|/)start_of_day(/|$)"` | PASS, no matches |
@@ -16,25 +17,23 @@
1617

1718
| Check | Evidence | Result |
1819
| --- | --- | --- |
19-
| `src/dev-runtime/admin/admin-notes.html` exists. | AdminNotesBoundary node test validates the page exists. | PASS |
20-
| Viewer page uses external JavaScript only. | AdminNotesBoundary validates no inline script/style/event handlers and external `./admin-notes-viewer.js`. | PASS |
21-
| `docs_build/dev/admin-notes/index.txt` loads by default. | AdminNotesLocalViewer Playwright validates title/status/content. | PASS |
22-
| Folders and files from `docs_build/dev/admin-notes/` list for selection. | AdminNotesLocalViewer Playwright validates `notes/`, `other/`, `quick-reference.txt`, and `sample.txt`. | PASS |
23-
| Selecting a `.txt` note displays its content. | AdminNotesLocalViewer Playwright opens `quick-reference.txt` and `other/index.txt`. | PASS |
24-
| Admin menu local-only link targets the viewer page. | LoginSessionMode Playwright validates `/src/dev-runtime/admin/admin-notes.html`. | PASS |
25-
| Checked-in Theme V2 header partial has no production-visible Admin Notes link. | Static audit and AdminNotesBoundary test. | PASS |
26-
| UAT/PROD candidate paths do not import `src/dev-runtime/admin/`. | Static import audit returned no matches. | PASS |
20+
| Admin Notes is visible in the Admin menu during local API-backed testing. | LoginSessionMode Playwright hovers the Admin menu and asserts `data-admin-notes-local-menu` is visible. | PASS |
21+
| Admin Notes menu item opens `/src/dev-runtime/admin/admin-notes.html`. | LoginSessionMode Playwright clicks the local menu item and validates the Admin Notes viewer heading and loaded `index.txt` status. | PASS |
22+
| Dev-only viewer remains available. | AdminNotesLocalViewer Playwright loads `/src/dev-runtime/admin/admin-notes.html` and opens note files. | PASS |
23+
| Local server renders the menu consistently. | `src/dev-runtime/admin/admin-notes-menu.mjs` injects normal `data-nav-link` markup into the served header copy; AdminNotesBoundary validates the served copy. | PASS |
24+
| Static 5500 is not used for Admin Notes menu injection. | Injection is wired through `src/dev-runtime/server/local-api-server.mjs` and the Playwright local API-backed server helper. | PASS |
25+
| Checked-in Theme V2 header partial is production-clean. | Static partial check and exposure audit found no Admin Notes strings. | PASS |
26+
| UAT/PROD candidate paths do not expose or import Admin Notes. | Static exposure/import audits returned no matches. | PASS |
2727

2828
## Skipped Lanes
2929

3030
| Lane | Decision | Reason |
3131
| --- | --- | --- |
3232
| Full samples smoke | SKIP | No sample loader/framework, game runtime, or sample data changed. |
33-
| Full Playwright suite | SKIP | PR scope is limited to the dev-only Admin Notes viewer and local-only Admin menu validation; targeted lanes passed. |
34-
| Playwright V8 coverage regeneration as a deliverable | SKIP | PR045 did not change runtime JavaScript; Playwright coverage files were not included as PR045 deliverables. |
33+
| Full Playwright suite | SKIP | PR scope is limited to local API-backed Admin menu visibility and the existing Admin Notes local viewer; targeted lanes passed. |
3534

3635
## Notes
3736

38-
- The viewer page already existed in the current stacked tree; this PR added explicit static validation that it has no inline script/style/event handlers and confirmed the page behavior with Playwright.
3937
- `git diff --check` emitted line-ending warnings only.
4038
- Playwright emitted existing SQLite experimental and seed-only audit fallback warnings; they did not fail the targeted lanes.
39+
- Runtime coverage is advisory; the changed local menu injector executes in the Node local server path, so browser V8 lists it as uncovered.

src/dev-runtime/admin/admin-notes-menu.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ export const ADMIN_NOTES_LOCAL_MENU_LABEL = "Admin Notes (Local Dev)";
55

66
const HEADER_PARTIAL_PATH = "assets/theme-v2/partials/header-nav.html";
77
const INSERT_BEFORE = ' <a data-nav-link data-route="admin-analytics" href="admin/analytics.html">Analytics</a>';
8-
const LOCAL_MENU_LINK = ` <a data-admin-notes-local-menu href="${ADMIN_NOTES_LOCAL_VIEWER_PATH}">${ADMIN_NOTES_LOCAL_MENU_LABEL}</a>`;
8+
const LOCAL_MENU_LINK = ` <a data-nav-link data-admin-notes-local-menu href="${ADMIN_NOTES_LOCAL_VIEWER_PATH}">${ADMIN_NOTES_LOCAL_MENU_LABEL}</a>`;
99

1010
function repoRelativePath(repoRoot, targetPath) {
1111
return path.relative(repoRoot, targetPath).replaceAll(path.sep, "/");

tests/dev-runtime/AdminNotesBoundary.test.mjs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,7 @@ test("local dev server injects Admin Notes into the served Admin menu only", ()
130130
const servedHeader = localAdminNotesMenuContent(repoRoot, headerPath, source).toString("utf8");
131131

132132
assert.match(servedHeader, /data-admin-notes-local-menu/);
133+
assert.match(servedHeader, /data-nav-link data-admin-notes-local-menu/);
133134
assert.match(servedHeader, new RegExp(ADMIN_NOTES_LOCAL_VIEWER_PATH.replace(/\//g, "\\/")));
134135
assert.match(servedHeader, new RegExp(ADMIN_NOTES_LOCAL_MENU_LABEL.replace(/[()]/g, "\\$&")));
135136
assert.ok(

tests/playwright/tools/LoginSessionMode.spec.mjs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -366,11 +366,16 @@ test("Local users unlock their allowed Account and Admin pages", async ({ page }
366366
await page.locator("nav.nav-links > .nav-item:has(> a[data-route='account'])").hover();
367367
await expect(page.locator("[data-account-logout]")).toBeVisible();
368368
await expect(page.locator("nav.nav-links > .nav-item:has(> a[data-route='admin'])")).toBeVisible();
369+
await page.locator("nav.nav-links > .nav-item:has(> a[data-route='admin'])").hover();
369370
await expect(page.locator("nav.nav-links a[data-admin-notes-local-menu]")).toHaveText("Admin Notes (Local Dev)");
371+
await expect(page.locator("nav.nav-links a[data-admin-notes-local-menu]")).toBeVisible();
370372
await expect(page.locator("nav.nav-links a[data-admin-notes-local-menu]")).toHaveAttribute(
371373
"href",
372374
/\/src\/dev-runtime\/admin\/admin-notes\.html$/,
373375
);
376+
await page.locator("nav.nav-links a[data-admin-notes-local-menu]").click();
377+
await expect(page.getByRole("heading", { name: "Admin Notes", level: 1 })).toBeVisible();
378+
await expect(page.locator("[data-admin-notes-status]")).toContainText("Loaded docs_build/dev/admin-notes/index.txt.");
374379
await expectNoPageFailures(failures);
375380
} finally {
376381
await closeWithCoverage(page, failures);

0 commit comments

Comments
 (0)