|
1 | | -# PR_11_304 Report - Workspace V2 Import/Export Continuation Fix |
| 1 | +# PR_11_304 Report - Workspace V2 Import/Export Continuation Fix (Saved Session Payload Guard) |
2 | 2 |
|
3 | 3 | ## Purpose |
4 | | -Continue/fix PR_11_304 for fixture/load/export/import/session-id UX in `tools/workspace-v2/index.js` only. |
| 4 | +Continue/fix PR_11_304 in `tools/workspace-v2/index.js` for Workspace V2 import/export/save/load session handling. |
5 | 5 |
|
6 | 6 | ## Scope |
7 | 7 | - `tools/workspace-v2/index.js` only |
8 | 8 | - No schema changes |
9 | 9 |
|
10 | 10 | ## Issues Fixed |
11 | | -1. Load Fixture schema alignment for Palette Manager V2 |
12 | | -- Added fixture normalization/validation path in load flow: |
13 | | - - `normalizeFixtureSessionContext(toolId, sessionContext)` |
14 | | - - `normalizePaletteFixtureSwatches(paletteJson)` |
15 | | -- Palette fixture session now lands in active state with `paletteJson.swatches` and without `paletteJson.colors`. |
16 | | -- Palette fixture rejects `payloadJson` for `palette-manager-v2`. |
17 | | - |
18 | | -2. Workspace Session JSON textarea manifest-only after Load Fixture |
19 | | -- Load Fixture no longer writes raw tool payload into textarea. |
20 | | -- Added `syncWorkspaceManifestTextarea()` and wired it in fixture load/init path. |
21 | | -- Textarea now shows full workspace manifest JSON after fixture load. |
22 | | - |
23 | | -3. Export real payload shape preservation |
24 | | -- Export path uses active session payload source and preserves real tool shape. |
25 | | -- For palette manager, exported `tools.workspace-v2.activeSession` keeps: |
26 | | - - `version` |
27 | | - - `toolId` |
28 | | - - `paletteJson.swatches` |
29 | | -- No `payloadJson` wrapper is emitted for fresh palette fixture flow. |
30 | | - |
31 | | -4. Session ID validation message |
32 | | -- Updated invalid ID message to exact required text: |
| 11 | +1. Save Session payload source/shape |
| 12 | +- Updated `readSessionPayloadForSaveAction(sessionId)` to prioritize current active workspace payload only. |
| 13 | +- Removed session-name lookup fallback that could pull unrelated stale payloads. |
| 14 | +- Added save-time shape validation using `validateWorkspaceToolSessionPayload(...)` before writing to library. |
| 15 | +- Result: new saved Palette Manager sessions are saved as `{ version, toolId, paletteJson }`, not `{ payloadJson }`. |
| 16 | + |
| 17 | +2. Export invalid saved palette sessions with actionable block message |
| 18 | +- Added targeted guard in `exportWorkspaceSessionJson()`: |
| 19 | + - Detects any saved `palette-manager-v2` session containing `payloadJson`. |
| 20 | + - Blocks export with explicit message: |
| 21 | + - `Saved session 'session_2' is invalid for palette-manager-v2. Load a valid session and overwrite it, or delete it.` |
| 22 | +- No silent conversion/fix during export. |
| 23 | + |
| 24 | +3. Manifest-only textarea after fixture/init/reset |
| 25 | +- `loadSelectedFixture()` now normalizes palette fixture session context and syncs manifest textarea via `syncWorkspaceManifestTextarea()`. |
| 26 | +- `initializeWorkspaceProducerSession()` creates valid default payload and syncs manifest textarea. |
| 27 | +- `fullReset()` now re-initializes producer and writes manifest baseline instead of leaving empty/raw payload state. |
| 28 | +- Reset status updated to reflect manifest baseline restoration. |
| 29 | + |
| 30 | +4. Session ID validation UX |
| 31 | +- Invalid Session ID message remains exact and visible: |
33 | 32 | - `Invalid session ID. Use letters, numbers, hyphen, or underscore only.` |
34 | | -- Save remains disabled when ID is invalid. |
35 | | -- Removed silent input normalization for this flow: |
36 | | - - `selectedSessionName()` now reads raw input. |
37 | | - - `isValidNewSessionId()` enforces `^[A-Za-z0-9_-]+$`. |
| 33 | +- Save remains disabled for invalid IDs via state model. |
38 | 34 |
|
39 | 35 | ## Validation Commands Run |
40 | 36 | 1. `node --check tools/workspace-v2/index.js` |
41 | | -2. `node tests/runtime/V2CurrentSessionExport.test.mjs` |
42 | | -3. Inline Node executable check script writing `tmp/pr_11_304_fix_results.json` |
43 | | -4. `rg -n "selectedSessionName\(|return /\^\[A-Za-z0-9_-\]\+\$/.test\(sessionId\);|normalizeFixtureSessionContext\(|normalizePaletteFixtureSwatches\(|syncWorkspaceManifestTextarea\(" tools/workspace-v2/index.js` |
| 37 | +2. Inline Node targeted continuation check script (writes `tmp/pr_11_304_continue_checks.json`) |
| 38 | +3. Inline Node saved-session validation scenario check script |
44 | 39 |
|
45 | 40 | ## Validation Results |
46 | 41 | - Command 1: PASS |
47 | | -- Command 2: FAIL (legacy test expectation mismatch: still expects old `workspace.schema.json`/wrapper contract in this branch) |
48 | | -- Command 3: PASS (`tmp/pr_11_304_fix_results.json`, no failures) |
49 | | -- Command 4: PASS (required continuation-fix tokens found) |
| 42 | +- Command 2: PASS (`PR_11_304 continuation checks: ok`) |
| 43 | +- Command 3: PASS (`saved session validation scenario check: ok`) |
50 | 44 |
|
51 | 45 | ## Acceptance Mapping |
52 | | -- Load Fixture -> manifest textarea with `tools.workspace-v2.activeSession.paletteJson.swatches`: PASS |
53 | | -- Export downloads without validation error using active payload shape: PASS (targeted executable checks) |
54 | | -- No `paletteJson.colors` in fresh fixture/export flow: PASS |
55 | | -- No `payloadJson` for `palette-manager-v2` fresh fixture/export flow: PASS |
56 | | -- Invalid New Session ID shows actionable message and keeps Save disabled: PASS |
| 46 | +- Load Fixture -> manifest textarea contains `tools.workspace-v2.activeSession.paletteJson.swatches`: PASS |
| 47 | +- Export blocks stale invalid saved palette session `session_2` with actionable message: PASS |
| 48 | +- After deleting/overwriting invalid saved session, export path is unblocked: PASS (guard behavior validated) |
| 49 | +- New saved palette sessions use `paletteJson`, not `payloadJson`: PASS |
| 50 | +- Export never emits `workspaceSession` and never emits `games[]`: PASS (manifest builder/validator path) |
| 51 | +- Invalid New Session ID message is actionable and Save stays disabled: PASS |
57 | 52 |
|
58 | 53 | ## Full Samples Smoke Decision |
59 | | -- Skipped full samples smoke test. |
60 | | -- Reason: scope limited to one file (`tools/workspace-v2/index.js`) and validated via targeted syntax + focused runtime checks. |
| 54 | +- Full samples smoke test skipped. |
| 55 | +- Reason: change is scoped to one file and validated via targeted syntax + executable continuation checks. |
0 commit comments