Skip to content

Commit 05c8fe6

Browse files
committed
Use runtime DB timestamps and verify guest/user seed integrity - PR_26158_037-db-seed-integrity
1 parent e3ccd6b commit 05c8fe6

12 files changed

Lines changed: 444 additions & 45 deletions

docs_build/dev/reports/coverage_changed_js_guardrail.txt

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,16 @@ 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/server/local-api-server.mjs - WARNING: changed runtime JS file was not collected by Playwright V8 coverage; advisory only
9+
(0%) src/dev-runtime/persistence/mock-db-store.js - WARNING: changed runtime JS file was not collected by Playwright V8 coverage; advisory only
10+
(0%) src/dev-runtime/server/mock-api-router.mjs - WARNING: changed runtime JS file was not collected by Playwright V8 coverage; advisory only
11+
(0%) toolbox/assets/assets-mock-repository.js - WARNING: changed runtime JS file was not collected by Playwright V8 coverage; advisory only
12+
(0%) toolbox/colors/palette-workspace-repository.js - WARNING: changed runtime JS file was not collected by Playwright V8 coverage; advisory only
13+
(0%) toolbox/project-journey/project-journey-mock-repository.js - WARNING: changed runtime JS file was not collected by Playwright V8 coverage; advisory only
14+
(87%) src/engine/api/mock-db-viewer-ui.js - executed lines 517/517; executed functions 85/98
1015

