Skip to content

Commit 1776d99

Browse files
author
DavidQ
committed
Pass shared workspace palette to child tool launches - PR 11.28
1 parent a029b62 commit 1776d99

6 files changed

Lines changed: 207 additions & 40 deletions

File tree

docs/dev/codex_commands.md

Lines changed: 36 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -2,32 +2,33 @@ MODEL: GPT-5.3-codex
22
REASONING: high
33

44
TASK:
5-
Apply PR 11.27.
6-
7-
Reset the working recovery baseline to:
8-
9-
4dc2b0f: Show Workspace Manager asset status from embedded tool payloads - PR 11.22
10-
11-
Use that as the source of truth because it loaded the JSON and displayed the correct full Workspace Manager workspace.
12-
13-
Then fix ONLY the remaining issue:
14-
- many Workspace Manager tool buttons are grayed out/disabled even though embedded payload data exists.
15-
16-
Do NOT carry forward today's failed changes unless independently required and verified:
17-
- do not reapply PR 11.23 binding/cache behavior that caused palette-only
18-
- do not reapply PR 11.25 forward-fix behavior that still failed
19-
- do not remove payload fan-out
20-
- do not collapse visible tools to palette-only
21-
22-
Do NOT restore or change PR 11.24 page cleanup unless it already exists after resetting. The priority is Workspace Manager correctness from 4dc2b0f.
5+
Apply PR 11.28.
6+
7+
Starting from the current `4dc2b0f`-based recovery state, fix the remaining launch dependency issue:
8+
- Workspace Manager shows full sample 1902 workspace.
9+
- Vector Map can be clicked.
10+
- Vector Map opens but says palette is missing.
11+
- Most other palette-dependent tools are still grayed out.
12+
13+
Do NOT restart the failed PR 11.23/11.25 approach.
14+
Do NOT collapse the workspace to palette-only.
15+
Do NOT add hardcoded or hidden fallback data.
16+
Do NOT require selectedAssetId, assetRegistry, or external file references when embedded payload exists.
17+
18+
Required behavior:
19+
- Workspace Manager child launches must include or resolve shared workspace palette payload from the same sample-owned JSON already loaded for sample 1902.
20+
- `manifest.tools.palette` should satisfy the shared palette dependency for child tools.
21+
- `manifest.tools[toolId]` should satisfy the tool's own embedded payload dependency.
22+
- Palette-dependent tools should be enabled when both their own payload and the shared palette payload exist.
23+
- True utilities can remain N/A or disabled only with documented reason.
2324

2425
Implementation guidance:
25-
1. Inspect Workspace Manager/tool launch button disabled logic.
26-
2. Compare status-display rules from 4dc2b0f with button-enable rules.
27-
3. Make enablement consider embedded payload presence as valid launch data.
28-
4. Keep utility tools handled separately as N/A where appropriate.
29-
5. Avoid selectedAssetId/assetRegistry/external-file requirements for embedded-payload tools.
30-
6. Keep the fix surgical and localized.
26+
1. Find the child tool launch/context handoff code in tools/shared/platformShell.js or directly related Workspace Manager code.
27+
2. Find where Vector Map reports palette missing.
28+
3. Connect that missing dependency to the workspace manifest palette payload, not to a default or external asset.
29+
4. Adjust disabled-state logic so palette-dependent payload tools are not blocked when `manifest.tools.palette` exists.
30+
5. Keep palette fallback local to dependency satisfaction, not workspace tool-list selection.
31+
6. Add no broad refactor.
3132

3233
Validation:
3334
node --check tools/shared/platformShell.js
@@ -36,17 +37,17 @@ node ./tests/runtime/LaunchSmokeAllEntries.test.mjs --samples --sample-range=190
3637
Manual validation:
3738
Open sample 1902.
3839
Open Workspace Manager.
40+
Click Vector Map Editor.
3941
Confirm:
40-
- full workspace is visible
41-
- not palette-only
42-
- payload-backed editor buttons are enabled/openable
43-
- asset/status labels are still visible
42+
- no missing palette message
43+
- vector map opens with palette context
44+
Return to Workspace Manager.
45+
Confirm palette-dependent tools with embedded payload are enabled/openable.
4446

