Skip to content

Commit 773a579

Browse files
committed
Persist Objects rows through shared DB adapter - PR_26161_011-objects-db-persistence-fix
1 parent 11d0138 commit 773a579

11 files changed

Lines changed: 1309 additions & 386 deletions

File tree

Lines changed: 24 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,24 @@
1-
docs_build/dev/codex_commands.md
2-
docs_build/dev/commit_comment.txt
3-
docs_build/dev/reports/codex_changed_files.txt
4-
docs_build/dev/reports/codex_review.diff
5-
docs_build/dev/reports/coverage_changed_js_guardrail.txt
6-
docs_build/dev/reports/objects-asset-return-display-report.md
7-
docs_build/dev/reports/playwright_v8_coverage_report.txt
8-
tests/playwright/tools/ObjectsTool.spec.mjs
9-
toolbox/objects/objects.js
1+
# git status --short
2+
M docs_build/dev/reports/coverage_changed_js_guardrail.txt
3+
M docs_build/dev/reports/playwright_v8_coverage_report.txt
4+
M src/dev-runtime/persistence/mock-db-store.js
5+
M src/dev-runtime/server/mock-api-router.mjs
6+
M tests/playwright/tools/ObjectsTool.spec.mjs
7+
M toolbox/objects/objects.js
8+
?? docs_build/dev/reports/objects-db-persistence-fix-report.md
9+
?? src/dev-runtime/persistence/tool-repositories/objects-mock-repository.js
10+
?? toolbox/objects/objects-api-client.js
11+
12+
# git ls-files --others --exclude-standard
13+
docs_build/dev/reports/objects-db-persistence-fix-report.md
14+
src/dev-runtime/persistence/tool-repositories/objects-mock-repository.js
15+
toolbox/objects/objects-api-client.js
16+
17+
# git diff --stat
18+
.../dev/reports/coverage_changed_js_guardrail.txt | 10 +-
19+
.../dev/reports/playwright_v8_coverage_report.txt | 19 +++-
20+
src/dev-runtime/persistence/mock-db-store.js | 5 +
21+
src/dev-runtime/server/mock-api-router.mjs | 20 +++-
22+
tests/playwright/tools/ObjectsTool.spec.mjs | 95 ++++++++++++++++++
23+
toolbox/objects/objects.js | 109 +++++++++++++++++++--
24+
6 files changed, 241 insertions(+), 17 deletions(-)

docs_build/dev/reports/codex_review.diff

Lines changed: 713 additions & 360 deletions
Large diffs are not rendered by default.

docs_build/dev/reports/coverage_changed_js_guardrail.txt

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,13 @@ 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-
(94%) toolbox/objects/objects.js - executed lines 1065/1065; executed functions 100/106
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/persistence/tool-repositories/objects-mock-repository.js - WARNING: changed runtime JS file was not collected by Playwright V8 coverage; advisory only
11+
(0%) src/dev-runtime/server/mock-api-router.mjs - WARNING: changed runtime JS file was not collected by Playwright V8 coverage; advisory only
12+
(94%) toolbox/objects/objects.js - executed lines 1150/1150; executed functions 103/109
13+
(100%) toolbox/objects/objects-api-client.js - executed lines 10/10; executed functions 2/2
1014

