Skip to content

Commit 2ead081

Browse files
committed
Move tool planning fields to DB-backed planning ownership - PR_26160_071-tool-planning-db-ownership
1 parent d03149c commit 2ead081

7 files changed

Lines changed: 243 additions & 42 deletions

File tree

docs_build/dev/reports/coverage_changed_js_guardrail.txt

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,11 @@ 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/guest-seeds/tool-metadata-inventory.js - WARNING: changed runtime JS file was not collected by Playwright V8 coverage; advisory only
109
(0%) src/dev-runtime/guest-seeds/tool-state-samples.js - WARNING: changed runtime JS file was not collected by Playwright V8 coverage; advisory only
1110
(0%) src/dev-runtime/persistence/mock-db-store.js - WARNING: changed runtime JS file was not collected by Playwright V8 coverage; advisory only
1211
(0%) src/dev-runtime/server/mock-api-router.mjs - WARNING: changed runtime JS file was not collected by Playwright V8 coverage; advisory only
13-
(0%) src/shared/toolbox/platformShell.js - WARNING: changed runtime JS file was not collected by Playwright V8 coverage; advisory only
14-
(0%) toolbox/toolRegistry.js - WARNING: changed runtime JS file was not collected by Playwright V8 coverage; advisory only
15-
(92%) admin/tool-votes.js - executed lines 383/383; executed functions 46/50
1612

1713
Guardrail warnings:
18-
(0%) src/dev-runtime/guest-seeds/tool-metadata-inventory.js - WARNING: changed runtime JS file missing from coverage; advisory only
1914
(0%) src/dev-runtime/guest-seeds/tool-state-samples.js - WARNING: changed runtime JS file missing from coverage; advisory only
2015
(0%) src/dev-runtime/persistence/mock-db-store.js - WARNING: changed runtime JS file missing from coverage; advisory only
2116
(0%) src/dev-runtime/server/mock-api-router.mjs - WARNING: changed runtime JS file missing from coverage; advisory only
22-
(0%) src/shared/toolbox/platformShell.js - WARNING: changed runtime JS file missing from coverage; advisory only
23-
(0%) toolbox/toolRegistry.js - WARNING: changed runtime JS file missing from coverage; advisory only

docs_build/dev/reports/playwright_v8_coverage_report.txt

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,9 @@ Exercised tool entry points detected:
1717
(74%) Theme V2 Shared JS - exercised 2 runtime JS files
1818

1919
Changed runtime JS files covered:
20-
(0%) src/dev-runtime/guest-seeds/tool-metadata-inventory.js - WARNING: changed runtime JS file was not collected by Playwright V8 coverage; advisory only
2120
(0%) src/dev-runtime/guest-seeds/tool-state-samples.js - WARNING: changed runtime JS file was not collected by Playwright V8 coverage; advisory only
2221
(0%) src/dev-runtime/persistence/mock-db-store.js - WARNING: changed runtime JS file was not collected by Playwright V8 coverage; advisory only
2322
(0%) src/dev-runtime/server/mock-api-router.mjs - WARNING: changed runtime JS file was not collected by Playwright V8 coverage; advisory only
24-
(0%) src/shared/toolbox/platformShell.js - WARNING: changed runtime JS file was not collected by Playwright V8 coverage; advisory only
25-
(0%) toolbox/toolRegistry.js - WARNING: changed runtime JS file was not collected by Playwright V8 coverage; advisory only
26-
(92%) admin/tool-votes.js - executed lines 383/383; executed functions 46/50
2723

2824
Files with executed line/function counts where available:
2925
(38%) src/engine/api/session-api-client.js - executed lines 34/34; executed functions 3/8
@@ -43,21 +39,12 @@ Files with executed line/function counts where available:
4339
(100%) toolbox/project-workspace/project-workspace-api-client.js - executed lines 12/12; executed functions 2/2
4440

4541
Uncovered or low-coverage changed JS files:
46-
(0%) src/dev-runtime/guest-seeds/tool-metadata-inventory.js - WARNING: uncovered changed runtime JS file; advisory only
4742
(0%) src/dev-runtime/guest-seeds/tool-state-samples.js - WARNING: uncovered changed runtime JS file; advisory only
4843
(0%) src/dev-runtime/persistence/mock-db-store.js - WARNING: uncovered changed runtime JS file; advisory only
4944
(0%) src/dev-runtime/server/mock-api-router.mjs - WARNING: uncovered changed runtime JS file; advisory only
50-
(0%) src/shared/toolbox/platformShell.js - WARNING: uncovered changed runtime JS file; advisory only
51-
(0%) toolbox/toolRegistry.js - WARNING: uncovered changed runtime JS file; advisory only
5245

5346
Changed JS files considered:
54-
(0%) src/dev-runtime/guest-seeds/tool-metadata-inventory.js - changed JS file not collected as browser runtime coverage
5547
(0%) src/dev-runtime/guest-seeds/tool-state-samples.js - changed JS file not collected as browser runtime coverage
5648
(0%) src/dev-runtime/persistence/mock-db-store.js - changed JS file not collected as browser runtime coverage
5749
(0%) src/dev-runtime/server/mock-api-router.mjs - changed JS file not collected as browser runtime coverage
58-
(0%) src/shared/toolbox/platformShell.js - changed JS file not collected as browser runtime coverage
59-
(0%) tests/playwright/tools/BuildPathProgressSimplification.spec.mjs - changed JS file not collected as browser runtime coverage
6050
(0%) tests/playwright/tools/ToolboxAdminMetadataSsot.spec.mjs - changed JS file not collected as browser runtime coverage
61-
(0%) tests/playwright/tools/ToolboxRoutePages.spec.mjs - changed JS file not collected as browser runtime coverage
62-
(0%) toolbox/toolRegistry.js - changed JS file not collected as browser runtime coverage
63-
(92%) admin/tool-votes.js - changed JS file with browser V8 coverage
Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
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.

