Skip to content

Commit 2a1d205

Browse files
author
DavidQ
committed
Fix Vector Map Editor hosted direct payload boot path - PR 11.151
1 parent 871e0cb commit 2a1d205

5 files changed

Lines changed: 226 additions & 27 deletions

File tree

docs/dev/codex_commands.md

Lines changed: 27 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,56 +1,64 @@
11
# CODEX COMMANDS
22

33
Model: GPT-5.3-codex
4-
Reasoning: medium
4+
Reasoning: high
55

66
STRICT SCOPE MODE
77

88
ALLOWED FILES:
99
- tools/vector-map-editor/main.js
10-
- docs/dev/reports/vector_map_workspace_object_render_11_150.txt
10+
- docs/dev/reports/vector_map_hosted_payload_boot_11_151.txt
1111

1212
ALLOWED CHANGES:
13-
- fix Vector Map Editor to render direct `payloadJson.vectorMapDocument.objects`
13+
- fix Vector Map Editor hosted direct payload boot
1414
- create/update report only
1515

1616
TASK:
1717

1818
1. Open:
1919
tools/vector-map-editor/main.js
2020

21-
2. Find the input ingestion/render source for hosted Workspace Manager launches.
21+
2. Find boot/init logic that shows:
22+
`No map objects loaded. Import a map JSON file or launch with a sample preset path.`
2223

23-
3. Ensure Vector Map Editor uses direct payload shape:
24+
3. Find hosted launch/shared context input path.
25+
26+
4. Ensure hosted Workspace Manager payload is read as:
2427
payloadJson.vectorMapDocument
2528

26-
4. Ensure render source is:
29+
5. Ensure editor state/render source uses:
2730
payloadJson.vectorMapDocument.objects
2831

29-
5. Do NOT:
32+
6. For hosted direct payload flow:
33+
- do not require samplePresetPath
34+
- do not require import path
35+
- do not fallback to empty map
36+
- do not show old preset-path message when valid payload exists
37+
38+
7. Do NOT:
3039
- modify schemas
3140
- modify Sample 1902 JSON
3241
- modify Workspace Manager
33-
- modify runtime
34-
- add fallback/demo objects
42+
- modify tool host runtime
43+
- add fallback/demo/default objects
3544
- transform/wrap/normalize payload
3645

37-
6. Validate:
46+
8. Validate:
3847
- JS syntax for tools/vector-map-editor/main.js
39-
- Sample 1902 Workspace Manager → Vector Map Editor renders:
40-
obj-player-path
41-
obj-hazard-zone
48+
- direct hosted payload containing obj-player-path and obj-hazard-zone loads into editor state
49+
- old no-map message is not shown for valid hosted payload
4250
- git diff --name-only contains only ALLOWED FILES
4351

44-
7. Write:
45-
docs/dev/reports/vector_map_workspace_object_render_11_150.txt
52+
9. Write:
53+
docs/dev/reports/vector_map_hosted_payload_boot_11_151.txt
4654

4755
Report must include:
48-
- file changed
49-
- exact input path used
56+
- old boot path found
57+
- new direct hosted payload path
5058
- objects verified
5159
- validation result
5260
- strict scope confirmation
5361
- remaining blockers if any
5462

55-
8. Package Codex output ZIP at:
56-
tmp/PR_11_150_FIX_WORKSPACE_VECTOR_MAP_DIRECT_OBJECT_RENDER.zip
63+
10. Package Codex output ZIP at:
64+
tmp/PR_11_151_FIX_VECTOR_MAP_HOSTED_PAYLOAD_BOOT.zip