1115
Guardrail warnings:
12-
(100%) none - no changed runtime JS coverage warnings
16+
(0%) src/dev-runtime/persistence/mock-db-store.js - WARNING: changed runtime JS file missing from coverage; advisory only
17+
(0%) src/dev-runtime/persistence/tool-repositories/objects-mock-repository.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
Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
# PR_26161_011 Objects DB Persistence Fix Report
2+
3+
## Branch Guard
4+
- Current branch: `main`
5+
- Expected branch: `main`
6+
- Local branches found: `* main`
7+
- Branch validation: PASS
8+
9+
## Source Of Truth
10+
- PASS: Read `docs_build/dev/PROJECT_INSTRUCTIONS.md` before edits.
11+
- PASS: Used the user-provided `PR_26161_011-objects-db-persistence-fix` request as the active BUILD source.
12+
- PASS: Continued from `PR_26161_010`.
13+
- PASS: Kept the PR purpose singular: persist Objects table rows through the shared DB/mock adapter.
14+
15+
## Requirement Checklist
16+
- PASS: Added/edited/deleted object rows persist through the shared Objects repository exposed by the shared server API/mock adapter.
17+
- PASS: Object definitions are no longer stored only in page-local memory; the page uses `draftedObjects` as a render cache loaded from and saved to the shared adapter.
18+
- PASS: Page load reads existing object records from the shared adapter.
19+
- PASS: Add/Edit/Delete/Reset writes the updated object record list to the shared adapter.
20+
- PASS: Sprite render asset links persist with each object record through `renderAssetKey` and `renderPreviewPath`.
21+
- PASS: Returning to or reloading the Objects page shows previously saved rows.
22+
- PASS: Asset remains linked render-record display data, not an invalid free-text user field.
23+
- PASS: `State` remains visible in the Objects table.
24+
- PASS: Preserved Object Type Catalog compact display with `Template` and `Capability` only.
25+
- PASS: Preserved table-first input, `Add Object` below the table, Add disabled while adding, Cancel, Edit, Trash, Reset Table, Object Status, and Sprite asset linking.
26+
- PASS: Did not add sample JSON alignment, auth behavior, production DB behavior, or unrelated tool rewrites.
27+
- PASS: Kept Theme V2 only and preserved HTML restrictions.
28+
- PASS: No runtime engine behavior changed.
29+
30+
## Implementation Evidence
31+
- `src/dev-runtime/persistence/tool-repositories/objects-mock-repository.js`: added an Objects repository with `listObjects`, `replaceObjects`, `resetObjects`, `getTables`, and `getSnapshot`.
32+
- `src/dev-runtime/persistence/mock-db-store.js`: added the Objects table group and `object_definition_records` schema.
33+
- `src/dev-runtime/server/mock-api-router.mjs`: exposed the Objects repository and table snapshot through the existing toolbox server API.
34+
- `toolbox/objects/objects-api-client.js`: added the Objects API client for the browser tool.
35+
- `toolbox/objects/objects.js`: loads Objects rows from the repository on page load and persists rows after Add/Edit/Delete/Reset while preserving linked sprite asset display.
36+
- `tests/playwright/tools/ObjectsTool.spec.mjs`: added reload persistence checks for add, edit, delete, and sprite asset links.
37+
38+
## Impacted Lane
39+
- Impacted lane: Objects tool UI/runtime plus shared mock DB adapter contract for the Objects table.
40+
- Playwright impacted: Yes.
41+
- Changed runtime JavaScript: `toolbox/objects/objects.js`, `toolbox/objects/objects-api-client.js`, `src/dev-runtime/server/mock-api-router.mjs`, `src/dev-runtime/persistence/mock-db-store.js`, `src/dev-runtime/persistence/tool-repositories/objects-mock-repository.js`.
42+
43+
## Testing Performed
44+
- PASS: `node --check src/dev-runtime/persistence/tool-repositories/objects-mock-repository.js`
45+
- PASS: `node --check toolbox/objects/objects-api-client.js`
46+
- PASS: `node --check toolbox/objects/objects.js`
47+
- PASS: `node --check tests/playwright/tools/ObjectsTool.spec.mjs`
48+
- PASS: `node --check src/dev-runtime/server/mock-api-router.mjs`
49+
- PASS: `node --check src/dev-runtime/persistence/mock-db-store.js`
50+
- PASS: HTML restriction check for `toolbox/objects/index.html` returned no inline script/style/event handler matches.
51+
- PASS: Objects forbidden wording scan returned no matches in `toolbox/objects/index.html` or `toolbox/objects/objects.js`.
52+
- PASS: `npx playwright test tests/playwright/tools/ObjectsTool.spec.mjs --workers=1 --reporter=line` (6 passed).
53+
- PASS: `git diff --check` exited 0 with line-ending warnings only.
54+
- PASS: `docs_build/dev/reports/playwright_v8_coverage_report.txt` was produced by targeted Objects Playwright.
55+
56+
## Playwright Behavior Coverage
57+
- PASS: Add row persists to `object_definition_records` and remains visible after page reload.
58+
- PASS: Edit row persists to `object_definition_records` and remains visible after page reload.
59+
- PASS: Delete row removes the shared DB record and remains removed after page reload.
60+
- PASS: Sprite render creates/resolves a linked shared asset and persists its key on the object record.
61+
- PASS: Reloading Objects restores the linked sprite asset display and `Edit Sprite` action.
62+
- PASS: Existing Objects UI checks still cover Type/Capabilities wording, compact catalog, table-first editing, Object Status actions, and Sprite linking.
63+
64+
## Skipped Lanes
65+
- `npm run test:workspace-v2`: SKIP. The script maps to the legacy workspace-contract lane and does not cover Objects tool UI/runtime behavior.
66+
- Full samples validation: SKIP. Safe because no sample JSON, sample launch path, or sample runtime behavior changed.
67+
- Engine runtime validation beyond changed-file syntax/import checks: SKIP. Safe because no engine runtime behavior changed.
68+
- Production DB/auth validation: SKIP. Safe because the change is limited to the shared dev mock adapter and Objects tool.
69+
- Broad Toolbox/Admin validation: SKIP. Safe because navigation, registration, auth, admin surfaces, and sample paths were not changed.
70+
71+
## Manual Validation Steps
72+
- Open `/toolbox/objects/index.html`.
73+
- Add a non-Sprite object, reload the page, and confirm the row remains.
74+
- Edit the saved row, reload the page, and confirm the edited name/state remain.
75+
- Delete the row, reload the page, and confirm the table is empty.
76+
- Add a Sprite object, save it, reload the page, and confirm the Render Asset display and `Edit Sprite` link still point to the linked sprite asset.
77+
- Click `Reset Table`, reload the page, and confirm the shared object records remain cleared.
78+
- Confirm Object Type Catalog still shows only `Template` and `Capability`, and the Objects table still shows `State`.
79+
80+
## Required Artifacts
81+
- PASS: `docs_build/dev/reports/objects-db-persistence-fix-report.md`
82+
- PASS: `docs_build/dev/reports/codex_review.diff`
83+
- PASS: `docs_build/dev/reports/codex_changed_files.txt`
84+
- PASS: `docs_build/dev/reports/playwright_v8_coverage_report.txt`
85+
- PASS: `tmp/PR_26161_011-objects-db-persistence-fix_delta.zip`

