Skip to content

Commit b583def

Browse files
committed
Add dev-only Admin Notes access to admin menu - PR_26158_042-admin-notes-menu-link
1 parent 46d6906 commit b583def

7 files changed

Lines changed: 119 additions & 20 deletions

File tree

assets/theme-v2/js/gamefoundry-partials.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@
8080
"admin-roles": "admin/roles.html",
8181
"admin-moderation": "admin/moderation.html",
8282
"admin-analytics": "admin/analytics.html",
83+
"admin-notes-dev": "docs_build/dev/admin-notes/index.txt",
8384
"admin-tools-progress": "admin/tools-progress.html",
8485
"cookie-policy": "legal/cookie-policy.html",
8586
disclaimer: "legal/disclaimer.html",

assets/theme-v2/partials/header-nav.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,7 @@
119119
<a data-nav-link data-route="game-migration" href="toolbox/game-migration/index.html">Game Migration</a>
120120
<a data-nav-link data-route="admin-grouping-colors" href="admin/grouping-colors.html">Grouping Colors</a>
121121
<a data-nav-link data-route="admin-moderation" href="admin/moderation.html">Moderation</a>
122+
<a data-nav-link data-route="admin-notes-dev" href="docs_build/dev/admin-notes/index.txt">Notes (Dev/Admin Only)</a>
122123
<a data-nav-link data-route="platform-settings" href="toolbox/platform-settings/index.html">Platform Settings</a>
123124
<a data-nav-link data-route="admin-ratings" href="admin/ratings.html">Ratings</a>
124125
<a data-nav-link data-route="admin-roles" href="admin/roles.html">Roles</a>

docs_build/dev/admin-notes/README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,6 @@ Owned paths:
1111

