Skip to content

Commit 6bef2b9

Browse files
author
DavidQ
committed
Remove obsolete Workspace schema usage in favor of manifest toolState contract - PR_26140_054-remove-workspace-schema-usage
1 parent 2e8281d commit 6bef2b9

30 files changed

Lines changed: 306 additions & 583 deletions

docs/dev/PLAN_PR.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# PLAN_PR: Move JSON schemas under tools ownership
22

33
## Purpose
4-
Move schema contracts out of the repository root and into the tools area so schema ownership matches the systems that load, edit, validate, and export tool/workspace/sample data.
4+
Move schema contracts out of the repository root and into the tools area so schema ownership matches the systems that load, edit, validate, and export tool/sample data.
55

66
## Scope
77
- Do not change runtime behavior directly.
@@ -15,7 +15,6 @@ Use this structure:
1515
```text
1616
tools/
1717
schemas/
18-
workspace.manifest.schema.json
1918
tool.manifest.schema.json
2019
palette.schema.json
2120
samples/
@@ -35,7 +34,6 @@ Tool-specific schemas live at `tools/schemas/tools/<tool>.schema.json`.
3534
## Acceptance criteria
3635
- No new schema files are added at repository root.
3736
- All JSON schema files are under `tools/schemas/`.
38-
- Workspace manifest validation uses `tools/schemas/workspace.manifest.schema.json`.
3937
- Tool manifest validation uses `tools/schemas/tool.manifest.schema.json`.
4038
- Tool-specific payload validation uses `tools/schemas/tools/<tool>.schema.json`.
4139
- Samples reference the same tool schema contracts used by tool manifests.

docs/dev/PROJECT_INSTRUCTIONS.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -345,17 +345,17 @@ Every PR must document:
345345

346346
## WORKSPACE V2 CURRENT CONTRACT
347347

348-
Workspace manifest is the runtime contract.
348+
Workspace manifest/toolState context is the runtime contract.
349349

350350
Rules:
351-
- workspace manifest is SSoT
351+
- game manifest root.tools is SSoT for persisted tool payloads
352352
- no `workspaceSession`
353353
- no `games[]`
354354
- tools own all tool payloads
355355
- no tool payloads at manifest root
356356
- no hidden fallback data
357357
- no silent defaults
358-
- schema validation is the only acceptance gate
358+
- game manifest validation and toolState payload validation are the acceptance gates; no separate Workspace validation contract is required
359359

360360
Palette:
361361
- exactly one active palette

docs/dev/bundle_readme.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ This ZIP is repo-structured and contains docs-first PR instructions only.
44

55
Files:
66

7-
- `docs/dev/plan_pr_tool_workspace_schema_manifest_boundaries.md`
7+
- `docs/dev/plan_pr_tool_workspace_manifest_boundaries.md`
88
- `docs/dev/codex_commands.md`
99
- `docs/dev/commit_comment.txt`
1010
- `docs/dev/next_command.txt`

docs/dev/plan_pr_tool_workspace_schema_manifest_boundaries.md renamed to docs/dev/plan_pr_tool_workspace_manifest_boundaries.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
# PLAN_PR: Tool / Workspace Schema + Manifest Boundary Cleanup
1+
# PLAN_PR: Tool / Workspace Manifest Boundary Cleanup
22

33
## Purpose
44

5-
Make tool data, sample data, workspace data, palette rules, and valid UI actions explicit through schemas and manifests instead of scattered validation code or hidden payload builders.
5+
Make tool data, sample data, workspace toolState data, palette rules, and valid UI actions explicit through tool schemas, game manifests, and manifest/toolState contract checks instead of scattered validation code or hidden payload builders.
66

77
## Scope
88

@@ -13,15 +13,15 @@ One PR only:
1313
- 3D Camera Path Editor legacy payload assumptions
1414
- 3D JSON payload normalizer legacy assumptions
1515
- Viewer assets being separately saved/exported outside manifests
16-
- Introduce actual `*.schema` files for tool/workspace/sample payload validation.
16+
- Introduce actual `*.schema` files for tool/sample payload validation and keep Workspace Manager context validation on the manifest/toolState contract.
1717
- Clarify palette behavior:
1818
- Samples use named palettes only.
1919
- Samples are locked and cannot mutate palettes.
2020
- Workspaces use duplicated palettes.
2121
- Once a workspace palette swatch is used, that palette cannot be replaced with a different palette.
2222
- Used workspace palettes may allow swatch edits only.
2323
- Other palettes may be viewed for reference/copying swatches into the selected workspace palette.
24-
- Put all workspace-owned assets in `workspace.manifest`.
24+
- Put workspace-owned game assets in the game manifest/toolState payloads.
2525
- Allow only exportable/rendered artifacts such as PNG files to be saved/exported outside the manifest.
2626
- Ensure UI buttons/actions are enabled by loaded context:
2727
- Tool-loaded context enables only tool-valid actions.
@@ -38,11 +38,11 @@ One PR only:
3838

3939
## Desired Manifest Shape
4040

41-
Workspace:
41+
Workspace Manager toolState context:
4242

4343
```json
4444
{
45-
"palette": {},
45+
"gameId": "example-game",
4646
"tools": {
4747
"<tool>": {
4848
"tool data": {}
@@ -67,9 +67,9 @@ The sample payload shape should match the same tool schema used by the tool mani
6767

6868
- `buildDefaultPayload` is no longer required for current tool/sample/workspace loading paths, or it is reduced to a compatibility shim with clear deprecation comments.
6969
- Each active tool has a dedicated schema file.
70-
- Workspace manifest has a schema file.
70+
- Workspace Manager context is validated by the current manifest/toolState contract, with tool payloads validated against their direct tool schemas.
7171
- Sample tool payloads validate against the same schema used by the corresponding tool.
72-
- Viewer/vector assets that belong to a workspace are stored inside `workspace.manifest`.
72+
- Viewer/vector assets that belong to a workspace are stored inside game manifest/toolState payloads.
7373
- PNG or rendered output remains exportable outside the manifest.
7474
- Samples are locked to named palettes and cannot mutate palette data.
7575
- Workspaces duplicate palettes and enforce swatch-use locking rules.
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
# Workspace Schema Removal Report
2+
3+
PR: `PR_26140_054-remove-workspace-schema-usage`
4+
5+
## Summary
6+
- Removed the active Workspace schema file and its runtime validation path.
7+
- Replaced Workspace schema acceptance with direct manifest/toolState contract checks.
8+
- Kept browser `sessionStorage` toolState sessions intact; only obsolete Workspace schema assumptions were removed.
9+
- Preserved Workspace Manager V2 and tool launch behavior.
10+
11+
## Removed Active Workspace Schema Usage
12+
- Deleted `tools/schemas/workspace.manifest.schema.json`.
13+
- Removed `WORKSPACE_MANIFEST_SCHEMA_PATH`, `WORKSPACE_SESSION_SCHEMA_REF`, and `loadWorkspaceManifestSchema()` from Workspace Manager V2.
14+
- Removed root `$schema` emission from generated Workspace Manager contexts and template workspace manifests.
15+
- Removed `workspaceSchemaRef` from workspace-launched tool session metadata.
16+
- Removed Workspace schema fallback from launch-context-only tool sessions.
17+
- Removed the stale current-session Workspace schema export test path.
18+
- Renamed the Workspace schema boundary test to `ToolManifestBoundary` and updated it to guard against the removed schema file.
19+
20+
## Current Acceptance Gates
21+
- Game manifests validate through `tools/schemas/game.manifest.schema.json`.
22+
- Workspace Manager V2 generated contexts validate through an explicit manifest/toolState contract check.
23+
- Tool payloads validate directly against their current tool schemas:
24+
- `tools/schemas/tools/asset-manager-v2.schema.json`
25+
- `tools/schemas/tools/object-vector-studio-v2.schema.json`
26+
- `tools/schemas/tools/palette-manager-v2.schema.json`
27+
- `tools/schemas/tools/text2speech-V2.schema.json`
28+
- Normalized workspace tool sessions keep the existing `schema`, `workspace`, `data`, and `dirty` shape.
29+
30+
## ToolState Save/Load/Import/Export Confirmation
31+
- Workspace Manager V2 still hydrates enabled tool sessions into `sessionStorage`.
32+
- Tool return refresh still writes dirty toolState data back into the active Workspace Manager context.
33+
- Save still validates the game manifest and root `tools` toolState payloads before manifest write-back.
34+
- Text to Speech V2 empty-array save, return, relaunch, and manifest write-back passed targeted validation.
35+
- Text to Speech V2 summary now defaults to `[]`, matching its root-array payload contract during async relaunch.
36+
37+
## Active Reference Audit
38+
- Active search for `workspace schema`, `workspaceSchemaRef`, `workspace.manifest.schema`, `schema-valid workspace`, `workspace manifest schema`, and `schema-only workspace` returned no matches outside excluded historical or out-of-scope locations.
39+
- Excluded locations were `node_modules`, `tests/results`, `docs/dev/reports`, `tmp`, `docs/pr`, `tools/schemas/docs`, `docs/dev/roadmaps`, and `samples`.
40+
- Roadmaps and sample JSON were intentionally left untouched.
41+
42+
## Validation
43+
- PASS: targeted syntax/import validation for changed runtime, tool, script, and test files.
44+
- PASS: template workspace manifest JSON and game manifest schema JSON parse checks.
45+
- PASS: targeted `ToolManifestBoundary` Node validation.
46+
- PASS: targeted `ToolSchemaStrictModeValidation` Node validation.
47+
- PASS: targeted Text to Speech V2 workspace return/write-back Playwright validation.
48+
- PASS: `npm run test:workspace-v2` with 58 passed.
49+
- PASS: `git diff --check`.
50+
51+
## Out Of Scope
52+
- Full samples smoke test was skipped as requested.
53+
- Sample JSON was not modified.
54+
- Roadmap text was not modified.
55+
- Historical schema docs under `tools/schemas/docs` and PR snapshots were not modified.

docs/dev/restart_notes_11_123.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
# Restart Notes — PR 11.123
22

33
Current issue:
4-
- Palette schema details were moved into workspace.manifest.schema.json.
5-
- Revert that. Workspace manifest should reference palette-browser schema, not contain palette internals.
4+
- Palette schema details were moved into the old Workspace validation contract.
5+
- Revert that. Workspace Manager should route palette payloads to the palette tool contract, not contain palette internals in a separate Workspace validation contract.
66

77
Target boundary:
88
- Workspace/game validates parent document only.

games/_template/workspace-manager-v2-UAT.manifest.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
{
2-
"$schema": "tools/schemas/workspace.manifest.schema.json",
32
"documentKind": "workspace-manifest",
43
"schema": "html-js-gaming.project",
54
"version": 1,

games/_template/workspace-manager-v2-template.manifest.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
{
2-
"$schema": "tools/schemas/workspace.manifest.schema.json",
32
"documentKind": "workspace-manifest",
43
"schema": "html-js-gaming.project",
54
"version": 1,

scripts/validate-json-contracts.mjs

Lines changed: 3 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -551,55 +551,6 @@ function validateToolPayloadShallow(toolId, payload, schema, pointer) {
551551
return errors;
552552
}
553553

554-
function validateWorkspaceManifestShallow(document, schemaIndex) {
555-
const errors = [];
556-
const workspaceSchemaPath = "tools/schemas/workspace.manifest.schema.json";
557-
const workspaceSchema = schemaIndex.get(workspaceSchemaPath);
558-
if (!workspaceSchema) {
559-
return [`missing schema ${workspaceSchemaPath}`];
560-
}
561-
if (!isPlainObject(document)) {
562-
return ["workspace manifest must be an object"];
563-
}
564-
565-
const requiredTopLevel = new Set(Array.isArray(workspaceSchema.required) ? workspaceSchema.required : []);
566-
const topLevelProps = isPlainObject(workspaceSchema.properties) ? workspaceSchema.properties : {};
567-
568-
Object.keys(document).forEach((key) => {
569-
if (!(key in topLevelProps)) {
570-
errors.push(`root.${key} is not allowed by workspace.manifest schema`);
571-
}
572-
});
573-
requiredTopLevel.forEach((key) => {
574-
if (!(key in document)) {
575-
errors.push(`root.${key} is required by workspace.manifest schema`);
576-
}
577-
});
578-
579-
if (!isPlainObject(document.tools)) {
580-
errors.push("root.tools must be an object");
581-
return errors;
582-
}
583-
584-
const toolsSchema = topLevelProps.tools;
585-
const allowedToolIds = new Set(Object.keys(isPlainObject(toolsSchema?.properties) ? toolsSchema.properties : {}));
586-
Object.keys(document.tools).forEach((toolId) => {
587-
if (!allowedToolIds.has(toolId)) {
588-
errors.push(`root.tools.${toolId} is not allowed by workspace.manifest schema`);
589-
return;
590-
}
591-
const toolSchemaPath = schemaPathForToolId(toolId);
592-
const toolSchema = schemaIndex.get(toolSchemaPath);
593-
if (!toolSchema) {
594-
errors.push(`missing schema for tool ${toolId}: ${toolSchemaPath}`);
595-
return;
596-
}
597-
errors.push(...validateToolPayloadShallow(toolId, document.tools[toolId], toolSchema, `root.tools.${toolId}`));
598-
});
599-
600-
return errors;
601-
}
602-
603554
function validateSamples(schemaIndex, validate) {
604555
const sampleFiles = walkFiles(path.join(ROOT, "samples"), (filePath) => filePath.endsWith(".json"));
605556
const rows = [];
@@ -616,7 +567,8 @@ function validateSamples(schemaIndex, validate) {
616567
const isWorkspaceManifest = String(document?.documentKind || "").trim() === "workspace-manifest"
617568
|| String(document?.schema || "").trim().toLowerCase() === "html-js-gaming.project";
618569
if (isWorkspaceManifest) {
619-
schemaPath = "tools/schemas/workspace.manifest.schema.json";
570+
rows.push({ filePath: rel, schemaPath: "", status: "skipped", errorCount: 0, firstErrors: "", note: "separate workspace validation contract removed; sample workspace JSON is out of scope" });
571+
return;
620572
} else if (typeof document?.tool === "string") {
621573
schemaPath = schemaPathForToolId(document.tool);
622574
}
@@ -645,9 +597,7 @@ function validateSamples(schemaIndex, validate) {
645597
return document;
646598
})();
647599

648-
const errors = schemaPath === "tools/schemas/workspace.manifest.schema.json"
649-
? validateWorkspaceManifestShallow(normalizedDocument, schemaIndex)
650-
: validate(normalizedDocument, schema, schemaPath, "$");
600+
const errors = validate(normalizedDocument, schema, schemaPath, "$");
651601
rows.push({
652602
filePath: rel,
653603
schemaPath,

tests/playwright/tools/AssetManagerV2.spec.mjs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1371,7 +1371,7 @@ test.describe("Asset Manager V2", () => {
13711371
try {
13721372
await expect(page.locator("#assetLaunchGuard")).toBeVisible();
13731373
await expect(page.locator("#assetLaunchGuardMessage")).toHaveText("Asset Manager V2 is only available through Workspace Manager with a game manifest and palette.");
1374-
await expect(page.locator("#assetLaunchGuardReason")).toContainText("Workspace Manager V2 launch requires a schema-valid workspace manifest.");
1374+
await expect(page.locator("#assetLaunchGuardReason")).toContainText("Workspace Manager V2 launch requires a valid manifest/toolState context.");
13751375
await expect(page.locator("body")).toHaveClass(/asset-manager-v2--launch-blocked/);
13761376
expect(pageErrors).toEqual([]);
13771377
} finally {
@@ -1380,7 +1380,7 @@ test.describe("Asset Manager V2", () => {
13801380
}
13811381
});
13821382

1383-
test("launches Asset Manager V2 from Workspace Manager V2 with schema-valid context and workspace return nav", async ({ page }) => {
1383+
test("launches Asset Manager V2 from Workspace Manager V2 with valid manifest context and workspace return nav", async ({ page }) => {
13841384
const server = await openWorkspaceManagerV2(page, {
13851385
assetFiles: [
13861386
{

0 commit comments

Comments
 (0)