docs_build/dev/reports/playwright_v8_coverage_report.txt

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,16 @@ 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-
(86%) Toolbox Index - exercised 5 runtime JS files
15+
(86%) Toolbox Index - exercised 6 runtime JS files
1616
(0%) Tool Template V2 - not exercised by this Playwright run
1717
(59%) Theme V2 Shared JS - exercised 2 runtime JS files
1818

1919
Changed runtime JS files covered:
20-
(94%) toolbox/objects/objects.js - executed lines 1065/1065; executed functions 100/106
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/persistence/tool-repositories/objects-mock-repository.js - WARNING: changed runtime JS file was not collected by Playwright V8 coverage; advisory only
22+
(0%) src/dev-runtime/server/mock-api-router.mjs - WARNING: changed runtime JS file was not collected by Playwright V8 coverage; advisory only
23+
(94%) toolbox/objects/objects.js - executed lines 1150/1150; executed functions 103/109
24+
(100%) toolbox/objects/objects-api-client.js - executed lines 10/10; executed functions 2/2
2125

2226
Files with executed line/function counts where available:
2327
(33%) src/engine/api/toolbox-votes-api-client.js - executed lines 46/46; executed functions 2/6
@@ -31,13 +35,20 @@ Files with executed line/function counts where available:
3135
(75%) src/engine/object-model/objectDefinitionSchema.js - executed lines 58/58; executed functions 3/4
3236
(77%) toolbox/tools-page-accordions.js - executed lines 965/965; executed functions 79/103
3337
(86%) toolbox/tool-registry-api-client.js - executed lines 152/152; executed functions 24/28
34-
(94%) toolbox/objects/objects.js - executed lines 1065/1065; executed functions 100/106
38+
(94%) toolbox/objects/objects.js - executed lines 1150/1150; executed functions 103/109
3539
(100%) src/engine/object-model/index.js - executed lines 29/29; executed functions 1/1
40+
(100%) toolbox/objects/objects-api-client.js - executed lines 10/10; executed functions 2/2
3641
(100%) toolbox/project-workspace/project-workspace-api-client.js - executed lines 12/12; executed functions 2/2
3742

