Skip to content

Commit 512860c

Browse files
committed
Remove Toolbox bootstrap registry metadata ownership - PR_26160_069-toolbox-remove-bootstrap-registry
1 parent 0c06a66 commit 512860c

13 files changed

Lines changed: 2432 additions & 1982 deletions

admin/tool-votes.js

Lines changed: 82 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,15 @@ const RELEASE_CHANNEL_OPTIONS = Object.freeze([
2121
["complete", "Complete"],
2222
]);
2323
const RELEASE_CHANNEL_LABELS = new Map(RELEASE_CHANNEL_OPTIONS);
24+
const GROUP_OPTIONS = Object.freeze([
25+
"AI",
26+
"Audio",
27+
"Build/Create",
28+
"Design",
29+
"Marketplace",
30+
"Platform",
31+
"Play",
32+
]);
2433

2534
const SORT_TYPES = Object.freeze({
2635
down: "number",
@@ -89,6 +98,76 @@ function orderCell(voteRow) {
8998
return cell;
9099
}
91100

101+
function updateMetadata(voteRow, updates, successLabel) {
102+
const nextGroup = updates.group ?? voteRow.group;
103+
const nextPath = updates.path ?? voteRow.path;
104+
const nextState = updates.status ?? rowReleaseChannel(voteRow);
105+
try {
106+
const snapshot = updateToolboxVoteMetadata(voteRow.toolId, {
107+
group: nextGroup,
108+
path: nextPath,
109+
status: nextState,
110+
releaseChannel: nextState,
111+
});
112+
window.setTimeout(() => {
113+
renderSnapshot(snapshot, `${voteRow.toolName} ${successLabel}. Toolbox Build Path uses the same metadata.`);
114+
selectRow(voteRow.toolId);
115+
}, 0);
116+
} catch (error) {
117+
const message = error instanceof Error ? error.message : String(error || "Toolbox metadata update unavailable.");
118+
setStatus(`${voteRow.toolName} metadata could not be updated. ${message}`);
119+
renderRows(snapshotRows);
120+
}
121+
}
122+
123+
function groupCell(voteRow) {
124+
const cell = document.createElement("td");
125+
const select = document.createElement("select");
126+
const currentGroup = String(voteRow.group || "").trim();
127+
const options = GROUP_OPTIONS.includes(currentGroup) || !currentGroup
128+
? GROUP_OPTIONS
129+
: [...GROUP_OPTIONS, currentGroup];
130+
select.dataset.toolboxVotesGroup = voteRow.toolId;
131+
select.setAttribute("aria-label", `Group for ${voteRow.toolName}`);
132+
options.forEach((group) => {
133+
const option = document.createElement("option");
134+
option.value = group;
135+
option.textContent = group;
136+
select.append(option);
137+
});
138+
select.value = currentGroup || GROUP_OPTIONS[0];
139+
select.addEventListener("click", (event) => {
140+
event.stopPropagation();
141+
});
142+
select.addEventListener("change", () => {
143+
if (select.value !== currentGroup) {
144+
updateMetadata(voteRow, { group: select.value }, `group updated to ${select.value}`);
145+
}
146+
});
147+
cell.append(select);
148+
return cell;
149+
}
150+
151+
function pathCell(voteRow) {
152+
const cell = document.createElement("td");
153+
const input = document.createElement("input");
154+
input.dataset.toolboxVotesPath = voteRow.toolId;
155+
input.setAttribute("aria-label", `Path for ${voteRow.toolName}`);
156+
input.type = "text";
157+
input.value = voteRow.path || "";
158+
input.addEventListener("click", (event) => {
159+
event.stopPropagation();
160+
});
161+
input.addEventListener("change", () => {
162+
const nextPath = input.value.trim().replace(/^\/+/, "");
163+
if (nextPath !== voteRow.path) {
164+
updateMetadata(voteRow, { path: nextPath }, "path updated");
165+
}
166+
});
167+
cell.append(input);
168+
return cell;
169+
}
170+
92171
function releaseChannelLabel(value) {
93172
return RELEASE_CHANNEL_LABELS.get(value) || RELEASE_CHANNEL_LABELS.get("planned");
94173
}
@@ -126,20 +205,7 @@ function handleStateChange(voteRow, select) {
126205
if (nextState === rowReleaseChannel(voteRow)) {
127206
return;
128207
}
129-
try {
130-
const snapshot = updateToolboxVoteMetadata(voteRow.toolId, {
131-
group: voteRow.group,
132-
path: voteRow.path,
133-
status: nextState,
134-
releaseChannel: nextState,
135-
});
136-
renderSnapshot(snapshot, `${voteRow.toolName} state updated to ${releaseChannelLabel(nextState)}. Toolbox Build Path uses the same metadata.`);
137-
selectRow(voteRow.toolId);
138-
} catch (error) {
139-
select.value = rowReleaseChannel(voteRow);
140-
const message = error instanceof Error ? error.message : String(error || "Toolbox state update unavailable.");
141-
setStatus(`${voteRow.toolName} state could not be updated. ${message}`);
142-
}
208+
updateMetadata(voteRow, { status: nextState }, `state updated to ${releaseChannelLabel(nextState)}`);
143209
}
144210

145211
function sortValue(voteRow, key) {
@@ -296,8 +362,8 @@ function renderRows(rows) {
296362
row.append(
297363
toolNameCell(voteRow),
298364
orderCell(voteRow),
299-
tableCell(voteRow.group),
300-
tableCell(voteRow.path),
365+
groupCell(voteRow),
366+
pathCell(voteRow),
301367
stateCell(voteRow),
302368
tableCell(voteRow.up),
303369
tableCell(voteRow.down),

docs_build/dev/reports/coverage_changed_js_guardrail.txt

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,19 @@ 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
910
(0%) src/dev-runtime/guest-seeds/tool-state-samples.js - WARNING: changed runtime JS file was not collected by Playwright V8 coverage; advisory only
1011
(0%) src/dev-runtime/persistence/mock-db-store.js - WARNING: changed runtime JS file was not collected by Playwright V8 coverage; advisory only
1112
(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
1214
(0%) toolbox/toolRegistry.js - WARNING: changed runtime JS file was not collected by Playwright V8 coverage; advisory only
13-
(74%) admin/tool-votes.js - executed lines 320/320; executed functions 29/39
14-
(84%) toolbox/tools-page-accordions.js - executed lines 997/997; executed functions 90/107
15+
(62%) admin/tool-votes.js - executed lines 383/383; executed functions 29/47
16+
(88%) toolbox/tools-page-accordions.js - executed lines 997/997; executed functions 94/107
1517

1618
Guardrail warnings:
19+
(0%) src/dev-runtime/guest-seeds/tool-metadata-inventory.js - WARNING: changed runtime JS file missing from coverage; advisory only
1720
(0%) src/dev-runtime/guest-seeds/tool-state-samples.js - WARNING: changed runtime JS file missing from coverage; advisory only
1821
(0%) src/dev-runtime/persistence/mock-db-store.js - WARNING: changed runtime JS file missing from coverage; advisory only
1922
(0%) src/dev-runtime/server/mock-api-router.mjs - WARNING: changed runtime JS file missing from coverage; advisory only
23+
(0%) src/shared/toolbox/platformShell.js - WARNING: changed runtime JS file missing from coverage; advisory only
2024
(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: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -12,43 +12,50 @@ 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-
(80%) Toolbox Index - exercised 3 runtime JS files
15+
(68%) Toolbox Index - exercised 5 runtime JS files
1616
(0%) Tool Template V2 - not exercised by this Playwright run
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
2021
(0%) src/dev-runtime/guest-seeds/tool-state-samples.js - WARNING: changed runtime JS file was not collected by Playwright V8 coverage; advisory only
2122
(0%) src/dev-runtime/persistence/mock-db-store.js - WARNING: changed runtime JS file was not collected by Playwright V8 coverage; advisory only
2223
(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
2325
(0%) toolbox/toolRegistry.js - WARNING: changed runtime JS file was not collected by Playwright V8 coverage; advisory only
24-
(74%) admin/tool-votes.js - executed lines 320/320; executed functions 29/39
25-
(84%) toolbox/tools-page-accordions.js - executed lines 997/997; executed functions 90/107
26+
(62%) admin/tool-votes.js - executed lines 383/383; executed functions 29/47
27+
(88%) toolbox/tools-page-accordions.js - executed lines 997/997; executed functions 94/107
2628

2729
Files with executed line/function counts where available:
30+
(33%) src/engine/api/toolbox-votes-api-client.js - executed lines 46/46; executed functions 2/6
2831
(38%) src/engine/api/session-api-client.js - executed lines 34/34; executed functions 3/8
29-
(50%) src/engine/api/toolbox-votes-api-client.js - executed lines 46/46; executed functions 3/6
30-
(53%) src/engine/api/server-api-client.js - executed lines 159/159; executed functions 10/19
31-
(63%) toolbox/tool-registry-api-client.js - executed lines 148/148; executed functions 15/24
32+
(55%) toolbox/colors/colors.js - executed lines 2289/2289; executed functions 119/216
33+
(58%) src/engine/api/server-api-client.js - executed lines 159/159; executed functions 11/19
34+
(62%) admin/tool-votes.js - executed lines 383/383; executed functions 29/47
3235
(64%) assets/theme-v2/js/tool-display-mode.js - executed lines 209/209; executed functions 9/14
33-
(74%) admin/tool-votes.js - executed lines 320/320; executed functions 29/39
3436
(77%) assets/theme-v2/js/gamefoundry-partials.js - executed lines 548/548; executed functions 37/48
35-
(84%) toolbox/tools-page-accordions.js - executed lines 997/997; executed functions 90/107
37+
(88%) toolbox/tools-page-accordions.js - executed lines 997/997; executed functions 94/107
38+
(89%) toolbox/tool-registry-api-client.js - executed lines 148/148; executed functions 24/27
39+
(100%) toolbox/colors/palette-api-client.js - executed lines 19/19; executed functions 4/4
3640
(100%) toolbox/project-workspace/project-workspace-api-client.js - executed lines 12/12; executed functions 2/2
3741

3842
Uncovered or low-coverage changed JS files:
43+
(0%) src/dev-runtime/guest-seeds/tool-metadata-inventory.js - WARNING: uncovered changed runtime JS file; advisory only
3944
(0%) src/dev-runtime/guest-seeds/tool-state-samples.js - WARNING: uncovered changed runtime JS file; advisory only
4045
(0%) src/dev-runtime/persistence/mock-db-store.js - WARNING: uncovered changed runtime JS file; advisory only
4146
(0%) src/dev-runtime/server/mock-api-router.mjs - WARNING: uncovered changed runtime JS file; advisory only
47+
(0%) src/shared/toolbox/platformShell.js - WARNING: uncovered changed runtime JS file; advisory only
4248
(0%) toolbox/toolRegistry.js - WARNING: uncovered changed runtime JS file; advisory only
4349

4450
Changed JS files considered:
51+
(0%) src/dev-runtime/guest-seeds/tool-metadata-inventory.js - changed JS file not collected as browser runtime coverage
4552
(0%) src/dev-runtime/guest-seeds/tool-state-samples.js - changed JS file not collected as browser runtime coverage
4653
(0%) src/dev-runtime/persistence/mock-db-store.js - changed JS file not collected as browser runtime coverage
4754
(0%) src/dev-runtime/server/mock-api-router.mjs - changed JS file not collected as browser runtime coverage
48-
(0%) tests/playwright/tools/AdminPlatformToolsWireframes.spec.mjs - changed JS file not collected as browser runtime coverage
55+
(0%) src/shared/toolbox/platformShell.js - changed JS file not collected as browser runtime coverage
4956
(0%) tests/playwright/tools/BuildPathProgressSimplification.spec.mjs - changed JS file not collected as browser runtime coverage
5057
(0%) tests/playwright/tools/ToolboxAdminMetadataSsot.spec.mjs - changed JS file not collected as browser runtime coverage
5158
(0%) tests/playwright/tools/ToolboxRoutePages.spec.mjs - changed JS file not collected as browser runtime coverage
5259
(0%) toolbox/toolRegistry.js - changed JS file not collected as browser runtime coverage
53-
(74%) admin/tool-votes.js - changed JS file with browser V8 coverage
54-
(84%) toolbox/tools-page-accordions.js - changed JS file with browser V8 coverage
60+
(62%) admin/tool-votes.js - changed JS file with browser V8 coverage
61+
(88%) toolbox/tools-page-accordions.js - changed JS file with browser V8 coverage
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
# PR_26160_069 Toolbox Remove Bootstrap Registry Report
2+
3+
## Branch Validation
4+
5+
| Check | Expected | Actual | Status |
6+
| --- | --- | --- | --- |
7+
| Current git branch | `main` | `main` | PASS |
8+
9+
## Requirement Checklist
10+
11+
| Requirement | Status | Evidence |
12+
| --- | --- | --- |
13+
| Remove remaining Toolbox metadata ownership from `toolbox/toolRegistry.js`. | PASS | `toolbox/toolRegistry.js` now exports an empty compatibility shell with no tool records. |
14+
| Stop using `toolbox/toolRegistry.js` as bootstrap route/image/default seed registry. | PASS | Active browser/static audit found no imports or references outside the shell; server seed ownership moved to `src/dev-runtime/guest-seeds/tool-metadata-inventory.js`. |
15+
| Move route, badge/image, group, order, path, and status metadata into DB-backed tool metadata. | PASS | `toolbox_tool_metadata` schema and seed rows now include route/path, badge/tool image, group/category/color, order, status, active/admin/visibility, and descriptive fields. |
16+
| Toolbox reads tool metadata only through API/service contract backed by DB adapter. | PASS | `toolbox/tool-registry-api-client.js` reads `/api/toolbox/registry/snapshot`; `toolbox/tools-page-accordions.js` uses registry/vote API clients. |
17+
| Admin Tool Votes reads tool metadata only through API/service contract backed by DB adapter. | PASS | `admin/tool-votes.js` uses `readToolboxVoteSnapshot`, `reorderToolboxVoteRows`, and `updateToolboxVoteMetadata`. |
18+
| Remove compatibility-only browser metadata lookups where safe. | PASS | Direct browser imports of `toolbox/toolRegistry.js` were removed from targeted Toolbox/Admin tests; active browser audit found no import usage. |
19+
| Keep `toolId` and `releaseChannel` only as compatibility aliases, not primary metadata source. | PASS | Server rows use `toolKey`/`status` as primary values while preserving `toolId`/`releaseChannel` for existing vote row compatibility. |
20+
| Preserve 43-tool inventory. | PASS | API probe returned `activeTools: 43` and `voteRows: 43`; Playwright verified Toolbox and Admin Tool Votes show matching 43 rows. |
21+
| Preserve MIDI and Music as separate tools. | PASS | API probe returned `hasMidi: true` and `hasMusic: true`. |
22+
| Admin edits to order/group/path/status affect Toolbox after reload. | PASS | `ToolboxAdminMetadataSsot.spec.mjs` edits `Creator Learning` metadata and verifies Toolbox Build Path reflects order/group/path/status after reload. |
23+
| Do not migrate unrelated game/sample data. | PASS | Changes are limited to Toolbox/Admin metadata, dev seed inventory, shared shell diagnostics, and targeted validation. |
24+
| No inline script/style/event handlers. | PASS | No HTML inline handlers or style/script blocks were added. |
25+
26+
## Remaining-Registry Audit
27+
28+
| Audit | Command / Evidence | Status |
29+
| --- | --- | --- |
30+
| Active app code imports `toolbox/toolRegistry.js` | `rg 'from ["''].*toolRegistry\.js\|import\(["''].*toolRegistry\.js' assets admin toolbox src -n --glob '!toolbox/toolRegistry.js'` returned no matches. | PASS |
31+
| Active app code references `toolbox/toolRegistry.js` | `rg 'toolbox/toolRegistry\.js' assets admin toolbox src -n --glob '!toolbox/toolRegistry.js'` returned no matches after updating shared shell diagnostics. | PASS |
32+
| Toolbox/Admin page-local hardcoded counts | `rg 'Planned \([0-9]+\)\|Wireframe \([0-9]+\)\|Beta \([0-9]+\)\|Complete \([0-9]+\)\|Tool Count: [0-9]+/[0-9]+' toolbox admin assets src -n` returned no matches. | PASS |
33+
| Browser requests retired registry module | Playwright `ToolboxAdminMetadataSsot.spec.mjs` verifies Toolbox/Admin pages do not request `/toolbox/toolRegistry.js`. | PASS |
34+
35+
## Validation
36+
37+
| Lane | Command | Result |
38+
| --- | --- | --- |
39+
| Changed-file syntax | `node --check` on changed JS/MJS files | PASS |
40+
| Static diff whitespace | `git diff --check` | PASS |
41+
| Static registry import audit | `rg` checks listed above | PASS |
42+
| API contract probe | Server probe of `/api/toolbox/registry/snapshot` and `/api/toolbox/votes/snapshot` | PASS: 43/43, no missing records |
43+
| Admin Tool Votes / Toolbox SSoT Playwright | `npx playwright test tests/playwright/tools/ToolboxAdminMetadataSsot.spec.mjs --reporter=line` | PASS: 4/4 |
44+
| Toolbox route/display Playwright | `npx playwright test tests/playwright/tools/ToolboxRoutePages.spec.mjs --reporter=line` | PASS: 8/8 |
45+
| Build Path Playwright | `npx playwright test tests/playwright/tools/BuildPathProgressSimplification.spec.mjs --reporter=line` | PASS: 4/4 |
46+
47+
## Impacted Lane
48+
49+
Toolbox/Admin Tool Votes validation only.
50+
51+
## Skipped Lanes
52+
53+
| Lane | Reason |
54+
| --- | --- |
55+
| Full samples validation | Safe to skip per request; this PR does not touch samples or shared sample loader/framework code. |
56+
| Unrelated tool runtime lanes | Safe to skip; changes are scoped to Toolbox metadata, Admin Tool Votes, server API metadata, and targeted tests. |
57+
58+
## Manual Test Notes
59+
60+
- Confirmed branch guard before implementation: current branch `main`.
61+
- Confirmed server API snapshots agree on the 43-tool inventory.
62+
- Confirmed MIDI and Music remain separate DB-backed tools.
63+
- Confirmed Admin Tool Votes metadata edits flow back into Toolbox Build Path after reload.

0 commit comments

Comments
 (0)