1212
Runtime boundary:
1313
- Admin Notes viewer implementation, when needed for local/dev inspection, belongs under `src/dev-runtime/admin/`.
14-
- Production-facing paths must not link to or fetch `docs_build/dev/admin-notes/`.
14+
- Only the admin/dev menu may link directly to `docs_build/dev/admin-notes/` content.
15+
- Public user navigation, toolbox pages, root pages, and production runtime bundles must not link to or fetch Admin Notes content.
1516
- UAT/PROD bundles must not import `src/dev-runtime/admin/`.
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
# PR_26158_042 Admin Notes Menu Link Report
2+
3+
## Summary
4+
5+
Added a dev/admin-only Admin Notes link to the existing Admin menu. The link routes directly to `docs_build/dev/admin-notes/index.txt`, remains hidden from public user navigation with the Admin menu, and preserves the PR_26158_041 ownership boundary for Admin Notes files.
6+
7+
## Requirement Checklist
8+
9+
| Requirement | Evidence | Status |
10+
| --- | --- | --- |
11+
| Read `docs_build/dev/PROJECT_INSTRUCTIONS.md` first. | Read before implementation. | PASS |
12+
| Add Admin Notes to the appropriate Admin/dev menu so notes can be opened from the UI. | `assets/theme-v2/partials/header-nav.html` adds `Notes (Dev/Admin Only)` under Admin. | PASS |
13+
| Link only to `docs_build/dev/admin-notes/` content. | Header link and route map target `docs_build/dev/admin-notes/index.txt`. | PASS |
14+
| Keep Admin Notes clearly marked dev/admin-only. | Menu label is `Notes (Dev/Admin Only)`. | PASS |
15+
| Do not expose Admin Notes from public user navigation. | User-session Admin menu stays hidden; static audits outside allowed Admin menu files found no exposure. | PASS |
16+
| Do not include Admin Notes in public-facing bundles unless existing dev/admin menu is intentionally available there. | Only the existing Admin menu partial and its shared route map were touched. No toolbox/root/account public nav link was added. | PASS |
17+
| Preserve admin notes file ownership from PR_26158_041. | `docs_build/dev/admin-notes/README.md` documents the sole Admin menu exception; boundary test enforces ownership. | 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` on changed JS/MJS test files. | PASS |
20+
| Run targeted menu/navigation validation. | AdminNotesBoundary node test and focused RootToolsFutureState header-order Playwright lane passed. | PASS |
21+
| Run Playwright only if Admin menu UI behavior changes. | Focused LoginSessionMode Admin menu lane passed. | PASS |
22+
| Verify no public user nav exposes Admin Notes. | Static audits and User-session Playwright coverage. | PASS |
23+
24+
## Changed Files
25+
26+
| File | Purpose |
27+
| --- | --- |
28+
| `assets/theme-v2/partials/header-nav.html` | Adds the Admin submenu link. |
29+
| `assets/theme-v2/js/gamefoundry-partials.js` | Adds the route map entry so the link resolves correctly from nested pages. |
30+
| `docs_build/dev/admin-notes/README.md` | Documents the allowed Admin/dev menu link exception. |
31+
| `tests/dev-runtime/AdminNotesBoundary.test.mjs` | Updates the Admin Notes boundary test to allow only the exact Admin menu link and route map support entry. |
32+
| `tests/playwright/tools/LoginSessionMode.spec.mjs` | Verifies the Admin session sees the dev/admin-only Notes link and public user sessions do not expose Admin navigation. |
33+
34+
## Validation Evidence
35+
36+
| Validation | Result |
37+
| --- | --- |
38+
| `node --check assets/theme-v2/js/gamefoundry-partials.js; node --check tests/dev-runtime/AdminNotesBoundary.test.mjs; node --check tests/playwright/tools/LoginSessionMode.spec.mjs` | PASS |
39+
| `node --test tests/dev-runtime/AdminNotesBoundary.test.mjs` | PASS, 3/3 |
40+
| Public path `rg` audit over `account admin toolbox src` | PASS, no matches |
41+
| Asset path `rg` audit excluding the exact allowed header partial and route map | PASS, no matches |
42+
| `npx playwright test tests/playwright/tools/LoginSessionMode.spec.mjs --grep "Local users unlock their allowed Account and Admin pages"` | PASS |
43+
| `npx playwright test tests/playwright/tools/RootToolsFutureState.spec.mjs --grep "common header renders primary navigation order across active pages"` | PASS |
44+
| `git diff --check` | PASS, line-ending warnings only |
45+
46+
## Notes
47+
48+
- A broad exploratory run of `RootToolsFutureState.spec.mjs` failed an unrelated stale tool-count assertion (`4/37` expected, `5/38` rendered). The focused header/navigation lane from that file passed and covers this PR's menu-order behavior.
49+
- No full samples smoke was run because no sample loader/framework or game runtime path changed.
Lines changed: 24 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,44 @@
1-
# PR_26158_041 Testing Lane Execution Report
1+
# PR_26158_042 Testing Lane Execution Report
22

33
## Lanes Run
44

55
| Lane | Command | Result |
66
| --- | --- | --- |
7-
| Changed-file syntax checks | `node --check assets/theme-v2/js/gamefoundry-partials.js`; `node --check src/dev-runtime/admin/admin-notes-viewer.js`; `node --check tests/helpers/playwrightRepoServer.mjs`; `node --check tests/dev-runtime/AdminNotesBoundary.test.mjs` | PASS |
8-
| Docs/static Admin Notes boundary validation | `node --test tests/dev-runtime/AdminNotesBoundary.test.mjs` | PASS, 3/3 |
9-
| Production path Admin Notes exposure audit | `rg -n "docs_build/dev/admin-notes\|docs_build\\dev\\admin-notes\|admin-notes\|Admin Notes\|data-admin-notes" account admin assets toolbox src --glob '!src/dev-runtime/**' --glob '!archive/v1-v2/**' --glob '!tmp/**'` | PASS, no matches |
10-
| UAT/PROD dev-runtime admin import audit | `rg -n "src/dev-runtime/admin\|src\\dev-runtime\\admin" account admin assets toolbox src --glob '!src/dev-runtime/**' --glob '!archive/v1-v2/**' --glob '!tmp/**'` | PASS, no matches |
7+
| Changed-file syntax checks | `node --check assets/theme-v2/js/gamefoundry-partials.js`; `node --check tests/dev-runtime/AdminNotesBoundary.test.mjs`; `node --check tests/playwright/tools/LoginSessionMode.spec.mjs` | PASS |
8+
| Admin Notes boundary/menu validation | `node --test tests/dev-runtime/AdminNotesBoundary.test.mjs` | PASS, 3/3 |
9+
| Public navigation exposure audit | `rg -n 'docs_build/dev/admin-notes\|docs_build\\dev\\admin-notes\|admin-notes-dev\|Admin Notes' account admin toolbox src --glob '!src/dev-runtime/**' --glob '!archive/v1-v2/**' --glob '!tmp/**'` | PASS, no matches |
10+
| Asset exposure audit outside allowed Admin menu support files | `rg -n 'docs_build/dev/admin-notes\|docs_build\\dev\\admin-notes\|admin-notes-dev\|Admin Notes' assets --glob '!assets/theme-v2/partials/header-nav.html' --glob '!assets/theme-v2/js/gamefoundry-partials.js' --glob '!archive/v1-v2/**' --glob '!tmp/**'` | PASS, no matches |
11+
| Admin menu UI validation | `npx playwright test tests/playwright/tools/LoginSessionMode.spec.mjs --grep "Local users unlock their allowed Account and Admin pages"` | PASS, Admin session sees the dev/admin-only Notes link; User session does not see Admin menu |
12+
| Header/navigation order validation | `npx playwright test tests/playwright/tools/RootToolsFutureState.spec.mjs --grep "common header renders primary navigation order across active pages"` | PASS |
1113
| Changed-file whitespace/static validation | `git diff --check` | PASS, Git line-ending warnings only |
12-
| start_of_day protection check | `git diff --name-only \| rg "start_of_day"` | PASS, no matches |
14+
| start_of_day protection check | `git diff --name-only \| rg "(^|/)start_of_day(/|$)"` | PASS, no matches |
1315

1416
## Validation Notes
1517

1618
| Check | Evidence | Result |
1719
| --- | --- | --- |
18-
| Admin Notes docs live under `docs_build/dev/admin-notes/`. | `tests/dev-runtime/AdminNotesBoundary.test.mjs`; `docs_build/dev/admin-notes/README.md`. | PASS |
19-
| Production-facing Admin Notes route was removed. | `admin/notes.html` deleted; header nav and partial route map removed. | PASS |
20-
| Duplicate production-path note files were removed. | `admin/notes/index.txt` and `admin/notes/other/index.txt` deleted. | PASS |
21-
| Runtime implementation moved under dev-runtime admin. | `src/dev-runtime/admin/admin-notes-viewer.js`. | PASS |
22-
| Production paths do not link/import dev Admin Notes content. | Static `rg` audit returned no matches. | PASS |
23-
| UAT/PROD candidate paths do not import `src/dev-runtime/admin/`. | Static `rg` audit returned no matches. | PASS |
20+
| Admin Notes is reachable from the Admin/dev menu. | `assets/theme-v2/partials/header-nav.html`; LoginSessionMode Playwright assertion. | PASS |
21+
| Link resolves to `docs_build/dev/admin-notes/index.txt` content. | `assets/theme-v2/js/gamefoundry-partials.js` maps `admin-notes-dev` to the dev notes file; Playwright validates normalized href ending in `docs_build/dev/admin-notes/index.txt`. | PASS |
22+
| Admin Notes is clearly marked dev/admin-only. | Menu label is `Notes (Dev/Admin Only)`. | PASS |
23+
| Public user navigation does not expose Admin Notes. | User-session Playwright keeps Admin menu hidden; static audits found no public user-nav matches. | PASS |
24+
| Admin Notes file ownership from PR_26158_041 is preserved. | `docs_build/dev/admin-notes/README.md`; AdminNotesBoundary test. | PASS |
25+
| No `start_of_day` files changed. | `git diff --name-only \| rg "(^|/)start_of_day(/|$)"` returned no matches. | PASS |
26+
27+
## Exploratory/Out-of-Scope Result
28+
29+
| Command | Result | Disposition |
30+
| --- | --- | --- |
31+
| `npx playwright test tests/playwright/tools/RootToolsFutureState.spec.mjs` | FAIL in `root tools surface links current tool pages without old_* routes`: expected `Tool Count: 4/37`, current UI showed `Tool Count: 5/38`. Other tests in the spec passed. | Not caused by PR_26158_042 Admin Notes menu link. The focused header/navigation test from the same spec passed and is the scoped validation lane for this PR. |
2432

2533
## Skipped Lanes
2634

2735
| Lane | Decision | Reason |
2836
| --- | --- | --- |
29-
| Playwright | SKIP | The production Admin Notes route was retired; the old Playwright lane targeted the removed route. Static boundary validation is the requested lane for this cleanup. |
30-
| Full samples smoke | SKIP | No sample loader/framework, sample fixture, or game runtime path changed. |
31-
| Full Node suite | SKIP | Targeted Node syntax and Admin Notes boundary test covered the changed files and requested static ownership validation. |
37+
| Full samples smoke | SKIP | No sample loader/framework, game runtime, or samples path changed. |
38+
| Full Playwright suite | SKIP | Scoped request only changed Admin menu/navigation exposure; targeted Admin menu and header lanes passed. |
39+
| Playwright V8 coverage report regeneration | SKIP | Not required for PR_26158_042 and no runtime behavior beyond header navigation mapping was added. |
3240

3341
## Notes
3442

3543
- `git diff --check` emitted line-ending warnings only.
36-
- No `start_of_day` files were modified.
44+
- Playwright emitted existing SQLite experimental and seed-only audit fallback warnings; they did not fail the targeted lanes.

tests/dev-runtime/AdminNotesBoundary.test.mjs

Lines changed: 37 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@ const productionRoots = [
1313
"src/shared",
1414
"toolbox",
1515
];
16+
const allowedAdminMenuLinkPath = "assets/theme-v2/partials/header-nav.html";
17+
const allowedAdminMenuRoutePath = "assets/theme-v2/js/gamefoundry-partials.js";
18+
const allowedAdminMenuHref = "docs_build/dev/admin-notes/index.txt";
1619

1720
const expectedDevNotes = [
1821
"docs_build/dev/admin-notes/README.md",
@@ -64,6 +67,22 @@ function relativePath(absolutePath) {
6467
return path.relative(repoRoot, absolutePath).replaceAll(path.sep, "/");
6568
}
6669

70+
function allowedAdminMenuLinkOnly(filePath, source) {
71+
const relative = relativePath(filePath);
72+
let allowedFragment = "";
73+
if (relative === allowedAdminMenuLinkPath) {
74+
allowedFragment = `<a data-nav-link data-route="admin-notes-dev" href="${allowedAdminMenuHref}">Notes (Dev/Admin Only)</a>`;
75+
}
76+
if (relative === allowedAdminMenuRoutePath) {
77+
allowedFragment = `"admin-notes-dev": "${allowedAdminMenuHref}",`;
78+
}
79+
if (!allowedFragment || !source.includes(allowedFragment)) {
80+
return false;
81+
}
82+
const remainder = source.replace(allowedFragment, "");
83+
return !/docs_build\/dev\/admin-notes|docs_build\\dev\\admin-notes|src\/dev-runtime\/admin|src\\dev-runtime\\admin|admin-notes|Admin Notes/.test(remainder);
84+
}
85+
6786
test("Admin Notes dev documents live under docs_build/dev/admin-notes only", () => {
6887
expectedDevNotes.forEach((filePath) => {
6988
assert.equal(fs.existsSync(repoPath(filePath)), true, `${filePath} exists`);
@@ -81,14 +100,29 @@ test("Admin Notes implementation is isolated under src/dev-runtime/admin", () =>
81100
);
82101
});
83102

84-
test("production-facing paths do not link to dev Admin Notes files or implementation", () => {
103+
test("only the admin menu links to dev Admin Notes content", () => {
104+
const headerSource = fs.readFileSync(repoPath(allowedAdminMenuLinkPath), "utf8");
105+
assert.match(
106+
headerSource,
107+
/data-route="admin-notes-dev" href="docs_build\/dev\/admin-notes\/index\.txt">Notes \(Dev\/Admin Only\)<\/a>/,
108+
"Admin menu has the dev/admin-only Admin Notes link",
109+
);
110+
assert.doesNotMatch(
111+
headerSource,
112+
/href="admin\/notes\.html"/,
113+
"Admin Notes must not restore the retired production route",
114+
);
115+
85116
const violations = productionRoots
86117
.flatMap(walkTextFiles)
87118
.filter((filePath) => {
88119
const source = fs.readFileSync(filePath, "utf8");
89-
return /docs_build\/dev\/admin-notes|docs_build\\dev\\admin-notes|src\/dev-runtime\/admin|src\\dev-runtime\\admin|admin-notes|Admin Notes/.test(source);
120+
if (!/docs_build\/dev\/admin-notes|docs_build\\dev\\admin-notes|src\/dev-runtime\/admin|src\\dev-runtime\\admin|admin-notes|Admin Notes/.test(source)) {
121+
return false;
122+
}
123+
return !allowedAdminMenuLinkOnly(filePath, source);
90124
})
91125
.map(relativePath);
92126

93-
assert.deepEqual(violations, [], "production-facing paths must not expose Admin Notes");
127+
assert.deepEqual(violations, [], "only the Admin menu may expose Admin Notes");
94128
});

tests/playwright/tools/LoginSessionMode.spec.mjs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -365,6 +365,11 @@ test("Local users unlock their allowed Account and Admin pages", async ({ page }
365365
await page.locator("nav.nav-links > .nav-item:has(> a[data-route='account'])").hover();
366366
await expect(page.locator("[data-account-logout]")).toBeVisible();
367367
await expect(page.locator("nav.nav-links > .nav-item:has(> a[data-route='admin'])")).toBeVisible();
368+
await expect(page.locator("nav.nav-links a[data-route='admin-notes-dev']")).toHaveText("Notes (Dev/Admin Only)");
369+
await expect(page.locator("nav.nav-links a[data-route='admin-notes-dev']")).toHaveAttribute(
370+
"href",
371+
/(^|\/)docs_build\/dev\/admin-notes\/index\.txt$/,
372+
);
368373
await expectNoPageFailures(failures);
369374
} finally {
370375
await closeWithCoverage(page, failures);

0 commit comments

Comments
 (0)