src/dev-runtime/guest-seeds/tool-state-samples.js

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -132,12 +132,6 @@ function toolboxToolMetadataRows() {
132132
capabilityLabel: tool.capabilityLabel || "",
133133
childCapabilities: Array.isArray(tool.childCapabilities) ? [...tool.childCapabilities] : [],
134134
requiredRole: typeof tool.requiredRole === "string" ? tool.requiredRole : "",
135-
requires: Array.isArray(tool.requires) ? [...tool.requires] : [],
136-
requiredForPlayable: tool.requiredForPlayable === true,
137-
requiredForTestable: tool.requiredForTestable === true,
138-
requiredForPublish: tool.requiredForPublish === true,
139-
progressChecklist: Array.isArray(tool.progressChecklist) ? [...tool.progressChecklist] : [],
140-
readiness: tool.readiness || "",
141135
statusDiagnostic: tool.statusDiagnostic || "",
142136
toolId: toolKey,
143137
releaseChannel,
@@ -147,9 +141,28 @@ function toolboxToolMetadataRows() {
147141
});
148142
}
149143

144+
function toolboxToolPlanningRows() {
145+
return getActiveToolRegistry()
146+
.map((tool, index) => {
147+
const toolKey = tool.id;
148+
return {
149+
key: serverSeedUlid(8_801 + index),
150+
toolKey,
151+
readiness: tool.readiness || "",
152+
requiredForPlayable: tool.requiredForPlayable === true,
153+
requiredForTestable: tool.requiredForTestable === true,
154+
requiredForPublish: tool.requiredForPublish === true,
155+
requires: Array.isArray(tool.requires) ? [...tool.requires] : [],
156+
progressChecklist: Array.isArray(tool.progressChecklist) ? [...tool.progressChecklist] : [],
157+
...serverSeedAuditFields(90 + index, MOCK_DB_KEYS.users.forgeBot),
158+
};
159+
});
160+
}
161+
150162
export function createServerSeedTables() {
151163
const tables = getStandaloneMockDbSeedTables();
152164
tables.toolbox_tool_metadata = toolboxToolMetadataRows();
165+
tables.toolbox_tool_planning = toolboxToolPlanningRows();
153166
tables.toolbox_votes = [];
154167
tables.tool_state_samples = [
155168
...guestToolStateSampleRows(),

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,8 @@ const MOCK_DB_TABLE_SCHEMAS = Object.freeze({
118118
users: Object.freeze(["key", "displayName", "email", "authProvider", "authProviderUserId", "isActive", "createdAt", "updatedAt", "createdBy", "updatedBy"]),
119119
roles: Object.freeze(["key", "roleSlug", "name", "description", "isSystemRole", "isActive", "createdAt", "updatedAt", "createdBy", "updatedBy"]),
120120
user_roles: Object.freeze(["key", "userKey", "roleKey", "createdAt", "updatedAt", "createdBy", "updatedBy"]),
121-
toolbox_tool_metadata: Object.freeze(["key", "toolKey", "toolName", "shortLabel", "shortDescription", "description", "group", "category", "colorGroup", "toolboxGroup", "subgroup", "path", "order", "status", "badge", "toolImage", "active", "adminOnly", "hidden", "deferred", "visibleInToolsList", "capabilityLabel", "childCapabilities", "requiredRole", "requires", "requiredForPlayable", "requiredForTestable", "requiredForPublish", "progressChecklist", "readiness", "statusDiagnostic", "toolId", "releaseChannel", "releaseChannelLabel", "createdAt", "updatedAt", "createdBy", "updatedBy"]),
121+
toolbox_tool_metadata: Object.freeze(["key", "toolKey", "toolName", "shortLabel", "shortDescription", "description", "group", "category", "colorGroup", "toolboxGroup", "subgroup", "path", "order", "status", "badge", "toolImage", "active", "adminOnly", "hidden", "deferred", "visibleInToolsList", "capabilityLabel", "childCapabilities", "requiredRole", "statusDiagnostic", "toolId", "releaseChannel", "releaseChannelLabel", "createdAt", "updatedAt", "createdBy", "updatedBy"]),
122+
toolbox_tool_planning: Object.freeze(["key", "toolKey", "readiness", "requiredForPlayable", "requiredForTestable", "requiredForPublish", "requires", "progressChecklist", "createdAt", "updatedAt", "createdBy", "updatedBy"]),
122123
toolbox_votes: Object.freeze(["key", "toolId", "userKey", "direction", "createdAt", "updatedAt", "createdBy", "updatedBy"]),
123124
workspace_projects: Object.freeze(["key", "name", "status", "ownerKey", "createdAt", "updatedAt", "createdBy", "updatedBy"]),
124125
workspace_progress: Object.freeze(["key", "projectKey", "currentFocus", "projectProgress", "publishingProgress", "recommendedNextTool", "createdAt", "updatedAt", "createdBy", "updatedBy"]),
@@ -148,6 +149,7 @@ const DEFAULT_TABLE_OWNERS = Object.freeze(Object.fromEntries([
148149
["roles", "standalone"],
149150
["user_roles", "standalone"],
150151
["toolbox_tool_metadata", "standalone"],
152+
["toolbox_tool_planning", "standalone"],
151153
["toolbox_votes", "standalone"],
152154
["tool_state_samples", "standalone"],
153155
...Object.entries(MOCK_DB_TOOL_GROUPS).flatMap(([ownerId, group]) =>

0 commit comments

Comments
 (0)