3843
Uncovered or low-coverage changed JS files:
39-
(100%) none - no low-coverage changed runtime JS files
44+
(0%) src/dev-runtime/persistence/mock-db-store.js - WARNING: uncovered changed runtime JS file; advisory only
45+
(0%) src/dev-runtime/persistence/tool-repositories/objects-mock-repository.js - WARNING: uncovered changed runtime JS file; advisory only
46+
(0%) src/dev-runtime/server/mock-api-router.mjs - WARNING: uncovered changed runtime JS file; advisory only
4047

4148
Changed JS files considered:
49+
(0%) src/dev-runtime/persistence/mock-db-store.js - changed JS file not collected as browser runtime coverage
50+
(0%) src/dev-runtime/persistence/tool-repositories/objects-mock-repository.js - changed JS file not collected as browser runtime coverage
51+
(0%) src/dev-runtime/server/mock-api-router.mjs - changed JS file not collected as browser runtime coverage
4252
(0%) tests/playwright/tools/ObjectsTool.spec.mjs - changed JS file not collected as browser runtime coverage
4353
(94%) toolbox/objects/objects.js - changed JS file with browser V8 coverage
54+
(100%) toolbox/objects/objects-api-client.js - changed JS file with browser V8 coverage

src/dev-runtime/persistence/mock-db-store.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,10 @@ export const MOCK_DB_TOOL_GROUPS = Object.freeze({
8383
label: "Game Configuration",
8484
tableNames: Object.freeze(["game_configuration_records", "game_configuration_validation_items"]),
8585
}),
86+
objects: Object.freeze({
87+
label: "Objects",
88+
tableNames: Object.freeze(["object_definition_records"]),
89+
}),
8690
"project-journey": Object.freeze({
8791
label: "Project Journey",
8892
tableNames: Object.freeze([
@@ -127,6 +131,7 @@ const MOCK_DB_TABLE_SCHEMAS = Object.freeze({
127131
game_design_validation_items: Object.freeze(["key", "projectKey", "label", "status", "action", "createdAt", "updatedAt", "createdBy", "updatedBy"]),
128132
game_configuration_records: Object.freeze(["key", "projectKey", "status", "summary", "createdAt", "updatedAt", "createdBy", "updatedBy"]),
129133
game_configuration_validation_items: Object.freeze(["key", "projectKey", "label", "status", "action", "createdAt", "updatedAt", "createdBy", "updatedBy"]),
134+
object_definition_records: Object.freeze(["key", "id", "projectId", "name", "type", "state", "modelType", "renderType", "renderAssetKey", "renderPreviewPath", "capabilities", "behavior", "interaction", "recordOrder", "createdAt", "updatedAt", "createdBy", "updatedBy"]),
130135
project_journey_note_types: Object.freeze(["key", "typeSlug", "name", "seeded", "userExtensible", "createdAt", "updatedAt", "createdBy", "updatedBy"]),
131136
project_journey_notes: Object.freeze(["key", "slug", "projectKey", "ownerKey", "name", "typeKey", "createdAt", "updatedAt", "createdBy", "updatedBy"]),
132137
project_journey_templates: Object.freeze(["key", "templateSlug", "originalMeaning", "systemGuidance", "linkedToolContexts", "version", "isActive", "createdAt", "updatedAt", "createdBy", "updatedBy"]),

0 commit comments

Comments
 (0)