Skip to content

Commit e0f7468

Browse files
committed
Enforce dev-runtime boundaries and isolate mock seed test code - PR_26158_039-dev-runtime-boundary-enforcement
1 parent e524000 commit e0f7468

19 files changed

Lines changed: 475 additions & 193 deletions

docs_build/dev/reports/coverage_changed_js_guardrail.txt

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,24 @@ 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/persistence/mock-db-store.js - WARNING: changed runtime JS file was not collected by Playwright V8 coverage; advisory only
9+
(0%) src/dev-runtime/guest-seeds/palette-source-mock-db.js - WARNING: changed runtime JS file was not collected by Playwright V8 coverage; advisory only
10+
(0%) src/dev-runtime/guest-seeds/tool-state-samples.js - WARNING: changed runtime JS file was not collected by Playwright V8 coverage; advisory only
11+
(0%) src/dev-runtime/persistence/tool-repositories/assets-mock-repository.js - WARNING: changed runtime JS file was not collected by Playwright V8 coverage; advisory only
12+
(0%) src/dev-runtime/persistence/tool-repositories/game-configuration-mock-repository.js - WARNING: changed runtime JS file was not collected by Playwright V8 coverage; advisory only
13+
(0%) src/dev-runtime/persistence/tool-repositories/game-design-mock-repository.js - WARNING: changed runtime JS file was not collected by Playwright V8 coverage; advisory only
14+
(0%) src/dev-runtime/persistence/tool-repositories/palette-workspace-repository.js - WARNING: changed runtime JS file was not collected by Playwright V8 coverage; advisory only
15+
(0%) src/dev-runtime/persistence/tool-repositories/project-journey-mock-repository.js - WARNING: changed runtime JS file was not collected by Playwright V8 coverage; advisory only
16+
(0%) src/dev-runtime/persistence/tool-repositories/project-workspace-mock-repository.js - WARNING: changed runtime JS file was not collected by Playwright V8 coverage; advisory only
1017
(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-
(80%) src/engine/api/mock-db-api-client.js - executed lines 19/19; executed functions 4/5
15-
(87%) src/engine/api/mock-db-viewer-ui.js - executed lines 517/517; executed functions 85/98
18+
(60%) src/engine/api/mock-db-api-client.js - executed lines 19/19; executed functions 3/5
1619

1720
Guardrail warnings:
18-
(0%) src/dev-runtime/persistence/mock-db-store.js - WARNING: changed runtime JS file missing from coverage; advisory only
21+
(0%) src/dev-runtime/guest-seeds/palette-source-mock-db.js - WARNING: changed runtime JS file missing from coverage; advisory only
22+
(0%) src/dev-runtime/guest-seeds/tool-state-samples.js - WARNING: changed runtime JS file missing from coverage; advisory only
23+
(0%) src/dev-runtime/persistence/tool-repositories/assets-mock-repository.js - WARNING: changed runtime JS file missing from coverage; advisory only
24+
(0%) src/dev-runtime/persistence/tool-repositories/game-configuration-mock-repository.js - WARNING: changed runtime JS file missing from coverage; advisory only
25+
(0%) src/dev-runtime/persistence/tool-repositories/game-design-mock-repository.js - WARNING: changed runtime JS file missing from coverage; advisory only
26+
(0%) src/dev-runtime/persistence/tool-repositories/palette-workspace-repository.js - WARNING: changed runtime JS file missing from coverage; advisory only
27+
(0%) src/dev-runtime/persistence/tool-repositories/project-journey-mock-repository.js - WARNING: changed runtime JS file missing from coverage; advisory only
28+
(0%) src/dev-runtime/persistence/tool-repositories/project-workspace-mock-repository.js - WARNING: changed runtime JS file missing from coverage; advisory only
1929
(0%) src/dev-runtime/server/mock-api-router.mjs - WARNING: changed runtime JS file missing from coverage; advisory only
20-
(0%) toolbox/assets/assets-mock-repository.js - WARNING: changed runtime JS file missing from coverage; advisory only
21-
(0%) toolbox/colors/palette-workspace-repository.js - WARNING: changed runtime JS file missing from coverage; advisory only
22-
(0%) toolbox/project-journey/project-journey-mock-repository.js - WARNING: changed runtime JS file missing from coverage; advisory only
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
# Dev Runtime Audit
2+
3+
## Scope
4+
5+
PR_26158_039 audited active mock, seed, guest, fixture, demo, dev-only, and local-only runtime code that could be imported by browser/tool surfaces or packaged into non-local deployments.
6+
7+
The audit focused on:
8+
9+
- Active browser/tool roots: `account`, `admin`, `assets`, `toolbox`, `src/engine`, and `src/shared`
10+
- Dev-runtime persistence and seed ownership
11+
- Local Mem/Local DB seed and reseed paths
12+
- Mock repository file placement
13+
- UAT/PROD import boundary candidates
14+
15+
## Files Moved Into `src/dev-runtime`
16+
17+
| Previous Path | New Path | Status |
18+
| --- | --- | --- |
19+
| `toolbox/assets/assets-mock-repository.js` | `src/dev-runtime/persistence/tool-repositories/assets-mock-repository.js` | PASS |
20+
| `toolbox/colors/palette-workspace-repository.js` | `src/dev-runtime/persistence/tool-repositories/palette-workspace-repository.js` | PASS |
21+
| `toolbox/colors/palette-source-mock-db.js` | `src/dev-runtime/guest-seeds/palette-source-mock-db.js` | PASS |
22+
| `toolbox/game-configuration/game-configuration-mock-repository.js` | `src/dev-runtime/persistence/tool-repositories/game-configuration-mock-repository.js` | PASS |
23+
| `toolbox/game-design/game-design-mock-repository.js` | `src/dev-runtime/persistence/tool-repositories/game-design-mock-repository.js` | PASS |
24+
| `toolbox/project-journey/project-journey-mock-repository.js` | `src/dev-runtime/persistence/tool-repositories/project-journey-mock-repository.js` | PASS |
25+
| `toolbox/project-workspace/project-workspace-mock-repository.js` | `src/dev-runtime/persistence/tool-repositories/project-workspace-mock-repository.js` | PASS |
26+
27+
## New Dev-Runtime Seed Ownership
28+
29+
| Area | File | Status |
30+
| --- | --- | --- |
31+
| Palette source seed rows | `src/dev-runtime/guest-seeds/palette-source-mock-db.js` | PASS |
32+
| Local Mem guest/user tool-state sample seed rows | `src/dev-runtime/guest-seeds/tool-state-samples.js` | PASS |
33+
| Local Mem/Local DB persistence and reseed store | `src/dev-runtime/persistence/mock-db-store.js` | PRESERVED |
34+
| SQLite Local DB adapter | `src/dev-runtime/persistence/local-db-adapter.mjs` | PRESERVED |
35+
36+
## Import Boundary Results
37+
38+
| Check | Evidence | Result |
39+
| --- | --- | --- |
40+
| Active browser/tool roots do not import `src/dev-runtime`. | `rg` over `account admin assets toolbox src`, excluding `src/dev-runtime`, returned no matches. | PASS |
41+
| Active browser/tool roots do not import moved mock repositories. | `rg` for mock repository imports outside `src/dev-runtime` returned no matches. | PASS |
42+
| Server router imports moved repositories only through dev-runtime paths. | `src/dev-runtime/server/mock-api-router.mjs` imports from `../persistence/tool-repositories/*`. | PASS |
43+
| Tests may import dev-runtime repositories for direct validation. | Repository-focused Playwright specs import from `src/dev-runtime/persistence/tool-repositories/*`. | PASS |
44+
| Retired toolbox mock repository files are absent. | `tests/dev-runtime/DevRuntimeBoundary.test.mjs` asserts old toolbox paths do not exist. | PASS |
45+
| UAT/PROD candidate browser surfaces do not import dev-runtime. | `DevRuntimeBoundary.test.mjs` scans `account`, `admin`, `assets`, `src/engine`, `src/shared`, and `toolbox`. | PASS |
46+
47+
## Remaining Allowed Dev-Runtime Areas
48+
49+
| Path | Purpose | Audit Result |
50+
| --- | --- | --- |
51+
| `src/dev-runtime/auth/` | Local login/session implementation behind gateways. | ALLOWED |
52+
| `src/dev-runtime/persistence/` | Local Mem/Local DB persistence, mock repositories, SQLite adapter. | ALLOWED |
53+
| `src/dev-runtime/admin/` | Local admin DB Viewer implementation behind route shell. | ALLOWED |
54+
| `src/dev-runtime/testing/` | Dev-runtime test support. | ALLOWED |
55+
| `src/dev-runtime/guest-seeds/` | Guest and local seed data. | ALLOWED |
56+
| `src/dev-runtime/server/` | Local API server boundary. | ALLOWED as API boundary, not browser data ownership |
57+
58+
## Remaining Violations
59+
60+
None found.
61+
62+
## Notes
63+
64+
- The static audit intentionally excludes `archive/v1-v2`, `docs_build/dev`, and `tmp`.
65+
- Test files under `tests/**` import dev-runtime modules only for validation. They are not browser runtime code.
66+
- `docs_build/dev/reports/project-workspace-mock-repository.md` is historical/report documentation and is not runtime code.
67+
- Existing seed-only audit fallback diagnostics remain visible during validation. They are not new boundary violations and are still isolated under dev-runtime seed/bootstrap behavior.
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
# PR_26158_039 Dev Runtime Boundary Enforcement Report
2+
3+
## Summary
4+
5+
PR_26158_039 moves the remaining active mock repository and guest seed implementation out of `toolbox/**` and into `src/dev-runtime/**`, while preserving the Browser -> Server API -> Data Source boundary.
6+
7+
No active browser/tool surface now imports `src/dev-runtime`, mock repositories, or moved seed files directly. The local API server remains the only runtime bridge to the dev-only implementations.
8+
9+
## Implementation
10+
11+
| Change | Evidence | Status |
12+
| --- | --- | --- |
13+
| Moved Asset mock repository into dev-runtime persistence. | `src/dev-runtime/persistence/tool-repositories/assets-mock-repository.js`; `toolbox/assets/assets-mock-repository.js` deleted. | PASS |
14+
| Moved Palette mock repository into dev-runtime persistence. | `src/dev-runtime/persistence/tool-repositories/palette-workspace-repository.js`; `toolbox/colors/palette-workspace-repository.js` deleted. | PASS |
15+
| Moved Palette source seed rows into dev-runtime guest seeds. | `src/dev-runtime/guest-seeds/palette-source-mock-db.js`; `toolbox/colors/palette-source-mock-db.js` deleted. | PASS |
16+
| Moved Game Configuration mock repository into dev-runtime persistence. | `src/dev-runtime/persistence/tool-repositories/game-configuration-mock-repository.js`; old toolbox file deleted. | PASS |
17+
| Moved Game Design mock repository into dev-runtime persistence. | `src/dev-runtime/persistence/tool-repositories/game-design-mock-repository.js`; old toolbox file deleted. | PASS |
18+
| Moved Project Journey mock repository into dev-runtime persistence. | `src/dev-runtime/persistence/tool-repositories/project-journey-mock-repository.js`; old toolbox file deleted. | PASS |
19+
| Moved Project Workspace mock repository into dev-runtime persistence. | `src/dev-runtime/persistence/tool-repositories/project-workspace-mock-repository.js`; old toolbox file deleted. | PASS |
20+
| Moved Local Mem guest/user tool-state sample construction into dev-runtime guest seeds. | `src/dev-runtime/guest-seeds/tool-state-samples.js`; `src/dev-runtime/server/mock-api-router.mjs` calls `createServerSeedTables()`. | PASS |
21+
| Updated server router imports to dev-runtime repositories only. | `src/dev-runtime/server/mock-api-router.mjs` imports from `../persistence/tool-repositories/*` and `../guest-seeds/tool-state-samples.js`. | PASS |
22+
| Updated repository-focused tests to import dev-runtime repositories. | `tests/playwright/tools/*MockRepository.spec.mjs`; `tests/playwright/tools/AdminDbViewer.spec.mjs`; `tests/playwright/tools/ProjectJourneyTool.spec.mjs`. | PASS |
23+
| Added explicit boundary validation. | `tests/dev-runtime/DevRuntimeBoundary.test.mjs`. | PASS |
24+
25+
## Requirement Checklist
26+
27+
| Requirement | Evidence | Result |
28+
| --- | --- | --- |
29+
| Read `docs_build/dev/PROJECT_INSTRUCTIONS.md` first. | Read before implementation. | PASS |
30+
| Audit mock, seed, test, guest, demo, fixture, dev-only, and local-only runtime code. | Static searches plus `DevRuntimeBoundary.test.mjs`; see `dev-runtime-audit.md`. | PASS |
31+
| Move remaining dev-only implementation into approved `src/dev-runtime` areas. | Mock repositories moved to `src/dev-runtime/persistence/tool-repositories`; seed data moved to `src/dev-runtime/guest-seeds`. | PASS |
32+
| Verify UAT/PROD bundles do not import/package `src/dev-runtime`. | Static audit over active browser/UAT/PROD candidate roots returned no matches. | PASS |
33+
| Verify active tools consume runtime contracts only and do not import dev-runtime directly. | `rg` audit over `account`, `admin`, `assets`, `toolbox`, and active `src` surfaces returned no matches. | PASS |
34+
| Verify Local Mem, guest seeds, test fixtures, and reseed behavior originate from `src/dev-runtime`. | Server seed creation now lives in `src/dev-runtime/guest-seeds/tool-state-samples.js`; reseed validation passed. | PASS |
35+
| Preserve SQLite-backed Local DB behind API boundary. | AdminDbViewer Local DB readonly lane passed. | PASS |
36+
| Preserve independent Local Mem and Local DB reseed behavior. | `DbSeedIntegrity` and LoginSessionMode Playwright passed. | PASS |
37+
| Update reports with remaining violations. | This report and `dev-runtime-audit.md` list findings. | PASS |
38+
| Do not add UAT/Prod adapter behavior. | No UAT/Prod adapter files changed. | PASS |
39+
| Do not modify `start_of_day` folders. | No `start_of_day` files changed. | PASS |
40+
41+
## Validation
42+
43+
| Validation | Result |
44+
| --- | --- |
45+
| Changed-file syntax checks | PASS |
46+
| `node --test tests/dev-runtime/DevRuntimeBoundary.test.mjs` | PASS, 3/3 |
47+
| `node --test tests/dev-runtime/DbSeedIntegrity.test.mjs` | PASS, 2/2 |
48+
| `npx playwright test tests/playwright/tools/LoginSessionMode.spec.mjs` | PASS, 6/6 |
49+
| `npx playwright test tests/playwright/tools/AdminDbViewer.spec.mjs` | PASS, 7/7 |
50+
| `npx playwright test tests/playwright/tools/PaletteToolMockRepository.spec.mjs` | PASS, 4/4 |
51+
| `npx playwright test tests/playwright/tools/AssetToolMockRepository.spec.mjs` | PASS, 6/6 |
52+
| `npx playwright test tests/playwright/tools/ProjectJourneyTool.spec.mjs` | PASS, 13/13 |
53+
| Static import boundary audit | PASS |
54+
| `git diff --check` | PASS, line-ending warnings only |
55+
56+
## Remaining Violations
57+
58+
None found in active browser/tool surfaces.
59+
60+
`src/dev-runtime/server/` remains as the local API server boundary created by prior migration work. It is not mock data ownership; it imports the dev-runtime persistence and guest seed modules and exposes them through API routes.
61+
62+
## Notes
63+
64+
- V8 coverage is advisory for this PR because the moved modules are server/dev-runtime JavaScript and are not directly collected by browser V8 coverage.
65+
- Existing seed-only audit fallback diagnostics still appear during some Local Mem/Local DB initialization tests. They are existing seed diagnostics and did not cause validation failures.

0 commit comments

Comments
 (0)