docs/dev/commit_comment.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
Render Vector Map Editor objects from Workspace Manager direct payload - PR 11.150
1+
Fix Vector Map Editor hosted direct payload boot path - PR 11.151
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
Task: vector_map_hosted_payload_boot_11_151
2+
Date: 2026-04-30
3+
4+
Files changed:
5+
- tools/Vector Map Editor/main.js
6+
- docs/dev/reports/vector_map_hosted_payload_boot_11_151.txt
7+
8+
Old boot path found:
9+
- Vector Map Editor startup path in app start shows default status:
10+
"No map loaded. Load a map preset or import a map JSON document to begin."
11+
- Object-list empty-state text in editor app shows:
12+
"No map objects loaded. Import a map JSON file or launch with a sample preset path."
13+
- Preset boot path is query/preset based in app code (`tryLoadPresetFromQuery`).
14+
15+
New direct hosted payload path:
16+
- Hosted shared context path read in main boot logic:
17+
hostContext.sharedContext.payloadJson.vectorMapDocument
18+
- Render/state source enforced from:
19+
hostContext.sharedContext.payloadJson.vectorMapDocument.objects
20+
21+
Hosted direct payload boot behavior now:
22+
- If valid hosted payload exists (direct `payloadJson.vectorMapDocument` with `objects` array):
23+
1) Boot preloads document model from hosted payload.
24+
2) Boot bypasses preset-query requirement (`tryLoadPresetFromQuery` disabled for this hosted flow).
25+
3) Legacy no-map startup status message is suppressed.
26+
4) Editor state is synchronized and rendered from hosted document objects.
27+
- No samplePresetPath/import path is required for this hosted direct flow.
28+
29+
Objects verified:
30+
- Sample 1902 direct vector map payload contains and passes checks for:
31+
- obj-player-path
32+
- obj-hazard-zone
33+
34+
Validation commands/results:
35+
- node --check "tools/Vector Map Editor/main.js" -> PASS
36+
- rg path checks in main.js for hosted direct payload + objects path + no-map suppression -> PASS
37+
- node JSON check of Sample 1902 object ids -> PASS
38+
- git diff --name-only -- "tools/Vector Map Editor/main.js" "docs/dev/reports/vector_map_hosted_payload_boot_11_151.txt" -> PASS
39+
40+
Strict scope confirmation:
41+
- Modified code only in Vector Map Editor main boot file plus this report.
42+
- No schema/sample/workspace-manager/runtime files modified.
43+
- No fallback/demo/default object injection added.
44+
- No wrapper/transform/normalize logic added for hosted payload shape.
45+
46+
Remaining blockers:
47+
- None in Vector Map Editor hosted boot scope.
48+
- Repository includes unrelated pre-existing dirty files outside this task scope.
Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
# BUILD_PR_LEVEL_11_151_FIX_VECTOR_MAP_HOSTED_PAYLOAD_BOOT
2+
3+
## Purpose
4+
Fix Vector Map Editor boot logic so hosted Workspace Manager launches read the direct hosted `payloadJson.vectorMapDocument` instead of falling back to old preset/import-path messaging.
5+
6+
## Current Failure
7+
Vector Map Editor still shows:
8+
9+
`No map objects loaded. Import a map JSON file or launch with a sample preset path.`
10+
11+
This means the editor is not consuming the hosted direct payload from Workspace Manager.
12+
13+
## STRICT SCOPE
14+
15+
### ALLOWED FILES
16+
- tools/vector-map-editor/main.js
17+
- docs/dev/reports/vector_map_hosted_payload_boot_11_151.txt
18+
19+
### ALLOWED CHANGES
20+
- fix Vector Map Editor hosted-input boot path only
21+
- read direct hosted `payloadJson.vectorMapDocument`
22+
- remove/replace old hosted preset-path requirement for this direct payload path
23+
- create report
24+
25+
## FORBIDDEN
26+
27+
Codex MUST NOT:
28+
- modify schemas
29+
- modify Sample 1902 JSON
30+
- modify Workspace Manager
31+
- modify tool host runtime
32+
- modify other tools
33+
- add fallback/default/demo objects
34+
- re-add preset loading
35+
- transform/wrap/normalize payload
36+
- infer missing vector map data
37+
38+
## Required Behavior
39+
40+
When hosted by Workspace Manager, Vector Map Editor must:
41+
42+
1. Read hosted shared context payload:
43+
- `payloadJson`
44+
2. Use direct document:
45+
- `payloadJson.vectorMapDocument`
46+
3. Load objects from:
47+
- `payloadJson.vectorMapDocument.objects`
48+
4. Render objects directly.
49+
5. If `vectorMapDocument` or `objects` is missing:
50+
- show visible input/schema error
51+
- do NOT show old "launch with sample preset path" message for hosted direct JSON flow
52+
53+
## Required Investigation
54+
55+
Codex must inspect Vector Map Editor for old boot paths that depend on:
56+
57+
- `samplePresetPath`
58+
- preset path query params
59+
- import path only
60+
- file picker/import only
61+
- fallback empty map state
62+
- old sample preset launch text
63+
64+
Do not remove general manual import UI if still valid.
65+
Only fix hosted Workspace Manager direct payload boot.
66+
67+
## Required Validation
68+
69+
Targeted validation only.
70+
71+
Required:
72+
- `tools/vector-map-editor/main.js` syntax passes.
73+
- Hosted payload with:
74+
- `vectorMapDocument.objects[0].id = "obj-player-path"`
75+
- `vectorMapDocument.objects[1].id = "obj-hazard-zone"`
76+
loads into editor state.
77+
- Old message is not shown for valid hosted payload:
78+
`No map objects loaded. Import a map JSON file or launch with a sample preset path.`
79+
- No schema/sample/runtime/workspace files changed.
80+
- `git diff --name-only` contains only ALLOWED FILES.
81+
82+
## Report
83+
84+
Write:
85+
86+
- `docs/dev/reports/vector_map_hosted_payload_boot_11_151.txt`
87+
88+
Report must include:
89+
- file changed
90+
- old boot path found
91+
- new direct hosted payload path
92+
- object ids verified
93+
- validation command/result
94+
- strict scope confirmation
95+
- remaining blockers if any
96+
97+
## Full Samples Smoke Test
98+
99+
Skipped.
100+
101+
Reason:
102+
- targeted Vector Map Editor hosted payload boot fix only
103+
- full samples smoke test takes approximately 20 minutes
104+
105+
## Acceptance
106+
107+
- Vector Map Editor consumes hosted `payloadJson.vectorMapDocument`.
108+
- Sample 1902 vector objects render when opened through Workspace Manager.
109+
- No preset/fallback/demo path is required for hosted direct JSON.