1116
Guardrail warnings:
12-
(0%) src/dev-runtime/server/local-api-server.mjs - WARNING: changed runtime JS file missing from coverage; advisory only
17+
(0%) src/dev-runtime/persistence/mock-db-store.js - WARNING: changed runtime JS file missing from coverage; advisory only
18+
(0%) src/dev-runtime/server/mock-api-router.mjs - WARNING: changed runtime JS file missing from coverage; advisory only
19+
(0%) toolbox/assets/assets-mock-repository.js - WARNING: changed runtime JS file missing from coverage; advisory only
20+
(0%) toolbox/colors/palette-workspace-repository.js - WARNING: changed runtime JS file missing from coverage; advisory only
21+
(0%) toolbox/project-journey/project-journey-mock-repository.js - WARNING: changed runtime JS file missing from coverage; advisory only
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
# PR_26158_037 DB Seed Integrity Report
2+
3+
## Executive Summary
4+
5+
Local DB and Local Mem seed creation now use runtime-generated timestamps for createdAt and updatedAt instead of hardcoded 2026 seed anchors.
6+
7+
The server seed snapshot now includes a standalone `tool_state_samples` table. Guest rows are generated from the active toolbox registry so every available tool has a loadable starter toolState/sample row. User rows provide unique user-owned project/toolState seed records for User 1, User 2, User 3, and Admin without storing Guest as a DB user.
8+
9+
## Implementation
10+
11+
| Area | Change | Evidence |
12+
| --- | --- | --- |
13+
| Shared mock DB schema | Added `tool_state_samples` schema and standalone ownership. | `src/dev-runtime/persistence/mock-db-store.js` |
14+
| Runtime timestamps | Replaced fixed 2026 seed timestamp helpers with runtime timestamp generation in shared DB, Palette, Asset, and Project Journey seed helpers. | `src/dev-runtime/persistence/mock-db-store.js`; `toolbox/colors/palette-workspace-repository.js`; `toolbox/assets/assets-mock-repository.js`; `toolbox/project-journey/project-journey-mock-repository.js` |
15+
| Server seed table | Added server-side `tool_state_samples` rows for guest active-tool starters and unique human-user seed rows. | `src/dev-runtime/server/mock-api-router.mjs` |
16+
| DB Viewer visibility | Added a standalone `Tool State Samples` filter label and userKey relationship diagnostics. | `src/engine/api/mock-db-viewer-ui.js` |
17+
| Validation | Added targeted Node seed integrity test and extended Admin DB Viewer Playwright. | `tests/dev-runtime/DbSeedIntegrity.test.mjs`; `tests/playwright/tools/AdminDbViewer.spec.mjs` |
18+
19+
## Requirement Checklist
20+
21+
| Requirement | Evidence | Status |
22+
| --- | --- | --- |
23+
| Read `docs_build/dev/PROJECT_INSTRUCTIONS.md` first. | Read before implementation and validation. | PASS |
24+
| When creating/initializing the Local DB, use real runtime timestamps for `createdAt` and `updatedAt`. | Shared DB, server seed, Palette, Asset, and Project Journey seed helpers use `Date.now()` / `new Date()` runtime timestamps. Node and Playwright validate runtime parseable timestamps. | PASS |
25+
| Remove hardcoded seed timestamps from DB creation paths. | Targeted `rg` search found no active hardcoded `Date.UTC(2026)`, fixed `const now = "2026..."`, or old hardcoded seed timestamp in touched seed paths. | PASS |
26+
| Verify guest seed data includes at least one loadable sample/toolState for every available tool. | `tool_state_samples` guest rows are built from `getActiveToolRegistry()` and validated against `/api/toolbox/registry/snapshot`. | PASS |
27+
| Verify each seeded user has unique projects, tool states, manifests, or sample data where user-owned data exists. | User 1, User 2, User 3, and Admin have unique `projectKey`, `toolStateKey`, `manifestPath`, and `sampleLabel` rows. | PASS |
28+
| Do not share mutable seeded records across users. | Validation verifies separate user-owned seed rows with unique project/toolState keys. | PASS |
29+
| Preserve audit fields: `key`, `createdAt`, `updatedAt`, `createdBy`, `updatedBy`. | Table schemas include audit fields; AdminDbViewer audit diagnostics and Node test validate fields and user references. | PASS |
30+
| Preserve SQLite-backed Local DB behind API boundary. | Local DB mode is selected through `/api/session/mode`; AdminDbViewer reads through `/api/mock-db/snapshot`; no browser DB imports were added. | PASS |
31+
| Do not add UAT/Prod behavior. | No UAT/Prod adapter or login behavior changed. | PASS |
32+
| Run changed-file syntax checks. | All changed JS/MJS/spec files passed `node --check`. | PASS |
33+
| Run targeted DB seed integrity validation. | `node --test tests/dev-runtime/DbSeedIntegrity.test.mjs` passed 1/1. | PASS |
34+
| Run AdminDbViewer Playwright to verify timestamps, guest samples, and user-unique records are visible. | `npx playwright test tests/playwright/tools/AdminDbViewer.spec.mjs` passed 7/7 with new visible `tool_state_samples` checks. | PASS |
35+
| Run LoginSessionMode Playwright if login/session seed behavior is touched. | `npx playwright test tests/playwright/tools/LoginSessionMode.spec.mjs` passed 5/5. | PASS |
36+
| Do not run full samples smoke unless directly impacted. | Full samples smoke skipped because sample runtime/loader files were not changed. | PASS |
37+
| Required reports and review artifacts generated. | This report, `testing_lane_execution_report.md`, V8 coverage, review diff, changed files, and ZIP artifact generated. | PASS |
38+
39+
## Validation Commands
40+
41+
| Command | Result |
42+
| --- | --- |
43+
| `node --check src/dev-runtime/persistence/mock-db-store.js` | PASS |
44+
| `node --check src/dev-runtime/server/mock-api-router.mjs` | PASS |
45+
| `node --check src/engine/api/mock-db-viewer-ui.js` | PASS |
46+
| `node --check toolbox/colors/palette-workspace-repository.js` | PASS |
47+
| `node --check toolbox/assets/assets-mock-repository.js` | PASS |
48+
| `node --check toolbox/project-journey/project-journey-mock-repository.js` | PASS |
49+
| `node --check tests/playwright/tools/AdminDbViewer.spec.mjs` | PASS |
50+
| `node --check tests/dev-runtime/DbSeedIntegrity.test.mjs` | PASS |
51+
| `rg -n 'Date\.UTC\(2026\|const now = "2026\|2026-06-06T09:00:00\.000Z' src/dev-runtime toolbox tests/dev-runtime tests/playwright/tools/AdminDbViewer.spec.mjs` | PASS, no matches |
52+
| `node --test tests/dev-runtime/DbSeedIntegrity.test.mjs` | PASS, 1/1 |
53+
| `npx playwright test tests/playwright/tools/AdminDbViewer.spec.mjs` | PASS, 7/7 |
54+
| `npx playwright test tests/playwright/tools/LoginSessionMode.spec.mjs` | PASS, 5/5 |
55+
| `git diff --check` | PASS, with Git line-ending warnings only |
56+
57+
## Skipped Lanes
58+
59+
| Lane | Decision | Reason |
60+
| --- | --- | --- |
61+
| Full samples smoke | SKIP | No sample loader/framework or sample runtime files changed. |
62+
| Full Playwright suite | SKIP | Targeted AdminDbViewer, LoginSessionMode, and Node seed integrity validations cover the changed DB seed paths. |
63+
| ToolboxRoutePages Playwright | SKIP | Tool page routing was not changed. |
64+
| ProjectJourneyTool Playwright | SKIP | Project Journey UI behavior was not changed; seed timestamp behavior is validated through DB seed/API and Admin DB Viewer. |
65+
66+
## Notes
67+
68+
- No CSS was added.
69+
- Guest remains unauthenticated and is not stored in the `users` table.
70+
- Existing SQLite experimental warnings and seed-only audit fallback diagnostics appeared during validation; they are existing runtime diagnostics and did not affect the PR requirement results.
71+
- V8 coverage warnings for dev-runtime/server and repository files are advisory only; the affected server seed behavior is covered by Node and API-backed Playwright validation.