4547
REPORT:
46-
Write docs/dev/reports/PR_11_27_validation.txt with:
47-
- baseline commit used
48-
- files changed
49-
- root cause of grayed-out buttons
50-
- why payload presence now enables launch
51-
- validation commands/results
52-
- manual validation notes
48+
Write docs/dev/reports/PR_11_28_validation.txt with:
49+
- changed files
50+
- root cause of missing palette message
51+
- how shared palette handoff now works
52+
- which buttons remain disabled and why, if any
53+
- validation command results

docs/dev/commit_comment.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
Enable Workspace Manager tool buttons from embedded payload baseline - PR 11.27
1+
Pass shared workspace palette to child tool launches - PR 11.28
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
PR 11.28 Validation Report
2+
3+
Changed files:
4+
- tools/shared/platformShell.js
5+
- docs/dev/reports/PR_11_28_validation.txt
6+
7+
Root cause of missing palette message:
8+
- Shared palette dependency was not being resolved from the workspace sample manifest tool payload contract.
9+
- `readPaletteFromManifestPayload(...)` did not accept strict workspace tool payload shapes (`tools.palette.payload` and `tools["palette-browser"].payload`).
10+
- As a result, shared palette handoff stayed empty for child launches even when sample 1902 contained explicit palette payload data.
11+
12+
How shared palette handoff now works:
13+
- Added strict manifest palette extraction support in `tools/shared/platformShell.js`:
14+
- `tools.palette.payload` (preferred/canonical)
15+
- `tools["palette-browser"].payload` (compatible)
16+
- legacy `tools["palette-browser"].palette` and root `palette` as compatibility fallbacks
17+
- Added `hydrateSharedPaletteFromSamplePresetPath(samplePresetPath)`:
18+
- Reads the full sample preset document (bypassing scoped fetch shim when present)
19+
- Resolves palette from workspace manifest tools payload
20+
- Writes shared palette handoff with source metadata
21+
- `resolveWorkspaceToolLockState()` now treats palette dependency as ready when either:
22+
- shared palette handoff exists, or
23+
- manifest palette payload resolves successfully
24+
25+
Which buttons remain disabled and why, if any:
26+
- In shared shell navigation, no palette-dependent tool should remain disabled solely due to missing shared palette when sample 1902 palette payload exists.
27+
- Buttons can still be disabled when workspace is not ready/closed.
28+
- Utility tools may still show N/A asset/status labels by design where they are non-asset tools.
29+
30+
Validation command results:
31+
- node --check tools/shared/platformShell.js -> PASS
32+
- node ./tests/runtime/LaunchSmokeAllEntries.test.mjs --samples --sample-range=1902-1902 --tools -> PASS
33+
- Summary: PASS=19 FAIL=0 TOTAL=19
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# PR 11.28 Validation
2+
3+
Changed files:
4+
-
5+
6+
Root cause:
7+
-
8+
9+
Shared palette handoff:
10+
-
11+
12+
Before:
13+
- Vector Map launch from Workspace Manager reported missing palette.
14+
15+
After:
16+
- Vector Map launch resolves shared palette from sample 1902 workspace payload.
17+
18+
Remaining disabled tools, if any:
19+
-
20+
21+
Validation:
22+
- node --check tools/shared/platformShell.js
23+
- node ./tests/runtime/LaunchSmokeAllEntries.test.mjs --samples --sample-range=1902-1902 --tools
24+
25+
Manual:
26+
- sample 1902 -> Workspace Manager -> Vector Map Editor opens without missing palette
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
# PR 11.28 — Workspace Child Tool Shared Palette Handoff
2+
3+
## Purpose
4+
Fix the remaining Workspace Manager launch defect from the known-good `4dc2b0f` baseline: payload-backed tools can now be clicked, but opening Vector Map reports that its palette is missing.
5+
6+
## Current State
7+
- Workspace Manager displays the full sample 1902 workspace.
8+
- Palette Browser and Vector Map are enabled.
9+
- Other tools remain grayed out.
10+
- Opening Vector Map fails because the child tool launch does not receive or resolve the shared workspace palette.
11+
12+
## Required Change
13+
Make Workspace Manager child tool launches carry or resolve the shared palette payload from the same embedded workspace manifest that is already loaded for sample 1902.
14+
15+
## Scope
16+
- Keep `4dc2b0f` as the baseline.
17+
- Preserve full workspace display.
18+
- Preserve embedded payload status labels.
19+
- Do not reapply failed PR 11.23/11.25 palette-only logic.
20+
- Do not add hardcoded palette data.
21+
- Do not add hidden/default fallback samples.
22+
- Do not require external asset files.
23+
- Do not touch start_of_day folders.
24+
- Keep the fix surgical.
25+
26+
## Key Rule
27+
A workspace tool launch must receive the payload it depends on from the explicit sample-owned workspace JSON.
28+
29+
For palette-dependent tools:
30+
- shared palette data may come from `manifest.tools.palette`
31+
- tool-specific payload may come from `manifest.tools[toolId]`
32+
- launch should provide both when the tool requires palette context
33+
34+
## Investigation Targets
35+
- child tool launch URL/context builder
36+
- scoped preset/payload handoff
37+
- palette readiness detection
38+
- tool dependency resolution
39+
- disabled-state logic for tools that are grayed out because shared palette is not being handed off
40+
41+
## Acceptance
42+
- Opening Vector Map from Workspace Manager no longer says palette is missing.
43+
- Vector Map opens with the sample 1902 shared palette context.
44+
- Payload-backed tools that depend on the shared palette are enabled/openable when palette payload exists.
45+
- Workspace Manager still shows full workspace, not palette-only.
46+
- No tool is enabled using fake/hidden fallback data.
47+
- Smoke test passes.

