Skip to content

Commit fb00cd8

Browse files
author
DavidQ
committed
Stabilize active game lifecycle controls and dirty-state actions - PR_26130_034-active-game-lifecycle-controls
1 parent 9501397 commit fb00cd8

16 files changed

Lines changed: 434 additions & 88 deletions

docs/dev/codex_commands.md

Lines changed: 52 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,71 @@
1-
# Codex Commands - PR_26126_037-preview-generator-v2-remove-shared-and-consolidate-common
1+
# Codex Commands - PR_26130_034-active-game-lifecycle-controls
22

3-
```bash
4-
codex run "Create PR_26126_037-preview-generator-v2-remove-shared-and-consolidate-common. Fix Preview Generator V2 based on audit findings. Preserve existing behavior exactly. Remove all tools/shared dependencies from Preview Generator V2, consolidate safe repeated CSS declarations into common styles, update Preview Generator V2 to consume those common styles, verify Playwright, do not modify samples, do not add schema, do not modify start_of_day folders, and produce required reports."
3+
```text
4+
codex
5+
6+
Changes:
7+
Create PR_26130_034-active-game-lifecycle-controls.
8+
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.
18+
No unrelated files.
19+
No start_of_day changes.
20+
21+
Validation:
22+
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.
24+
Do not run full samples smoke test; document skipped reason.
25+
26+
Required reports:
27+
Create docs/dev/reports/codex_review.diff.
28+
Create docs/dev/reports/codex_changed_files.txt.
29+
Create docs/dev/reports/PR_26130_034-active-game-lifecycle-controls.md.
30+
Update docs/dev/codex_commands.md.
31+
Update docs/dev/commit_comment.txt.
32+
Produce required repo-structured ZIP under tmp/.
533
```
634

735
## Validation Commands
836

937
```powershell
10-
rg -n "tools/shared|../shared|../../tools/shared|platformShell|shared/" tools/preview-generator-v2 tools/common tests/playwright/PreviewGeneratorV2Baseline.spec.mjs
11-
if ($LASTEXITCODE -eq 1) { Write-Output "no tools/shared references found"; $global:LASTEXITCODE = 0 }
12-
rg -n "<link|<script|import .* from" tools/preview-generator-v2 tools/common tests/playwright/PreviewGeneratorV2Baseline.spec.mjs
13-
14-
$files = Get-ChildItem -Path tools/preview-generator-v2 -Recurse -Filter *.js | Select-Object -ExpandProperty FullName
15-
foreach ($file in $files) {
16-
node --check $file
17-
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
18-
}
19-
node --check tests/playwright/PreviewGeneratorV2Baseline.spec.mjs
20-
npx playwright test tests/playwright/PreviewGeneratorV2Baseline.spec.mjs --project=playwright --reporter=list
21-
git status --short -- samples tools/schemas start_of_day tests/results
22-
git diff --check -- tools/preview-generator-v2 tools/common tests/playwright docs/dev/codex_commands.md docs/dev/commit_comment.txt docs/dev/reports/preview_generator_v2_shared_removed.txt docs/dev/reports/preview_generator_v2_common_styles_applied.txt docs/dev/reports/preview_generator_v2_playwright_result.txt
38+
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"
2343
npm run test:workspace-v2
44+
npm run codex:review-artifacts
2445
```
2546

2647
## Playwright
2748

28-
Playwright validates that Preview Generator V2 launches, the main shell/menu/status controls render, Generate Preview and Stop start disabled, Games is the default target source, a working accordion collapses/reopens, the common stylesheet loads, and the consolidated common style declarations are active.
49+
Playwright impacted: Yes.
2950

30-
Expected pass behavior: the targeted Playwright test passes with one launched tool page and no page errors.
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.
3152

32-
Expected fail behavior: the test fails if the tool cannot load, controls are missing, common styles are not applied, accordion behavior is broken, or page errors are emitted.
53+
Expected pass behavior: all Workspace Manager V2 Playwright tests pass with no page errors and the lifecycle buttons match dirty state.
54+
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.
3356

3457
## Test Notes
3558

36-
`npm run test:workspace-v2` is not defined in the current `package.json`.
59+
`npm run test:workspace-v2` passed: 20 passed.
3760

38-
## Manual Test
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.
3962

40-
Open `tools/preview-generator-v2/index.html`, confirm the tool shell looks unchanged, toggle Repo Destination, use Hide Header and Details/Show Header and Details, and confirm Generate Preview remains visible but disabled before required fields are complete.
63+
## Manual Test
4164

42-
Full samples smoke test was skipped because this PR does not modify samples or shared sample loading.
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.

docs/dev/commit_comment.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
Consolidate Preview Generator V2 shell styles without tools/shared - PR_26126_037-preview-generator-v2-remove-shared-and-consolidate-common
1+
Add active game lifecycle controls for Workspace V2 toolState flows - PR_26130_034-active-game-lifecycle-controls
Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
# PR_26130_034-active-game-lifecycle-controls
2+
3+
## Scope
4+
5+
- Workspace Manager V2 active game lifecycle controls.
6+
- Preview Generator V2 workspace-launched repo/game target locking.
7+
- Workspace V2 Playwright coverage for lifecycle control state transitions.
8+
9+
## Changes
10+
11+
- Added Active Game bottom controls: Save, Close, and Cancel.
12+
- Locked repo destination and game selection after an active toolState opens.
13+
- Save is enabled only when dirty toolState data exists.
14+
- Close is enabled only when active toolState data is clean.
15+
- Cancel warns with a confirmation dialog before discarding dirty toolState data.
16+
- Updated touched Workspace Manager V2 lifecycle code to use active toolState terminology.
17+
- Locked Preview Generator V2 workspace launch repo and game target controls.
18+
19+
## Playwright
20+
21+
Playwright impacted: Yes.
22+
23+
Validated by `npm run test:workspace-v2`.
24+
25+
Coverage added/updated:
26+
27+
- Opened-game control disabling.
28+
- Dirty-state Save/Close enabled and disabled states.
29+
- Close clearing clean active toolState data.
30+
- Cancel dirty warning with dismissal and confirmation paths.
31+
- Preview Generator V2 workspace launch repo/game target lock.
32+
33+
Expected pass behavior: Workspace Manager V2 and Preview Generator V2 lifecycle controls remain locked after toolState open, dirty state drives Save/Close correctly, Close only clears clean state, and Cancel requires confirmation before dirty discard.
34+
35+
Expected fail behavior: Playwright fails if controls remain editable after open, Save/Close dirty state is inverted, Close clears dirty data, or Cancel discards dirty data without confirmation.
36+
37+
## Validation
38+
39+
- `node --check tools/workspace-manager-v2/js/WorkspaceManagerV2App.js` - PASS.
40+
- `node --check tools/workspace-manager-v2/js/controls/GameSelectorControl.js` - PASS.
41+
- `node --check tools/preview-generator-v2/PreviewGeneratorV2App.js` - PASS.
42+
- `node --check tests/playwright/tools/WorkspaceManagerV2.spec.mjs` - PASS.
43+
- `npm run test:workspace-v2` - PASS, 20 passed.
44+
45+
Initial `npm run test:workspace-v2` run failed because the new Cancel test used a rejected palette swatch symbol fixture. The fixture was corrected and the final required validation passed.
46+
47+
## Coverage
48+
49+
Playwright V8 coverage report: `docs/dev/reports/playwright_v8_coverage_report.txt`.
50+
51+
Changed runtime JavaScript files are listed in the coverage report. Missing changed runtime JavaScript coverage is advisory and would be reported as WARN by the existing guardrail.
52+
53+
## Full Samples Smoke
54+
55+
Skipped. Reason: this PR is limited to Workspace Manager V2 / Preview Generator V2 lifecycle controls and does not modify shared sample loading, sample JSON, or broad sample runtime behavior.
56+
57+
## Manual Validation
58+
59+
1. Open Workspace Manager V2.
60+
2. Pick the repo folder and select a game.
61+
3. Confirm repo destination selection and game dropdown are disabled after the game/toolState opens.
62+
4. Confirm clean state disables Save and enables Close.
63+
5. Launch an editor tool, make a dirty change, and return.
64+
6. Confirm dirty state enables Save and disables Close.
65+
7. Click Cancel, dismiss the warning, and confirm the active toolState remains.
66+
8. Click Cancel again, accept the warning, and confirm the active toolState clears.
67+
9. Reopen a game, Save dirty data, then Close clean state and confirm the active toolState clears.
68+
69+
## Out Of Scope
70+
71+
- No start_of_day changes.
72+
- No sample JSON changes.
73+
- No full samples smoke test.
74+
- No engine core changes.

0 commit comments

Comments
 (0)