|
| 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` |
0 commit comments