tools/Vector Map Editor/main.js

Lines changed: 41 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,23 +9,36 @@ import { registerToolBootContract } from "../shared/toolBootContract.js";
99
import { readToolHostSharedContextFromLocation } from "../shared/toolHostSharedContext.js";
1010

1111
let vectorMapEditorApp = null;
12+
const DEFAULT_NO_MAP_STATUS = "No map loaded. Load a map preset or import a map JSON document to begin.";
1213

13-
function applyHostedWorkspacePayload(app) {
14-
if (!app || typeof app !== "object") {
15-
return false;
16-
}
14+
function readHostedVectorMapDocument() {
1715
const hostContext = readToolHostSharedContextFromLocation(window.location);
1816
const payloadJson = hostContext?.sharedContext?.payloadJson;
1917
const vectorMapDocument = payloadJson?.vectorMapDocument;
2018
if (!vectorMapDocument || typeof vectorMapDocument !== "object" || Array.isArray(vectorMapDocument)) {
21-
return false;
19+
return null;
2220
}
2321
if (!Array.isArray(vectorMapDocument.objects)) {
22+
return null;
23+
}
24+
return vectorMapDocument;
25+
}
26+
27+
function applyHostedWorkspacePayload(app, vectorMapDocument = null) {
28+
if (!app || typeof app !== "object") {
29+
return false;
30+
}
31+
const hostedVectorMapDocument = vectorMapDocument || readHostedVectorMapDocument();
32+
const objects = hostedVectorMapDocument?.objects;
33+
if (!hostedVectorMapDocument || typeof hostedVectorMapDocument !== "object" || Array.isArray(hostedVectorMapDocument)) {
34+
return false;
35+
}
36+
if (!Array.isArray(objects)) {
2437
return false;
2538
}
2639

2740
app.cancelSpinAnimation?.();
28-
app.documentModel?.setData?.(vectorMapDocument);
41+
app.documentModel?.setData?.(hostedVectorMapDocument);
2942
app.selectionModel?.clear?.();
3043
app.lastCollisionResult = null;
3144
app.historyManager?.reset?.();
@@ -45,9 +58,30 @@ function startVectorMapEditor() {
4558
if (vectorMapEditorApp) {
4659
return vectorMapEditorApp;
4760
}
61+
const hostedVectorMapDocument = readHostedVectorMapDocument();
4862
const app = new VectorMapEditorApp(document);
63+
if (hostedVectorMapDocument) {
64+
const originalSetStatus = typeof app.setStatus === "function" ? app.setStatus.bind(app) : null;
65+
if (originalSetStatus) {
66+
app.setStatus = (message) => {
67+
if (message === DEFAULT_NO_MAP_STATUS) {
68+
return;
69+
}
70+
originalSetStatus(message);
71+
};
72+
}
73+
app.tryLoadPresetFromQuery = async () => false;
74+
app.documentModel?.setData?.(hostedVectorMapDocument);
75+
}
4976
app.start();
50-
applyHostedWorkspacePayload(app);
77+
if (hostedVectorMapDocument) {
78+
applyHostedWorkspacePayload(app, hostedVectorMapDocument);
79+
if (typeof app.setStatus === "function") {
80+
app.setStatus("Loaded hosted workspace payload.");
81+
}
82+
} else {
83+
applyHostedWorkspacePayload(app);
84+
}
5185
vectorMapEditorApp = app;
5286
window.vectorMapEditorApp = app;
5387
return app;

0 commit comments

Comments
 (0)