|
| 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