docs_build/dev/reports/playwright_v8_coverage_report.txt

Lines changed: 33 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -12,26 +12,47 @@ Note: entry percentages use function coverage when available, otherwise line cov
1212
Note: coverage entries are aggregated across every page/tool where coverageReporter.start(page) and coverageReporter.stop(page) ran.
1313

1414
Exercised tool entry points detected:
15-
(0%) Toolbox Index - not exercised by this Playwright run
15+
(61%) Toolbox Index - exercised 3 runtime JS files
1616
(0%) Tool Template V2 - not exercised by this Playwright run
17-
(71%) Theme V2 Shared JS - exercised 2 runtime JS files
17+
(81%) Theme V2 Shared JS - exercised 3 runtime JS files
1818

1919
Changed runtime JS files covered:
20-
(0%) src/dev-runtime/server/local-api-server.mjs - WARNING: changed runtime JS file was not collected by Playwright V8 coverage; advisory only
20+
(0%) src/dev-runtime/persistence/mock-db-store.js - WARNING: changed runtime JS file was not collected by Playwright V8 coverage; advisory only
21+
(0%) src/dev-runtime/server/mock-api-router.mjs - WARNING: changed runtime JS file was not collected by Playwright V8 coverage; advisory only
22+
(0%) toolbox/assets/assets-mock-repository.js - WARNING: changed runtime JS file was not collected by Playwright V8 coverage; advisory only
23+
(0%) toolbox/colors/palette-workspace-repository.js - WARNING: changed runtime JS file was not collected by Playwright V8 coverage; advisory only
24+
(0%) toolbox/project-journey/project-journey-mock-repository.js - WARNING: changed runtime JS file was not collected by Playwright V8 coverage; advisory only
25+
(87%) src/engine/api/mock-db-viewer-ui.js - executed lines 517/517; executed functions 85/98
2126

