|
| 1 | +# PR_26160_071 Tool Planning DB Ownership Report |
| 2 | + |
| 3 | +## Branch Validation |
| 4 | + |
| 5 | +| Check | Expected | Actual | Status | |
| 6 | +| --- | --- | --- | --- | |
| 7 | +| Current git branch | `main` | `main` | PASS | |
| 8 | + |
| 9 | +## Ownership Summary |
| 10 | + |
| 11 | +| Data Area | DB Table / Contract | Owned Fields | |
| 12 | +| --- | --- | --- | |
| 13 | +| Tool Metadata | `toolbox_tool_metadata` via `/api/toolbox/registry/snapshot` and `/api/toolbox/votes/snapshot` | Identity, display, routing, grouping, state, and order: `toolKey`, `toolName`, labels/descriptions, `group`, `category`, `colorGroup`, `toolboxGroup`, `path`, `order`, `status`, images, visibility/access fields. | |
| 14 | +| Tool Planning | `toolbox_tool_planning`, merged into `/api/toolbox/registry/snapshot` | Readiness/dependency/checklist data: `readiness`, `requiredForPlayable`, `requiredForTestable`, `requiredForPublish`, `requires`, `progressChecklist`. | |
| 15 | +| Tool Voting | `toolbox_votes` via `/api/toolbox/votes/snapshot` | Vote totals and current-user vote state: `toolId`, `userKey`, `direction`, computed up/down/total/percent/current vote. | |
| 16 | + |
| 17 | +## Implementation Notes |
| 18 | + |
| 19 | +- Added DB-backed `toolbox_tool_planning` schema in `src/dev-runtime/persistence/mock-db-store.js`. |
| 20 | +- Seeded one planning row per active tool in `src/dev-runtime/guest-seeds/tool-state-samples.js`. |
| 21 | +- Removed planning fields from `toolbox_tool_metadata` schema and seed rows. |
| 22 | +- Updated `src/dev-runtime/server/mock-api-router.mjs` to: |
| 23 | + - populate/sync planning rows from the dev inventory; |
| 24 | + - migrate old planning values out of existing metadata rows when present; |
| 25 | + - strip planning fields from active metadata rows after planning rows are populated; |
| 26 | + - merge planning rows into the existing registry snapshot API so Toolbox behavior remains unchanged. |
| 27 | +- Kept Admin Tool Votes unchanged for users: order/group/path/status/votes still come from metadata/vote contracts. |
| 28 | + |
| 29 | +## API / DB Probe Evidence |
| 30 | + |
| 31 | +```json |
| 32 | +{ |
| 33 | + "activeTools": 43, |
| 34 | + "voteRows": 43, |
| 35 | + "metadataRows": 43, |
| 36 | + "planningRows": 43, |
| 37 | + "metadataHasPlanning": false, |
| 38 | + "planningSchemaHasFields": true, |
| 39 | + "metadataSchemaHasPlanning": false, |
| 40 | + "colorsPlanningSource": "toolbox_tool_planning", |
| 41 | + "colorsRequiredForPublish": true, |
| 42 | + "hasMidi": true, |
| 43 | + "hasMusic": true, |
| 44 | + "platformToolboxGroup": "Admin" |
| 45 | +} |
| 46 | +``` |
| 47 | + |
| 48 | +## Requirement Checklist |
| 49 | + |
| 50 | +| Requirement | Status | Evidence | |
| 51 | +| --- | --- | --- | |
| 52 | +| Create DB-backed Tool Planning ownership for `requiredForTestable`. | PASS | `toolbox_tool_planning` schema/seed/API merge owns `requiredForTestable`; Playwright asserts registry values merge from planning. | |
| 53 | +| Create DB-backed Tool Planning ownership for `requiredForPublish`. | PASS | `toolbox_tool_planning` schema/seed/API merge owns `requiredForPublish`; Colors registry snapshot still exposes `requiredForPublish: true`. | |
| 54 | +| Create DB-backed Tool Planning ownership for `requires`. | PASS | `toolbox_tool_planning` schema/seed/API merge owns `requires`; registry snapshot keeps an array for existing UI behavior. | |
| 55 | +| Create DB-backed Tool Planning ownership for `progressChecklist`. | PASS | `toolbox_tool_planning` schema/seed/API merge owns `progressChecklist`; registry snapshot keeps an array for existing UI behavior. | |
| 56 | +| Keep Tool Metadata limited to identity, display, routing, grouping, state, and order. | PASS | `toolbox_tool_metadata` schema no longer includes planning fields; API probe reports `metadataHasPlanning: false`. | |
| 57 | +| Add/update API service contract so Tool Planning data is read through Web UI -> API/Service Contract -> DB Adapter. | PASS | Existing `/api/toolbox/registry/snapshot` now merges DB-backed `toolbox_tool_planning` rows into tool records consumed by Toolbox. | |
| 58 | +| Remove planning fields from active Tool Metadata rows after Tool Planning is populated. | PASS | Server sync migrates planning fields first and then strips `progressChecklist`, `readiness`, `requiredForPlayable`, `requiredForPublish`, `requiredForTestable`, and `requires` from metadata rows. | |
| 59 | +| Keep Toolbox and Admin Tool Votes behavior unchanged. | PASS | Targeted Playwright lanes passed; Admin edits still update Toolbox after reload. | |
| 60 | +| Do not use page-local arrays, hardcoded counts, or duplicated planning metadata. | PASS | Planning ownership is DB-backed; Toolbox still reads through API clients. Existing UI constants are display maps, not duplicated planning records. | |
| 61 | +| Preserve 43-tool inventory, MIDI/Music separation, and Platform Settings Admin placement. | PASS | API probe confirms 43/43 rows, `hasMidi: true`, `hasMusic: true`, and `platformToolboxGroup: "Admin"`. | |
| 62 | +| No inline script/style/event handlers. | PASS | No HTML was changed; JS remains external. | |
| 63 | + |
| 64 | +## Validation |
| 65 | + |
| 66 | +| Lane | Command | Result | |
| 67 | +| --- | --- | --- | |
| 68 | +| Changed-file syntax | `node --check` on changed JS/MJS files | PASS | |
| 69 | +| Static diff whitespace | `git diff --check` | PASS | |
| 70 | +| DB adapter/API probe | Node probe against `/api/toolbox/registry/snapshot`, `/api/toolbox/votes/snapshot`, and `/api/mock-db/snapshot` | PASS | |
| 71 | +| Admin Tool Votes / Toolbox SSoT Playwright | `npx playwright test tests/playwright/tools/ToolboxAdminMetadataSsot.spec.mjs --reporter=line` | PASS: 4/4 | |
| 72 | +| Toolbox route/Admin menu Playwright | `npx playwright test tests/playwright/tools/ToolboxRoutePages.spec.mjs --reporter=line` | PASS: 8/8 on rerun | |
| 73 | + |
| 74 | +Validation note: the first `ToolboxRoutePages.spec.mjs` attempt encountered Playwright artifact zip `ENOENT` errors under `tmp/test-results` while writing trace artifacts. The clean rerun passed 8/8 without product-code changes. |
| 75 | + |
| 76 | +## Impacted Lane |
| 77 | + |
| 78 | +DB adapter/API, Toolbox, and Admin Tool Votes. |
| 79 | + |
| 80 | +## Skipped Lanes |
| 81 | + |
| 82 | +| Lane | Reason | |
| 83 | +| --- | --- | |
| 84 | +| Full samples validation | Safe to skip per request; this PR did not touch samples or shared sample loader/framework code. | |
| 85 | +| Unrelated tool runtime lanes | Safe to skip; Toolbox consumes the same registry snapshot shape and targeted Toolbox/Admin validation passed. | |
| 86 | + |
| 87 | +## Manual Test Notes |
| 88 | + |
| 89 | +- Confirmed current branch was `main` before changes. |
| 90 | +- Confirmed Tool Metadata rows no longer carry planning fields after registry snapshot sync. |
| 91 | +- Confirmed Tool Planning rows preserve the planning fields and are merged into the Toolbox registry snapshot. |
| 92 | +- Confirmed Admin Tool Votes still shows the 43 DB-backed tools and metadata edits still flow to Toolbox. |
0 commit comments