You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Continue/fix PR_11_304 in `tools/workspace-v2/index.js`for Workspace V2 import/export/save/load session handling.
4
+
Continue/fix PR_11_304 in `tools/workspace-v2/index.js`to enforce manifest-only export with single active palette ownership at `workspace.tools.palettes`.
5
5
6
6
## Scope
7
-
-`tools/workspace-v2/index.js` only
8
-
- No schema changes
9
-
10
-
## Issues Fixed
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:
32
-
-`Invalid session ID. Use letters, numbers, hyphen, or underscore only.`
33
-
- Save remains disabled for invalid IDs via state model.
7
+
-`tools/workspace-v2/index.js`
8
+
-`docs/dev/reports/PR_11_304_report.md`
9
+
- No schema file changes
10
+
11
+
## Changes Implemented
12
+
1. Added strict active palette ownership for export:
13
+
- Export now resolves one active palette from the current active `palette-manager-v2` session only.
14
+
- Export writes the active palette at:
15
+
-`tools.palettes.activePalette`
16
+
- Export blocks when active palette is not available with clear error messaging.
17
+
- Export blocks ambiguous palette context (multiple palette sessions present with no active palette selected).
18
+
19
+
2. Kept manifest-only export contract and removed silent no-op behavior:
20
+
- Export still validates before download.
21
+
- Export continues to reject legacy wrapper shape:
22
+
-`workspaceSession`
23
+
-`workspaceV2Session`
24
+
-`toolSessions`
25
+
-`savedSessions` at root
26
+
-`exportedAt`
27
+
- Export status now surfaces build-time failures using explicit `lastWorkspaceExportBuildErrorMessage`.
28
+
29
+
3. Tightened palette payload validation paths:
30
+
-`palette-manager-v2` payloads continue to require:
31
+
-`paletteJson.swatches`
32
+
-`paletteJson.colors` remains rejected.
33
+
-`payloadJson` remains rejected for `palette-manager-v2`.
34
+
- Swatches are validated as lowercase strict fields:
35
+
-`symbol`
36
+
-`hex`
37
+
-`name`
38
+
- Extra swatch fields are rejected.
39
+
40
+
4. Validator now enforces palette tool manifest entry:
41
+
-`tools.palettes` is required.
42
+
-`tools.palettes.activePalette` is required.
43
+
-`tools.palettes.activePalette.swatches` is validated before export/import acceptance.
44
+
45
+
## Required Rule Coverage
46
+
- No `workspaceSession`: enforced
47
+
- No `games[]`: enforced in export document shape
48
+
- No `palette-manager-v2.payloadJson`: enforced
49
+
- Export validates before download: enforced
50
+
- Exactly one active exported palette at `workspace.tools.palettes`: enforced
0 commit comments