Skip to content

Commit 5421677

Browse files
author
DavidQ
committed
Move workspace lifecycle actions to header and validate save writes - PR_26130_001-workspace-header-save-validation
1 parent fb00cd8 commit 5421677

11 files changed

Lines changed: 432 additions & 321 deletions

docs/dev/codex_commands.md

Lines changed: 31 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,71 +1,65 @@
1-
# Codex Commands - PR_26130_034-active-game-lifecycle-controls
1+
# Codex Commands - PR_26130_001-workspace-header-save-validation
22

33
```text
44
codex
55
66
Changes:
7-
Create PR_26130_034-active-game-lifecycle-controls.
7+
Create PR_26130_001-workspace-header-save-validation.
88
Read docs/dev/PROJECT_INSTRUCTIONS.md first.
9-
Limit scope to Workspace Manager V2 / Preview Generator V2 lifecycle controls.
10-
Once a game/tool state is opened, disable repo destination selection and game dropdown.
11-
In Active Game bottom controls, add Save, Close, and Cancel buttons.
12-
Save button must be disabled when dirty is false and enabled when dirty is true.
13-
Close button must be disabled when dirty is true and enabled when dirty is false.
14-
Close clears the active session/toolState variable only when allowed.
15-
Cancel must warn the user that information will be lost when dirty is true, then clear the active session/toolState only after confirmation.
16-
Use toolState terminology in code/docs where applicable.
17-
No silent fallback.
9+
Remove Workspace header nav buttons that are no longer needed.
10+
Move Save, Close, and Cancel into the Workspace header nav.
11+
Fix Save so it writes the active game/toolState file and validates the file after write.
12+
After Save, log saved path, file size, item/count details, and validation result.
13+
Investigate whether repoPath is used anywhere. If used, document exact usage in the PR report. If unused, document that finding only.
14+
Keep scope limited to Workspace Manager V2 / Preview Generator V2 lifecycle and save validation.
1815
No unrelated files.
1916
No start_of_day changes.
2017
2118
Validation:
2219
Run npm run test:workspace-v2.
23-
Add/update Playwright coverage for opened-game control disabling, dirty-state Save/Close state, Close clearing clean state, and Cancel dirty warning.
20+
Add/update Playwright tests for header Save/Close/Cancel placement, save write verification, dirty-state button behavior, and post-save log details.
2421
Do not run full samples smoke test; document skipped reason.
2522
2623
Required reports:
2724
Create docs/dev/reports/codex_review.diff.
2825
Create docs/dev/reports/codex_changed_files.txt.
29-
Create docs/dev/reports/PR_26130_034-active-game-lifecycle-controls.md.
26+
Create docs/dev/reports/PR_26130_001-workspace-header-save-validation.md.
3027
Update docs/dev/codex_commands.md.
3128
Update docs/dev/commit_comment.txt.
3229
Produce required repo-structured ZIP under tmp/.
3330
```
3431

35-
## Validation Commands
32+
## Commands Run
3633

3734
```powershell
3835
Get-Content -Path "docs/dev/PROJECT_INSTRUCTIONS.md"
39-
node --check "tools/workspace-manager-v2/js/WorkspaceManagerV2App.js"
40-
node --check "tools/workspace-manager-v2/js/controls/GameSelectorControl.js"
41-
node --check "tools/preview-generator-v2/PreviewGeneratorV2App.js"
42-
node --check "tests/playwright/tools/WorkspaceManagerV2.spec.mjs"
36+
Get-Content -Path ".codex/skills/repo-build/SKILL.md"
37+
git status --short
38+
rg -n "repoPath" tools/workspace-manager-v2 tools/preview-generator-v2 tools/asset-manager-v2 tools/schemas games tests/playwright/tools/WorkspaceManagerV2.spec.mjs
39+
rg -n "exportWorkspaceManifest|importWorkspaceManifest|onExportManifest|onImportManifest|setExportEnabled|exportManifestButton|importManifest|activeGame(Save|Close|Cancel)Button|workspace-manager-v2__active-game-controls" tools/workspace-manager-v2 tests/playwright/tools/WorkspaceManagerV2.spec.mjs
40+
npm run test:workspace-v2
41+
npm run test:workspace-v2
4342
npm run test:workspace-v2
44-
npm run codex:review-artifacts
4543
```
4644

47-
## Playwright
48-
49-
Playwright impacted: Yes.
50-
51-
`npm run test:workspace-v2` validates that opened Workspace Manager V2 game toolState locks repo destination and game selection, Preview Generator V2 workspace launch locks repo/game target controls, dirty toolState enables Save and disables Close, clean toolState disables Save and enables Close, Close clears clean active toolState data, and Cancel warns before discarding dirty toolState data.
45+
## Validation
5246

53-
Expected pass behavior: all Workspace Manager V2 Playwright tests pass with no page errors and the lifecycle buttons match dirty state.
47+
`npm run test:workspace-v2` was attempted once with a 120 second command timeout and was cut off before Playwright returned a result.
5448

55-
Expected fail behavior: the test fails if repo/game controls remain editable after opening a toolState, Save/Close invert dirty behavior, Close clears dirty data, or Cancel clears dirty data without confirmation.
49+
`npm run test:workspace-v2` was rerun with a longer timeout and passed: 19 passed.
5650

57-
## Test Notes
51+
After removing the now-unreachable import/export app methods, `npm run test:workspace-v2` was run again and passed: 19 passed.
5852

59-
`npm run test:workspace-v2` passed: 20 passed.
53+
Full samples smoke test skipped because this PR is limited to Workspace Manager V2 / Preview Generator V2 lifecycle controls and save validation, and does not modify sample manifests broadly, shared sample loading, or runtime sample smoke behavior.
6054

