Skip to content

Commit eda114e

Browse files
committed
Map Admin Notes to admin URL and apply admin page template - PR_26158_048-admin-notes-template-route
1 parent dced288 commit eda114e

13 files changed

Lines changed: 139 additions & 29 deletions
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
# PR_26158_048 Admin Notes Template Route Report
2+
3+
## Summary
4+
5+
PR_26158_048 keeps the Admin Notes source page under `src/dev-runtime/admin/admin-notes.html`, adds local routing for `/admin/admin-notes.html`, and updates the local Admin menu to use the admin-style route. The viewer now uses the shared Theme V2 header/footer partial structure used by admin pages while preserving dev-only directory reading.
6+
7+
## Implementation
8+
9+
| File | Change |
10+
| --- | --- |
11+
| `src/dev-runtime/admin/admin-notes.html` | Added `<base href="/">`, shared header/footer partial slots, Theme V2 partial script, and a root-based external viewer script path. |
12+
| `src/dev-runtime/admin/admin-notes-viewer.js` | Updated generated viewer links to use `/admin/admin-notes.html`. |
13+
| `src/dev-runtime/admin/admin-notes-menu.mjs` | Updated local menu route constant to `/admin/admin-notes.html` while preserving the source-file path as a separate constant for validation. |
14+
| `src/dev-runtime/admin/header-nav.local.html` | Updated the Admin Notes menu item to `href="/admin/admin-notes.html"`. |
15+
| `src/dev-runtime/server/local-api-server.mjs` | Added local route mapping from `/admin/admin-notes.html` to `/src/dev-runtime/admin/admin-notes.html`. |
16+
| `tests/helpers/playwrightRepoServer.mjs` | Mirrored the local route mapping for targeted Playwright validation. |
17+
| `tests/dev-runtime/AdminNotesBoundary.test.mjs` | Added checks for shared header/footer partial slots, local menu route, and production-clean boundaries. |
18+
| `tests/playwright/tools/AdminNotesLocalViewer.spec.mjs` | Validates `/admin/admin-notes.html`, direct source route compatibility, shared header/footer rendering, and note loading. |
19+
| `tests/playwright/tools/LoginSessionMode.spec.mjs` | Validates Admin menu click-through to `/admin/admin-notes.html`, including fixed-port `5501` login. |
20+
21+
## Requirement Checklist
22+
23+
| Requirement | Status | Evidence |
24+
| --- | --- | --- |
25+
| Read `docs_build/dev/PROJECT_INSTRUCTIONS.md` first. | PASS | Read before implementation. |
26+
| Keep Admin Notes implementation file at `src/dev-runtime/admin/admin-notes.html`. | PASS | Source file remains in place; no `admin/admin-notes.html` file was created. |
27+
| Add local dev URL routing so `/admin/admin-notes.html` maps to `src/dev-runtime/admin/admin-notes.html`. | PASS | `local-api-server.mjs` and Playwright helper route `/admin/admin-notes.html` to the dev-runtime source. |
28+
| Update the Admin menu link to use `/admin/admin-notes.html`. | PASS | `src/dev-runtime/admin/header-nav.local.html` uses `href="/admin/admin-notes.html"`; Playwright validates it. |
29+
| Make Admin Notes use the same Theme V2 page template/header/footer structure as admin pages. | PASS | Viewer now has shared header/footer partial slots, Theme V2 partial script, Theme V2 stylesheet, and no inline script/style/event handlers. |
30+
| Preserve dev-only Admin Notes behavior and directory reading. | PASS | AdminNotesLocalViewer Playwright loads `index.txt`, lists folders/files, opens `quick-reference.txt`, and opens `other/index.txt`. |
31+
| Do not move the source file. | PASS | `src/dev-runtime/admin/admin-notes.html` remains the implementation file. |
32+
| Do not expose Admin Notes in UAT/PROD. | PASS | Public exposure and dev-runtime admin import audits returned no matches in production-facing paths; production admin note paths do not exist. |
33+
| Do not modify `start_of_day` folders. | PASS | `git diff --name-only \| rg "(^|/)start_of_day(/|$)"` returned no matches. |
34+
35+
## Validation
36+
37+
| Validation | Status | Evidence |
38+
| --- | --- | --- |
39+
| Changed-file syntax checks. | PASS | `node --check` passed for changed JS/MJS/test files; AdminNotesBoundary passed 5/5. |
40+
| AdminNotesLocalViewer Playwright. | PASS | Targeted run passed viewer route and direct source route checks. |
41+
| Admin menu Playwright proving `/admin/admin-notes.html` opens and renders. | PASS | LoginSessionMode tests validate random-port and fixed `5501` Admin menu click-through. |
42+
| Verify direct `/src/dev-runtime/admin/admin-notes.html` still works. | PASS | Dedicated Playwright test validates the direct source route still renders the viewer. |
43+
| Verify UAT/PROD paths do not expose `src/dev-runtime/admin/`. | PASS | Static audit returned no matches in production-facing path set. |
44+
45+
## Rerun Notes
46+
47+
- The first fixed-port Playwright attempt failed because an older `node ./scripts/start-local-api-server.mjs` process was already listening on `127.0.0.1:5501` and serving stale header markup.
48+
- Stopped that stale local process and reran the targeted lane. The final run passed 4/4.
49+
50+
## Skipped Lanes
51+
52+
| Lane | Decision | Reason |
53+
| --- | --- | --- |
54+
| Full samples smoke | SKIP | No sample loader/framework, sample data, or game runtime changed. |
55+
| Full Playwright suite | SKIP | Targeted Admin Notes and Admin menu lanes validate every requested behavior. |
56+
57+
## Result
58+
59+
PASS. All requested PR_26158_048 requirements are implemented and validated.

