|
| 1 | +# PR_26157_018 Dev Runtime And PR017 Cleanup Report |
| 2 | + |
| 3 | +## Executive Summary |
| 4 | + |
| 5 | +Status: PASS |
| 6 | + |
| 7 | +PR_26157_018 creates the `src/dev-runtime/` boundary, moves the mock DB implementation under that boundary behind the existing engine persistence contract, removes PR017 fallback/session issues, and locks DB Viewer to Local admin-only shared Memory DB state without repository side-effect population. |
| 8 | + |
| 9 | +## Source Of Truth Re-Read |
| 10 | + |
| 11 | +- Re-read `docs_build/dev/PROJECT_INSTRUCTIONS.md` before implementation. |
| 12 | +- Re-read the original PR_26157_018 request before packaging. |
| 13 | +- Used PR_26157_017 delta as context. |
| 14 | +- Applied the PR Completion Rule: every requested item below has explicit PASS evidence. |
| 15 | + |
| 16 | +## Requirement Checklist |
| 17 | + |
| 18 | +| Requirement | Status | Evidence | |
| 19 | +| --- | --- | --- | |
| 20 | +| Fix all identified PR_26157_017 issues | PASS | Removed local session identity map, old alias session storage, DB Viewer repository side effects, legacy audit key scrubber, and active `?role=` tests. | |
| 21 | +| Create/enforce `src/dev-runtime/` structure | PASS | Added `src/dev-runtime/auth/`, `src/dev-runtime/persistence/`, `src/dev-runtime/admin/`, `src/dev-runtime/testing/`, and `src/dev-runtime/guest-seeds/`. | |
| 22 | +| Add PROJECT_INSTRUCTIONS dev-runtime rule | PASS | Added `DEV RUNTIME BOUNDARY` section to `docs_build/dev/PROJECT_INSTRUCTIONS.md`. | |
| 23 | +| All mock/dev-only runtime lives under `src/dev-runtime/` | PASS | Moved mock DB implementation to `src/dev-runtime/persistence/mock-db-store.js`; `src/engine/persistence/mock-db-store.js` is now a one-line contract shim. | |
| 24 | +| UAT/PROD must never import, bundle, or deploy `src/dev-runtime/` | PASS | Governance rule added; active tools do not import `src/dev-runtime/` directly. | |
| 25 | +| No fallback auth/session/user data | PASS | `assets/theme-v2/js/gamefoundry-partials.js` resolves selected user and roles only from persisted Memory DB rows; `src/dev-runtime/persistence/mock-db-store.js` removed static session users. | |
| 26 | +| Missing users/roles fail visibly | PASS | Login/access guard shows visible diagnostics for missing seeded DB, missing selected user key, and missing roles. | |
| 27 | +| Remove active Playwright `?role=user/admin/guest` usage | PASS | `rg -n "\?role=|role=user|role=admin|role=guest" tests/playwright/tools toolbox assets src admin -g "*.mjs" -g "*.js" -g "*.html"` returned no matches. | |
| 28 | +| Remove hardcoded `localSessionUsers` from shared header | PASS | `assets/theme-v2/js/gamefoundry-partials.js` no longer contains `localSessionUsers`; scan returned no matches. | |
| 29 | +| Session stores selected user key only | PASS | Login buttons store `users.key` values; Logout/Guest remove the session key; tests seed `gamefoundry.mockDb.sessionUser.v1` with `MOCK_DB_KEYS.users.*`. | |
| 30 | +| User display/roles resolve from persisted DB | PASS | Header and dev runtime read `users`, `roles`, and `user_roles`; Login/Auth lane verifies User 1/Admin header display and role gates. | |
| 31 | +| Remove `LEGACY_AUDIT_KEY_TO_USER_KEY` and obsolete compatibility scrubber logic | PASS | Legacy constant and remap removed; scan returned no legacy symbols. | |
| 32 | +| DB Viewer reads shared DB state only | PASS | `admin/db-viewer.js` removed Project Journey/Palette/Asset repository imports and `getTables()` side-effect calls. | |
| 33 | +| DB Viewer must not populate data by repository side effects | PASS | `AdminDbViewer.spec.mjs` first-open assertions show tool-owned tables as empty until tools write shared DB records. | |
| 34 | +| DB Viewer read-only except Local-only clear/seed controls | PASS | DB table surface has no inputs/selects/edit buttons; clear/seed remains outside table viewer and is available only after Local admin access. | |
| 35 | +| DB Viewer admin-only | PASS | Shared page guard protects `admin/**`; Login lane verifies Guest/User blocks and Admin unlock. | |
| 36 | +| DB Viewer Local-only, not DEV | PASS | `LoginSessionMode.spec.mjs` verifies DEV mode blocks `/admin/db-viewer.html` and the DB Viewer UI does not render. | |
| 37 | +| DEV mode has no DB Viewer | PASS | DEV DB Viewer direct URL is blocked with visible read-only/demo diagnostic. | |
| 38 | +| DEV mode has no local user switching | PASS | Login lane verifies DEV mode hides local user controls and shows no users. | |
| 39 | +| DEV mode is JSON/demo read-only only | PASS | Login lane verifies DEV mode disables persistence and no user selector is shown. | |
| 40 | +| Local mode has persisted Memory DB, login user selection, DB Viewer, clear/seed | PASS | Login lane verifies Local users; DB Viewer lane verifies persisted records, filters, clear/seed. | |
| 41 | +| Verify no active tool imports `src/dev-runtime` directly | PASS | `rg -n "src/dev-runtime|\.\./.*dev-runtime|dev-runtime" admin toolbox assets tests/playwright/tools -g "*.js" -g "*.mjs" -g "*.html"` returned no matches. | |
| 42 | +| Verify DB Viewer reads shared DB without repository side-effect population | PASS | DB Viewer lane first test and live persisted records test passed. | |
| 43 | +| Run changed-file/static validation and targeted Playwright | PASS | Static validation passed; targeted runtime passed 21/21. | |
| 44 | +| Do not run full samples smoke | PASS | Full samples smoke skipped per request. | |
| 45 | +| Required reports exist | PASS | This report, testing lane report, V8 coverage report, review diff, and changed files report were produced. | |
| 46 | + |
| 47 | +## Validation Evidence |
| 48 | + |
| 49 | +| Lane | Command | Result | |
| 50 | +| --- | --- | --- | |
| 51 | +| Runtime syntax | `node --check src/dev-runtime/persistence/mock-db-store.js; node --check src/engine/persistence/mock-db-store.js; node --check assets/theme-v2/js/gamefoundry-partials.js; node --check assets/theme-v2/js/login-session.js; node --check admin/db-viewer.js` | PASS | |
| 52 | +| Focused test syntax | `node --check tests/playwright/tools/LoginSessionMode.spec.mjs; node --check tests/playwright/tools/AdminDbViewer.spec.mjs; node --check tests/playwright/tools/ProjectJourneyTool.spec.mjs; node --check tests/playwright/tools/RootToolsFutureState.spec.mjs; node --check tests/playwright/tools/ToolNavigationPrevNext.spec.mjs; node --check tests/playwright/tools/ToolDisplayModeNavigation.spec.mjs` | PASS | |
| 53 | +| Role-query cleanup test syntax | `node --check` across all Playwright files touched by `?role=` cleanup | PASS | |
| 54 | +| Auth/header/login/account | `npx playwright test tests/playwright/tools/LoginSessionMode.spec.mjs --project=playwright --reporter=list --workers=1` | PASS, 5/5 | |
| 55 | +| Admin DB Viewer | `npx playwright test tests/playwright/tools/AdminDbViewer.spec.mjs --project=playwright --reporter=list --workers=1` | PASS, 3/3 | |
| 56 | +| Project Journey | `npx playwright test tests/playwright/tools/ProjectJourneyTool.spec.mjs --project=playwright --reporter=list --workers=1` | PASS, 13/13 | |
| 57 | +| Combined targeted runtime and coverage | `npx playwright test tests/playwright/tools/LoginSessionMode.spec.mjs tests/playwright/tools/AdminDbViewer.spec.mjs tests/playwright/tools/ProjectJourneyTool.spec.mjs --project=playwright --reporter=list --workers=1` | PASS, 21/21 | |
| 58 | +| Changed-file/static validation | `npm run test:playwright:static` | PASS | |
| 59 | +| Whitespace | `git diff --check` | PASS, line-ending warnings only | |
| 60 | +| Required folder check | `Test-Path src/dev-runtime/auth`, `persistence`, `admin`, `testing`, `guest-seeds` | PASS | |
| 61 | +| Removed field scan | `rg -n "createdByType|updatedByType|accountType|isSystemUser|actors" src admin toolbox assets/theme-v2 tests/playwright/tools -g "*.js" -g "*.mjs" -g "*.html"` | PASS, no matches | |
| 62 | +| Role query scan | `rg -n "\?role=|role=user|role=admin|role=guest" tests/playwright/tools toolbox assets src admin -g "*.mjs" -g "*.js" -g "*.html"` | PASS, no matches | |
| 63 | +| Legacy session scan | `rg -n "localSessionUsers|LEGACY_AUDIT_KEY_TO_USER_KEY|MOCK_DB_SESSION_USERS|sessionUserFromId|selectedSessionUserId" src assets admin toolbox tests/playwright/tools -g "*.js" -g "*.mjs" -g "*.html"` | PASS, no matches | |
| 64 | +| Direct dev-runtime import scan | `rg -n "src/dev-runtime|\.\./.*dev-runtime|dev-runtime" admin toolbox assets tests/playwright/tools -g "*.js" -g "*.mjs" -g "*.html"` | PASS, no matches | |
| 65 | + |
| 66 | +## Files Changed |
| 67 | + |
| 68 | +- `docs_build/dev/PROJECT_INSTRUCTIONS.md` |
| 69 | +- `src/engine/persistence/mock-db-store.js` |
| 70 | +- `src/dev-runtime/persistence/mock-db-store.js` |
| 71 | +- `src/dev-runtime/auth/.gitkeep` |
| 72 | +- `src/dev-runtime/admin/.gitkeep` |
| 73 | +- `src/dev-runtime/testing/.gitkeep` |
| 74 | +- `src/dev-runtime/guest-seeds/.gitkeep` |
| 75 | +- `assets/theme-v2/js/gamefoundry-partials.js` |
| 76 | +- `assets/theme-v2/js/login-session.js` |
| 77 | +- `admin/db-viewer.js` |
| 78 | +- `tests/playwright/tools/AdminDbViewer.spec.mjs` |
| 79 | +- `tests/playwright/tools/LoginSessionMode.spec.mjs` |
| 80 | +- `tests/playwright/tools/ProjectJourneyTool.spec.mjs` |
| 81 | +- `tests/playwright/tools/AssetToolMockRepository.spec.mjs` |
| 82 | +- `tests/playwright/tools/BuildPathProgressSimplification.spec.mjs` |
| 83 | +- `tests/playwright/tools/GameConfigurationMockRepository.spec.mjs` |
| 84 | +- `tests/playwright/tools/GameDesignMockRepository.spec.mjs` |
| 85 | +- `tests/playwright/tools/ProjectWorkspaceMockRepository.spec.mjs` |
| 86 | +- `tests/playwright/tools/RootToolsFutureState.spec.mjs` |
| 87 | +- `tests/playwright/tools/ToolCenterFullscreenAccordion.spec.mjs` |
| 88 | +- `tests/playwright/tools/ToolDisplayModeNavigation.spec.mjs` |
| 89 | +- `tests/playwright/tools/ToolImageRegistry.spec.mjs` |
| 90 | +- `tests/playwright/tools/ToolNavigationPrevNext.spec.mjs` |
| 91 | +- `tests/playwright/tools/ToolsProgressHydration.spec.mjs` |
| 92 | +- Required report artifacts under `docs_build/dev/reports/` |
| 93 | + |
| 94 | +## Manual Validation Notes |
| 95 | + |
| 96 | +1. Open `login.html`, switch to DEV, confirm no local users appear. |
| 97 | +2. In DEV, open `admin/db-viewer.html` directly and confirm it is blocked. |
| 98 | +3. Switch Login to Local, choose Admin, open `admin/db-viewer.html`, and confirm Mock DB renders. |
| 99 | +4. Open Project Journey as a Local user, add an item, refresh, then open DB Viewer and confirm the record appears. |
| 100 | + |
| 101 | +Full samples smoke: SKIP per request. |
0 commit comments