61-
Full samples smoke test skipped because this PR is limited to Workspace Manager V2 / Preview Generator V2 lifecycle controls and does not modify shared sample loading, sample JSON, or broadly impacted sample runtime behavior.
55+
## Playwright Coverage
6256

63-
## Manual Test
57+
Updated `tests/playwright/tools/WorkspaceManagerV2.spec.mjs` covers:
6458

65-
1. Open Workspace Manager V2.
66-
2. Pick the repo folder and select Asteroids.
67-
3. Confirm Pick Repo Folder and the game selector are disabled, Save is disabled, Close is enabled, and Cancel is enabled.
68-
4. Launch Palette Manager V2, make a palette edit, and return to Workspace Manager V2.
69-
5. Confirm Save is enabled, Close is disabled, and Cancel warns before discarding dirty toolState data.
70-
6. Save, then confirm Save is disabled and Close is enabled.
71-
7. Close and confirm the active game/toolState clears and repo/game selection can start over.
59+
- Header Save, Close, and Cancel placement with Import/Export header actions removed.
60+
- Opened-game disabling for repo destination selection and the game dropdown.
61+
- Dirty-state lifecycle behavior: Save enabled and Close disabled while dirty; Save disabled and Close enabled after save.
62+
- Save write verification against the active `game.manifest.json` toolState file.
63+
- Post-save logs for saved path, file size, toolState item/count details, and validation result.
64+
- Close clearing clean toolState state.
65+
- Cancel warning before dirty toolState data is discarded.

docs/dev/commit_comment.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
Add active game lifecycle controls for Workspace V2 toolState flows - PR_26130_034-active-game-lifecycle-controls
1+
Move Workspace Manager V2 lifecycle controls into the header and validate active toolState saves - PR_26130_001-workspace-header-save-validation
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
# PR_26130_001-workspace-header-save-validation
2+
3+
## Summary
4+
5+
- Moved Workspace Manager V2 lifecycle actions into the header nav as Save, Close, and Cancel.
6+
- Removed the now-obsolete Import Manifest and Export Manifest header buttons, and removed the old Active Game bottom lifecycle controls.
7+
- Save now refreshes active toolState from normalized workspace tool sessions, writes it into the active game `game.manifest.json` under `game.workspace`, reads the file back, and validates both the game manifest and workspace toolState after write.
8+
- Save logs the saved path, file size, toolState item/count details, and validation result.
9+
- Close remains allowed only for clean toolState; Cancel warns before discarding dirty or unknown toolState.
10+
11+
## Validation
12+
13+
- `npm run test:workspace-v2`
14+
- First attempt timed out at the command wrapper's 120 second limit before a Playwright result was returned.
15+
- Rerun with a longer timeout passed: 19 passed.
16+
- Final rerun after removing unreachable import/export app methods passed: 19 passed.
17+
18+
Full samples smoke test skipped because this PR is limited to Workspace Manager V2 / Preview Generator V2 lifecycle controls and save validation, and does not modify shared sample loading or broad sample runtime behavior.
19+
20+
## repoPath Usage
21+
22+
`repoPath` is used.
23+
24+
- `tools/workspace-manager-v2/js/services/WorkspaceManagerV2ContextService.js:849`: `contextResultFromManifest` copies `workspaceManifest.repoPath || ""` onto the active game metadata as `game.repoPath`.
25+
- `tools/preview-generator-v2/PreviewGeneratorV2App.js:1449`: workspace launch hydration calls `normalizeAbsoluteRepoPath(manifest.repoPath)` to derive the workspace repo root path when present.
26+
- `tools/asset-manager-v2/js/services/WorkspaceBridge.js:87`: workspace context extra-field filtering treats `repoPath` as an allowed root field.
27+
- `tools/schemas/workspace.manifest.schema.json:49` and `tools/schemas/game.manifest.schema.json:136`: schemas define `repoPath`.
28+
- Current game/workspace manifests persist `repoPath` in `games/Asteroids/game.manifest.json:27`, `games/GravityWell/game.manifest.json:27`, `games/Pong/game.manifest.json:27`, and `games/_template/workspace-manager-v2-UAT.manifest.json:12`.
29+
- Workspace Manager V2 Playwright coverage asserts `repoPath` is preserved in active contexts and not used as a silent Preview Generator V2 fallback when the required workspace repo session reference is missing.
30+
31+
## Changed Files
32+
33+
- `tools/workspace-manager-v2/index.html`
34+
- `tools/workspace-manager-v2/js/bootstrap.js`
35+
- `tools/workspace-manager-v2/js/WorkspaceManagerV2App.js`
36+
- `tools/workspace-manager-v2/js/controls/GameSelectorControl.js`
37+
- `tools/workspace-manager-v2/js/controls/ManifestMenuControl.js`
38+
- `tools/workspace-manager-v2/js/services/WorkspaceManagerV2ContextService.js`
39+
- `tools/workspace-manager-v2/styles/workspaceManagerV2.css`
40+
- `tests/playwright/tools/WorkspaceManagerV2.spec.mjs`
41+
- `docs/dev/codex_commands.md`
42+
- `docs/dev/commit_comment.txt`
43+
- `docs/dev/reports/codex_review.diff`
44+
- `docs/dev/reports/codex_changed_files.txt`
45+
- `docs/dev/reports/PR_26130_001-workspace-header-save-validation.md`
46+
47+
## Notes
48+
49+
- Save has no silent fallback: it requires the active writable repo folder handle and the active `game.manifest.json` source.
50+
- Preview Generator V2 lifecycle coverage remains in the targeted Workspace Manager V2 Playwright suite, including workspace launch repo/game control disabling and missing repo session handling.

0 commit comments

Comments
 (0)