docs_build/dev/reports/coverage_changed_js_guardrail.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ Source: Playwright/Chromium built-in V8 coverage from the active Playwright run.
88
Changed runtime JS files considered:
99
(0%) src/dev-runtime/admin/admin-notes-menu.mjs - WARNING: changed runtime JS file was not collected by Playwright V8 coverage; advisory only
1010
(0%) src/dev-runtime/server/local-api-server.mjs - WARNING: changed runtime JS file was not collected by Playwright V8 coverage; advisory only
11+
(96%) src/dev-runtime/admin/admin-notes-viewer.js - executed lines 501/501; executed functions 47/49
1112

1213
Guardrail warnings:
1314
(0%) src/dev-runtime/admin/admin-notes-menu.mjs - WARNING: changed runtime JS file missing from coverage; advisory only

docs_build/dev/reports/playwright_v8_coverage_report.txt

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,18 +14,19 @@ Note: coverage entries are aggregated across every page/tool where coverageRepor
1414
Exercised tool entry points detected:
1515
(0%) Toolbox Index - not exercised by this Playwright run
1616
(0%) Tool Template V2 - not exercised by this Playwright run
17-
(68%) Theme V2 Shared JS - exercised 2 runtime JS files
17+
(70%) Theme V2 Shared JS - exercised 2 runtime JS files
1818

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

2324
Files with executed line/function counts where available:
2425
(20%) src/engine/api/mock-db-api-client.js - executed lines 19/19; executed functions 1/5
2526
(29%) src/engine/api/server-api-client.js - executed lines 159/159; executed functions 4/14
2627
(62%) assets/theme-v2/js/login-session.js - executed lines 357/357; executed functions 16/26
2728
(63%) src/engine/api/session-api-client.js - executed lines 34/34; executed functions 5/8
28-
(73%) assets/theme-v2/js/gamefoundry-partials.js - executed lines 441/441; executed functions 29/40
29+
(75%) assets/theme-v2/js/gamefoundry-partials.js - executed lines 441/441; executed functions 30/40
2930
(96%) src/dev-runtime/admin/admin-notes-viewer.js - executed lines 501/501; executed functions 47/49
3031

3132
Uncovered or low-coverage changed JS files:
@@ -37,4 +38,6 @@ Changed JS files considered:
3738
(0%) src/dev-runtime/server/local-api-server.mjs - changed JS file not collected as browser runtime coverage
3839
(0%) tests/dev-runtime/AdminNotesBoundary.test.mjs - changed JS file not collected as browser runtime coverage
3940
(0%) tests/helpers/playwrightRepoServer.mjs - changed JS file not collected as browser runtime coverage
41+
(0%) tests/playwright/tools/AdminNotesLocalViewer.spec.mjs - changed JS file not collected as browser runtime coverage
4042
(0%) tests/playwright/tools/LoginSessionMode.spec.mjs - changed JS file not collected as browser runtime coverage
43+
(96%) src/dev-runtime/admin/admin-notes-viewer.js - changed JS file with browser V8 coverage

