Skip to content

Commit 0f6ed6a

Browse files
author
DavidQ
committed
Hard-replace Workspace Manager click dispatch to launch clicked tool id - PR 11.183. Remove cross-tool registry alias and require exact tool ids - PR 11.184.
1 parent ee8b759 commit 0f6ed6a

10 files changed

Lines changed: 480 additions & 38 deletions

docs/dev/codex_commands.md

Lines changed: 25 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,33 @@
1+
# Codex Commands — PR 11.184
12

23
Model: GPT-5 high
34
Reasoning: high
45

5-
Fix click handler in:
6-
tools/Workspace Manager/main.js
6+
Remove cross-tool aliasing.
77

8-
- Use dataset.toolId from clicked element
9-
- Remove any fallback/default tool logic
8+
Primary file:
9+
- `tools/toolRegistry.js`
1010

11-
Validate:
12-
node --check tools/Workspace Manager/main.js
11+
Steps:
12+
1. Remove `TOOL_ID_ALIASES`.
13+
2. Update `resolveToolIdAlias(toolId)` so it only trims and returns exact input.
14+
3. Ensure `getToolById("vector-asset-studio")` does not resolve to SVG.
15+
4. Do not add fallback aliases.
16+
5. Create report:
17+
- `docs/dev/reports/pr_11_184_validation.md`
18+
19+
Validation:
20+
- `node --check tools/toolRegistry.js`
21+
- `node --check "tools/Workspace Manager/main.js"`
1322

1423
Manual:
15-
Click SVG → verify correct logs
24+
- Open Workspace Manager sample 1902.
25+
- Confirm SVG tile still renders as `svg-asset-studio`.
26+
- Confirm no tool id aliases are used to launch SVG.
27+
28+
Full samples smoke:
29+
- Skip.
30+
- Reason: targeted registry alias cleanup.
31+
32+
Return ZIP artifact at:
33+
`<project folder>/tmp/PR_11_184_20260430_01.zip`