2227
Files with executed line/function counts where available:
23-
(7%) src/engine/api/server-api-client.js - executed lines 159/159; executed functions 1/14
24-
(13%) src/engine/api/session-api-client.js - executed lines 34/34; executed functions 1/8
25-
(61%) assets/theme-v2/js/login-session.js - executed lines 243/243; executed functions 11/18
26-
(75%) assets/theme-v2/js/gamefoundry-partials.js - executed lines 442/442; executed functions 30/40
28+
(53%) src/engine/api/server-api-client.js - executed lines 159/159; executed functions 10/19
29+
(55%) toolbox/project-journey/project-journey.js - executed lines 1003/1003; executed functions 54/99
30+
(60%) src/engine/api/mock-db-api-client.js - executed lines 19/19; executed functions 3/5
31+
(64%) assets/theme-v2/js/tool-display-mode.js - executed lines 201/201; executed functions 9/14
32+
(67%) admin/db-viewer.js - executed lines 53/53; executed functions 4/6
33+
(81%) toolbox/tool-registry-api-client.js - executed lines 148/148; executed functions 22/27
34+
(83%) assets/theme-v2/js/gamefoundry-partials.js - executed lines 442/442; executed functions 33/40
35+
(87%) src/engine/api/mock-db-viewer-ui.js - executed lines 517/517; executed functions 85/98
36+
(88%) src/engine/api/session-api-client.js - executed lines 34/34; executed functions 7/8
37+
(89%) assets/theme-v2/js/login-session.js - executed lines 243/243; executed functions 17/19
38+
(100%) toolbox/project-journey/project-journey-api-client.js - executed lines 12/12; executed functions 2/2
2739

2840
Uncovered or low-coverage changed JS files:
29-
(0%) src/dev-runtime/server/local-api-server.mjs - WARNING: uncovered changed runtime JS file; advisory only
41+
(0%) src/dev-runtime/persistence/mock-db-store.js - WARNING: uncovered changed runtime JS file; advisory only
42+
(0%) src/dev-runtime/server/mock-api-router.mjs - WARNING: uncovered changed runtime JS file; advisory only
43+
(0%) toolbox/assets/assets-mock-repository.js - WARNING: uncovered changed runtime JS file; advisory only
44+
(0%) toolbox/colors/palette-workspace-repository.js - WARNING: uncovered changed runtime JS file; advisory only
45+
(0%) toolbox/project-journey/project-journey-mock-repository.js - WARNING: uncovered changed runtime JS file; advisory only
3046

3147
Changed JS files considered:
32-
(0%) scripts/start-local-api-server.mjs - changed JS file not collected as browser runtime coverage
33-
(0%) src/dev-runtime/server/local-api-server.mjs - changed JS file not collected as browser runtime coverage
48+
(0%) src/dev-runtime/persistence/mock-db-store.js - changed JS file not collected as browser runtime coverage
49+
(0%) src/dev-runtime/server/mock-api-router.mjs - changed JS file not collected as browser runtime coverage
50+
(0%) tests/dev-runtime/DbSeedIntegrity.test.mjs - changed JS file not collected as browser runtime coverage
51+
(0%) tests/playwright/tools/AdminDbViewer.spec.mjs - changed JS file not collected as browser runtime coverage
3452
(0%) tests/playwright/tools/LoginSessionMode.spec.mjs - changed JS file not collected as browser runtime coverage
3553
(0%) tests/playwright/tools/StaticOnlyLoginApiRequired.spec.mjs - changed JS file not collected as browser runtime coverage
36-
(61%) assets/theme-v2/js/login-session.js - changed JS file with browser V8 coverage
37-
(75%) assets/theme-v2/js/gamefoundry-partials.js - changed JS file with browser V8 coverage
54+
(0%) toolbox/assets/assets-mock-repository.js - changed JS file not collected as browser runtime coverage
55+
(0%) toolbox/colors/palette-workspace-repository.js - changed JS file not collected as browser runtime coverage
56+
(0%) toolbox/project-journey/project-journey-mock-repository.js - changed JS file not collected as browser runtime coverage
57+
(87%) src/engine/api/mock-db-viewer-ui.js - changed JS file with browser V8 coverage
58+
(89%) assets/theme-v2/js/login-session.js - changed JS file with browser V8 coverage

0 commit comments

Comments
 (0)