docs_build/dev/reports/testing_lane_execution_report.md

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1-
# PR_26158_047 Testing Lane Execution Report
1+
# PR_26158_048 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-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 |
8-
| AdminNotesLocalViewer Playwright | `npx playwright test tests/playwright/tools/AdminNotesLocalViewer.spec.mjs tests/playwright/tools/LoginSessionMode.spec.mjs --grep "Admin Notes local viewer loads\|API-backed 5501 login page shows" --workers=1` | PASS, 2/2 |
9-
| 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"`; `Test-Path admin/notes.html` | PASS, no header matches; `admin/notes.html` returned `False` |
10-
| 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 |
7+
| Changed-file syntax checks | `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 |
8+
| AdminNotesLocalViewer Playwright | `npx playwright test tests/playwright/tools/AdminNotesLocalViewer.spec.mjs tests/playwright/tools/LoginSessionMode.spec.mjs --grep "Admin Notes local viewer loads\|Admin Notes direct dev-runtime\|Local users unlock\|API-backed 5501 login page shows" --workers=1` | PASS, 4/4 after restarting stale local server |
9+
| 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"`; `Test-Path admin/admin-notes.html`; `Test-Path admin/notes.html` | PASS, no header matches; both production admin note paths returned `False` |
10+
| Public navigation exposure audit | `rg -n "docs_build/dev/admin-notes\|docs_build\\dev\\admin-notes\|data-admin-notes-local-menu\|Admin Notes" account admin assets toolbox src/engine src/shared --glob '!archive/v1-v2/**' --glob '!tmp/**'` | PASS, no matches |
1111
| 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 |
1212
| Changed-file whitespace/static validation | `git diff --check` | PASS, Git line-ending warnings only |
1313
| start_of_day protection check | `git diff --name-only \| rg "(^|/)start_of_day(/|$)"` | PASS, no matches |
@@ -16,27 +16,27 @@
1616

1717
| Check | Evidence | Result |
1818
| --- | --- | --- |
19-
| Admin Notes local viewer works. | AdminNotesLocalViewer Playwright opened `/src/dev-runtime/admin/admin-notes.html`, loaded `index.txt`, listed folders/files, and opened notes. | PASS |
20-
| Admin Notes appears from `http://127.0.0.1:5501/login.html`. | LoginSessionMode Playwright opened the exact fixed-port URL, selected the Admin session, hovered Admin, and found `Admin Notes (Local Dev)`. | PASS |
21-
| Admin Notes opens the dev viewer route. | The fixed-port Playwright test clicked the menu item and verified `/src/dev-runtime/admin/admin-notes.html`, the `Admin Notes` heading, and loaded `index.txt` status. | PASS |
22-
| Dedicated local header partial replaces fragile string replacement. | `node --test tests/dev-runtime/AdminNotesBoundary.test.mjs` verifies the server maps the normal header partial path to `src/dev-runtime/admin/header-nav.local.html` and leaves the production partial unchanged. | PASS |
23-
| Production/public header remains clean. | Static partial check and public exposure audit returned no matches. | PASS |
19+
| `/admin/admin-notes.html` opens and renders the viewer. | AdminNotesLocalViewer Playwright opens the route, validates header/footer, viewer title, loaded `index.txt`, folder/file links, and note content. | PASS |
20+
| Direct `/src/dev-runtime/admin/admin-notes.html` still works. | AdminNotesLocalViewer Playwright opens the direct source route and validates the viewer, header/footer, and loaded `index.txt` status. | PASS |
21+
| Admin menu opens `/admin/admin-notes.html`. | LoginSessionMode Playwright hovers Admin, validates `Admin Notes (Local Dev)` link `href="/admin/admin-notes.html"`, clicks it, and validates the viewer. | PASS |
22+
| Fixed local API-backed path works from `http://127.0.0.1:5501/login.html`. | LoginSessionMode Playwright opens the exact fixed-port login URL and clicks through to `http://127.0.0.1:5501/admin/admin-notes.html`. | PASS |
23+
| Viewer uses the Theme V2 admin page shell. | Boundary and Playwright checks validate shared header/footer partial slots, Theme V2 partial wiring, and no inline script/style/event handlers. | PASS |
24+
| Production/public header remains clean. | Static partial and public exposure checks returned no matches. | PASS |
2425
| UAT/PROD-facing paths do not expose Admin Notes implementation. | Static import audit returned no matches under public/admin/account/toolbox/engine/shared paths. | PASS |
2526

2627
## Rerun Notes
2728

2829
| Attempt | Result | Resolution |
2930
| --- | --- | --- |
30-
| First targeted Playwright attempt | FAIL | `127.0.0.1:5501` was already in use. The fixed-port test harness now uses an existing API-backed local server when one is already running, while still validating the exact 5501 URL. |
31-
| Second targeted Playwright attempt | FAIL | Test expected the resolved absolute URL in the raw `href` attribute. The assertion was corrected to expect `/src/dev-runtime/admin/admin-notes.html`, and click-through still validates the full 5501 URL. |
32-
| Final targeted Playwright attempt | PASS | AdminNotesLocalViewer and fixed-port Admin menu tests passed 2/2. |
31+
| First targeted Playwright attempt | FAIL | PID `71976` was a stale `node ./scripts/start-local-api-server.mjs` instance serving the previous `/src/dev-runtime/admin/admin-notes.html` menu link on port 5501. |
32+
| Final targeted Playwright attempt | PASS | Stopped the stale local server process, reran the targeted lane, and validated `/admin/admin-notes.html` from the fixed 5501 login URL. |
3333