docs/dev/commit_comment.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
Fix Workspace Manager click handler to use data-tool-id for correct tool launch - PR 11.182
1+
Remove cross-tool registry alias and require exact tool ids - PR 11.184
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# PR 11.183 Final Click Dispatch Lock
2+
3+
## Evidence
4+
Direct URL with `tool=svg-asset-studio` works and shows:
5+
6+
```text
7+
SVG Asset Studio
8+
Loaded
9+
Asset: sample-0901-ship.svg
10+
```
11+
12+
Therefore the remaining broken path is only Workspace Manager click dispatch.
13+
14+
## Required Fix
15+
Clicking the rendered SVG tile must launch from its own `data-tool-id`.
16+
17+
## Forbidden
18+
No fallback to Vector Map Editor.
19+
No global current tool.
20+
No first-tool default.
21+
No stale closure variable.
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# PR 11.183 Validation
2+
3+
## Scope
4+
Hard-replaced Workspace Manager rendered tool tile click dispatch so tile clicks launch only from the clicked element's `data-tool-id`.
5+
6+
## Files changed
7+
- `tools/Workspace Manager/main.js`
8+
- `docs/dev/reports/pr_11_183_validation.md`
9+
10+
## Old bad path found
11+
Workspace Manager had a delegated `.tools-platform-frame__nav-link` / `.tools-platform-frame__nav-tool-row` click path that could resolve launches indirectly instead of requiring the clicked tile's own dataset. This left room for stale selected-tool/global/default behavior to launch the wrong tool, including `vector-map-editor` when the intended click was SVG Asset Studio.
12+
13+
## Click handler replaced
14+
Added a direct binding layer for rendered `[data-tool-id]` elements:
15+
- `bindWorkspaceToolTileClickHandlers(...)` attaches a direct click handler to each `[data-tool-id]` element.
16+
- A `MutationObserver` binds future rendered tiles/buttons as they appear.
17+
- The handler calls `event.preventDefault()` and `event.stopPropagation()`.
18+
- The handler reads only `tileElement.dataset.toolId`.
19+
- If `data-tool-id` is missing or not launchable, it logs `[WORKSPACE_TOOL_CLICK]` with an actionable error and does not launch.
20+
- If valid, it logs `[WORKSPACE_TOOL_CLICK]` with `clickedToolId`, sets selected tool to that exact id, and calls the existing `mountSelectedTool("tool-click")` path.
21+
22+
The old delegated nav path is now bypassed for tool nav clicks: it logs an error if a click reaches it without direct `[data-tool-id]` handling and does not launch a fallback/default tool.
23+
24+
## Expected console proof
25+
Manual UAT was not run in this terminal session. Expected browser logs:
26+
- SVG click: `[WORKSPACE_TOOL_CLICK] clickedToolId: svg-asset-studio`
27+
- SVG launch: `[WORKSPACE_TOOL_LAUNCH] requestedToolId: svg-asset-studio`
28+
- SVG entry: `[SVG_ENTRY_TOP]`
29+
- Vector Map click: `[WORKSPACE_TOOL_CLICK] clickedToolId: vector-map-editor`
30+
- Vector Map launch: `[WORKSPACE_TOOL_LAUNCH] requestedToolId: vector-map-editor`
31+
32+
## Explicit query route
33+
The direct query route `?tool=svg-asset-studio` is preserved because initial query handling still writes the selected tool id and calls the existing launch path.
34+
35+
## Validation
36+
- PASS: `node --check "tools/Workspace Manager/main.js"`
37+
- PASS: `node --check "tools/SVG Asset Studio/main.js"`
38+
- PASS: `node --check tools/shared/workspaceShell.js`
39+
40+
## Full samples smoke
41+
Skipped. Reason: targeted Workspace Manager click dispatch fix; full samples smoke takes about 20 minutes and is not required.
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# PR 11.184 Decision Record
2+
3+
## Decision
4+
Remove `vector-asset-studio -> svg-asset-studio`.
5+
6+
## Reason
7+
A registry should not silently map one tool name to another. This hides incorrect callers and makes click/launch bugs harder to diagnose.
8+
9+
## Correct model
10+
- `svg-asset-studio` is the only valid SVG Asset Studio id.
11+
- `vector-asset-studio` is not a valid id unless a real tool with that id exists.
12+
- Unknown ids fail explicitly.
13+
14+
## Follow-up
15+
After this cleanup, continue fixing Workspace Manager click dispatch so SVG clicks launch `svg-asset-studio`.
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
# PR 11.184 Validation
2+
3+
## Scope
4+
Removed cross-tool aliasing from `tools/toolRegistry.js`.
5+
6+
## Files changed
7+
- `tools/toolRegistry.js`
8+
- `docs/dev/reports/pr_11_184_validation.md`
9+
10+
## Alias removed
11+
Removed the `TOOL_ID_ALIASES` map that routed:
12+
13+
```text
14+
vector-asset-studio -> svg-asset-studio
15+
```
16+
17+
`resolveToolIdAlias(toolId)` now only returns trimmed string input and does not map one tool id to another.
18+
19+
## Exact-id registry behavior
20+
Verified with a module import check:
21+
22+
```json
23+
{"svg":"svg-asset-studio","vectorAsset":null,"alias":"vector-asset-studio"}
24+
```
25+
26+
This confirms:
27+
- `getToolById("svg-asset-studio")` returns SVG Asset Studio.
28+
- `getToolById("vector-asset-studio")` returns `null`.
29+
- `resolveToolIdAlias(" vector-asset-studio ")` returns `vector-asset-studio`, not SVG.
30+
31+
## Workspace Manager note
32+
Workspace Manager click dispatch must continue to use clicked `data-tool-id` values directly. No fallback alias was added.
33+
34+
## Validation
35+
- PASS: `node --check tools/toolRegistry.js`
36+
- PASS: `node --check "tools/Workspace Manager/main.js"`
37+
- PASS: exact-id module behavior check with `node --input-type=module`
38+
39+
## Manual UAT
40+
Not run in this terminal session. Required browser UAT remains:
41+
- Open Workspace Manager sample 1902.
42+
- Confirm SVG tile still renders as `svg-asset-studio`.
43+
- Confirm no alias is used to launch SVG.
44+
45+
## Full samples smoke
46+
Skipped. Reason: targeted registry alias cleanup.
Lines changed: 155 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,155 @@
1+
# BUILD_PR_LEVEL_11_183_HARD_REPLACE_WORKSPACE_CLICK_DISPATCH
2+
3+
## Purpose
4+
Finish the Workspace Manager SVG launch bug by hard-replacing the click dispatch path so clicking the SVG Asset Studio tile launches `svg-asset-studio`, not `vector-map-editor`.
5+
6+
## Proven Good Path
7+
Manual URL works:
8+
9+
`/tools/Workspace%20Manager/index.html?tool=svg-asset-studio&sampleId=1902&sampleTitle=Workspace+All+Tools+Integration&samplePresetPath=%2Fsamples%2Fphase-19%2F1902%2Fsample.1902.workspace-all-tools.json`
10+
11+
Confirmed UI:
12+
13+
```text
14+
SVG Asset Studio
15+
Loaded
16+
Asset: sample-0901-ship.svg
17+
```
18+
19+
This proves:
20+
- SVG contract payload works.
21+
- workspaceShell path works.
22+
- asset label works.
23+
- direct `tool=svg-asset-studio` route works.
24+
25+
## Remaining Bug
26+
Workspace Manager click dispatch still launches:
27+
28+
```text
29+
requestedToolId: vector-map-editor
30+
```
31+
32+
even though SVG tile renders correctly with:
33+
34+
```text
35+
dataToolId: svg-asset-studio
36+
```
37+
38+
## Scope
39+
One PR purpose only:
40+
- Replace Workspace Manager tool click dispatch so it always launches from the clicked tile/button `data-tool-id`.
41+
42+
Do not modify schemas.
43+
Do not modify sample 1902 JSON.
44+
Do not modify shell files.
45+
Do not modify SVG payload parsing.
46+
Do not restore shared handoff.
47+
Do not add fallback data.
48+
49+
## Implementation Requirements
50+
51+
### 1. Remove stale/default click path
52+
In `tools/Workspace Manager/main.js`, find all click paths that launch tools from:
53+
- `currentToolId`
54+
- active/default tool
55+
- first accepted tool
56+
- `vector-map-editor`
57+
- stale closure variable
58+
- parent container state not derived from clicked tile
59+
60+
Remove or bypass those paths for rendered tool tiles/buttons.
61+
62+
### 2. Bind direct click handler to each rendered tile/button
63+
When rendering tool tiles/buttons, attach a direct click handler to the exact element with `data-tool-id`.
64+
65+
Required behavior:
66+
```js
67+
tileElement.addEventListener("click", (event) => {
68+
event.preventDefault();
69+
event.stopPropagation();
70+
71+
const toolId = tileElement.dataset.toolId;
72+
73+
console.log("[WORKSPACE_TOOL_CLICK]", {
74+
clickedToolId: toolId,
75+
dataToolId: tileElement.dataset.toolId,
76+
text: tileElement.textContent
77+
});
78+
79+
launchTool(toolId);
80+
});
81+
```
82+
83+
Use the repo's real launch function name if different from `launchTool`.
84+
85+
### 3. No global fallback
86+
The handler must not fallback to:
87+
- `vector-map-editor`
88+
- current selected tool
89+
- first manifest tool
90+
- previous mounted tool
91+
92+
If `data-tool-id` is missing, log an actionable error and do not launch.
93+
94+
### 4. Preserve explicit query route
95+
Do not break direct query launch:
96+
97+
```text
98+
?tool=svg-asset-studio
99+
```
100+
101+
### 5. Required logs
102+
When clicking SVG tile/button, console must show:
103+
104+
```text
105+
[WORKSPACE_TOOL_CLICK] clickedToolId: svg-asset-studio
106+
[WORKSPACE_TOOL_LAUNCH] requestedToolId: svg-asset-studio
107+
[SVG_LAUNCH_REQUEST]
108+
[SVG_ENTRY_TOP]
109+
[SVG_HOSTED_WORKSPACE_ENTRY]
110+
[WORKSPACE_SHELL_STATE]
111+
[SVG_POSTMESSAGE_SEND]
112+
[SVG_POSTMESSAGE_RECEIVE]
113+
[SVG_TILE_WRITE]
114+
```
115+
116+
## Acceptance
117+
Manual UAT:
118+
119+
1. Open sample 1902 Workspace Manager normally.
120+
2. Click SVG Asset Studio tile/button.
121+
3. Confirm click log uses `svg-asset-studio`.
122+
4. Confirm launch log uses `svg-asset-studio`.
123+
5. Confirm UI shows:
124+
125+
```text
126+
SVG Asset Studio
127+
Loaded
128+
Asset: sample-0901-ship.svg
129+
```
130+
131+
6. Confirm clicking Vector Map Editor still launches Vector Map Editor.
132+
7. Confirm no `Asset: none` legacy badge row appears.
133+
134+
## Validation
135+
Run:
136+
- `node --check "tools/Workspace Manager/main.js"`
137+
- `node --check "tools/SVG Asset Studio/main.js"`
138+
- `node --check tools/shared/workspaceShell.js`
139+
140+
Full samples smoke:
141+
- Skip.
142+
- Reason: targeted Workspace Manager click dispatch fix; full samples smoke takes about 20 minutes and is not required.
143+
144+
## Report
145+
Create:
146+
147+
`docs/dev/reports/pr_11_183_validation.md`
148+
149+
Include:
150+
- old bad path found
151+
- exact click handler replaced
152+
- console proof for SVG click
153+
- console proof for Vector Map click
154+
- targeted validation results
155+
- full smoke skipped reason

0 commit comments

Comments
 (0)