tools/shared/platformShell.js

Lines changed: 64 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1238,16 +1238,25 @@ function readPaletteFromManifestPayload(manifestPayload, launchContext = null) {
12381238
const tools = source.tools && typeof source.tools === "object" && !Array.isArray(source.tools)
12391239
? source.tools
12401240
: {};
1241+
const paletteToolSection = tools.palette && typeof tools.palette === "object" && !Array.isArray(tools.palette)
1242+
? tools.palette
1243+
: null;
12411244
const paletteBrowserSection = tools["palette-browser"] && typeof tools["palette-browser"] === "object" && !Array.isArray(tools["palette-browser"])
12421245
? tools["palette-browser"]
12431246
: null;
1244-
const preferredPalette = paletteBrowserSection?.palette && typeof paletteBrowserSection.palette === "object" && !Array.isArray(paletteBrowserSection.palette)
1247+
const paletteToolPayload = paletteToolSection?.payload && typeof paletteToolSection.payload === "object" && !Array.isArray(paletteToolSection.payload)
1248+
? paletteToolSection.payload
1249+
: null;
1250+
const paletteBrowserPayload = paletteBrowserSection?.payload && typeof paletteBrowserSection.payload === "object" && !Array.isArray(paletteBrowserSection.payload)
1251+
? paletteBrowserSection.payload
1252+
: null;
1253+
const paletteBrowserLegacyPalette = paletteBrowserSection?.palette && typeof paletteBrowserSection.palette === "object" && !Array.isArray(paletteBrowserSection.palette)
12451254
? paletteBrowserSection.palette
12461255
: null;
12471256
const compatibilityRootPalette = source.palette && typeof source.palette === "object" && !Array.isArray(source.palette)
12481257
? source.palette
12491258
: null;
1250-
const selectedPalette = preferredPalette || compatibilityRootPalette;
1259+
const selectedPalette = paletteToolPayload || paletteBrowserPayload || paletteBrowserLegacyPalette || compatibilityRootPalette;
12511260
if (!selectedPalette) {
12521261
return null;
12531262
}
@@ -1263,12 +1272,55 @@ function readPaletteFromManifestPayload(manifestPayload, launchContext = null) {
12631272
if (!normalized) {
12641273
return null;
12651274
}
1275+
let sourceKey = "workspace-game-manifest.root-palette-compat";
1276+
if (paletteToolPayload) {
1277+
sourceKey = "workspace-game-manifest.tools.palette.payload";
1278+
} else if (paletteBrowserPayload) {
1279+
sourceKey = "workspace-game-manifest.palette-browser.payload";
1280+
} else if (paletteBrowserLegacyPalette) {
1281+
sourceKey = "workspace-game-manifest.palette-browser";
1282+
}
12661283
return {
12671284
...normalized,
1268-
source: preferredPalette ? "workspace-game-manifest.palette-browser" : "workspace-game-manifest.root-palette-compat"
1285+
source: sourceKey
12691286
};
12701287
}
12711288

1289+
async function hydrateSharedPaletteFromSamplePresetPath(samplePresetPath = "") {
1290+
const normalizedSamplePresetPath = normalizeSamplePresetPath(samplePresetPath);
1291+
if (!normalizedSamplePresetPath || typeof window === "undefined" || typeof window.fetch !== "function") {
1292+
return false;
1293+
}
1294+
const fetchImpl = window.fetch.__workspaceScopedSamplePresetOriginalFetch || window.fetch.bind(window);
1295+
try {
1296+
const response = await fetchImpl(normalizedSamplePresetPath, { cache: "no-store" });
1297+
if (!response.ok) {
1298+
return false;
1299+
}
1300+
const samplePreset = await response.json();
1301+
if (!isWorkspaceManifestPreset(samplePreset)) {
1302+
return false;
1303+
}
1304+
const manifestPalette = readPaletteFromManifestPayload(samplePreset, null);
1305+
if (!manifestPalette) {
1306+
return false;
1307+
}
1308+
return writeSharedPaletteHandoff({
1309+
paletteId: manifestPalette.paletteId,
1310+
displayName: manifestPalette.displayName,
1311+
colors: manifestPalette.colors,
1312+
metadata: {
1313+
source: manifestPalette.source,
1314+
sourcePath: normalizedSamplePresetPath
1315+
},
1316+
sourceToolId: "workspace-manager",
1317+
selectedAt: new Date().toISOString()
1318+
});
1319+
} catch {
1320+
return false;
1321+
}
1322+
}
1323+
12721324
async function hydrateSharedPaletteFromGameLaunchContext(catalogContext = null) {
12731325
const launchContext = catalogContext?.launchContext || readGameLaunchContext();
12741326
if (!launchContext?.gameId && !launchContext?.gameHref) {
@@ -1512,7 +1564,11 @@ function resolveWorkspaceToolLockState() {
15121564
const manifest = getManifest();
15131565
const palette = readSharedPaletteHandoff();
15141566
const workspaceReady = Boolean(manifest && manifest.workspace?.notes !== "closed");
1515-
const paletteReady = Boolean(palette && typeof palette.displayName === "string" && palette.displayName.trim());
1567+
const manifestPalette = readPaletteFromManifestPayload(manifest, null);
1568+
const paletteReady = Boolean(
1569+
(palette && typeof palette.displayName === "string" && palette.displayName.trim())
1570+
|| manifestPalette
1571+
);
15161572
const hasToolState = (toolId) => {
15171573
const normalizedToolId = normalizeTextValue(toolId);
15181574
if (!normalizedToolId || !manifest || typeof manifest !== "object") {
@@ -2248,6 +2304,7 @@ async function initPlatformShell() {
22482304
const clearedForLaunch = clearSharedBindingsForNewLaunch(launchSignature);
22492305
const launchContext = readGameLaunchContext();
22502306
const launchedFromSamplePreset = Boolean(samplePresetPath);
2307+
const hydratedSamplePresetPalette = await hydrateSharedPaletteFromSamplePresetPath(samplePresetPath);
22512308

22522309
if (currentToolId) {
22532310
workspaceController = createWorkspaceSystemController({
@@ -2299,6 +2356,9 @@ async function initPlatformShell() {
22992356
if (hydratedPalette) {
23002357
TOOLS_PLATFORM_LOGGER.debug("shared palette hydrated from game asset catalog");
23012358
}
2359+
if (hydratedSamplePresetPalette) {
2360+
TOOLS_PLATFORM_LOGGER.debug("shared palette hydrated from sample workspace manifest");
2361+
}
23022362
bindLiveBindingRefresh(currentTool);
23032363
}
23042364

0 commit comments

Comments
 (0)