3434
## Skipped Lanes
3535

3636
| Lane | Decision | Reason |
3737
| --- | --- | --- |
38-
| Full samples smoke | SKIP | No samples, sample loader/framework, or game runtime changed. |
39-
| Full Playwright suite | SKIP | Scope is limited to local API-backed Admin Notes menu routing and the existing Admin Notes local viewer; targeted lanes cover the changed behavior. |
38+
| Full samples smoke | SKIP | No sample loader/framework, sample data, or game runtime changed. |
39+
| Full Playwright suite | SKIP | Targeted Admin Notes viewer and Admin menu lanes cover the local route/template behavior requested. |
4040

4141
## Notes
4242

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import path from "node:path";
22

3-
export const ADMIN_NOTES_LOCAL_VIEWER_PATH = "/src/dev-runtime/admin/admin-notes.html";
3+
export const ADMIN_NOTES_LOCAL_VIEWER_PATH = "/admin/admin-notes.html";
4+
export const ADMIN_NOTES_LOCAL_SOURCE_PATH = "/src/dev-runtime/admin/admin-notes.html";
45
export const ADMIN_NOTES_LOCAL_MENU_LABEL = "Admin Notes (Local Dev)";
56

67
const HEADER_PARTIAL_PATH = "assets/theme-v2/partials/header-nav.html";

src/dev-runtime/admin/admin-notes-viewer.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// Dev-runtime only: do not import this viewer from production-facing pages or bundles.
22
const NOTES_DIRECTORY = "docs_build/dev/admin-notes";
33
const DEFAULT_NOTE = "index";
4-
const VIEWER_PATH = "/src/dev-runtime/admin/admin-notes.html";
4+
const VIEWER_PATH = "/admin/admin-notes.html";
55
const LINK_CLASS = "btn btn--compact primary";
66
const NOTE_NAME_PATTERN = /^[A-Za-z0-9_-]+$/;
77
const STATUS_ICON_PATTERN = /^\[([ xX.!?-])\]\s*(.*)$/;

src/dev-runtime/admin/admin-notes.html

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,16 @@
22
<html lang="en">
33
<head>
44
<meta charset="utf-8">
5+
<base href="/">
56
<meta name="viewport" content="width=device-width, initial-scale=1">
67
<title>Admin Notes Local Viewer - GameFoundryStudio</title>
78
<meta name="description" content="Local development viewer for Admin Notes under docs_build/dev/admin-notes.">
89
<link rel="icon" href="/favicon.svg">
9-
<link rel="stylesheet" href="../../../assets/theme-v2/css/theme.css">
10+
<link rel="stylesheet" href="assets/theme-v2/css/theme.css">
1011
</head>
1112
<body>
12-
<main data-admin-notes-viewer>
13+
<div data-partial="header-nav"></div>
14+
<main data-admin-only="true" data-admin-notes-viewer>
1315
<section class="page-title">
1416
<div class="container">
1517
<div class="kicker">Local Dev Admin</div>
@@ -53,6 +55,8 @@ <h3>Status Legend</h3>
5355
</div>
5456
</section>
5557
</main>
56-
<script type="module" src="./admin-notes-viewer.js"></script>
58+
<div data-partial="footer"></div>
59+
<script src="assets/theme-v2/js/gamefoundry-partials.js" defer></script>
60+
<script type="module" src="src/dev-runtime/admin/admin-notes-viewer.js"></script>
5761
</body>
5862
</html>

src/dev-runtime/admin/header-nav.local.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@
110110
<div class="nav-item">
111111
<a data-nav-link data-route="admin" href="admin/site-settings.html">Admin &#9662;</a>
112112
<div class="sub-menu">
113-
<a data-nav-link data-admin-notes-local-menu href="/src/dev-runtime/admin/admin-notes.html">Admin Notes (Local Dev)</a>
113+
<a data-nav-link data-admin-notes-local-menu href="/admin/admin-notes.html">Admin Notes (Local Dev)</a>
114114
<a data-nav-link data-route="admin-analytics" href="admin/analytics.html">Analytics</a>
115115
<a data-nav-link data-route="admin-branding" href="admin/branding.html">Branding</a>
116116
<a data-nav-link data-route="admin-controls" href="admin/controls.html">Controls</a>

src/dev-runtime/server/local-api-server.mjs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,9 @@ function resolveBrowserRoutePath(decodedPath) {
3131
if (webPath === "/tools" || webPath.startsWith("/tools/")) {
3232
return `/toolbox${webPath.slice("/tools".length)}`;
3333
}
34+
if (webPath === "/admin/admin-notes.html") {
35+
return "/src/dev-runtime/admin/admin-notes.html";
36+
}
3437
return normalizedPath;
3538
}
3639

0 commit comments

Comments
 (0)