Skip to content

Commit de89e49

Browse files
author
DavidQ
committed
Fix next failing tool from audit to enforce strict Workspace V2 contract - PR_26124_002-tool-fix-next-audit
1 parent 6740a48 commit de89e49

6 files changed

Lines changed: 83 additions & 1 deletion

File tree

docs/dev/codex_commands.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -278,3 +278,10 @@ PR_26123_001-project-instructions-update
278278
```bash
279279
npx @openai/codex run --model gpt-5.3-codex --reasoning medium "Implement PROJECT_INSTRUCTIONS update: add PR naming standard, update ChatGPT output contract (command + commit comment + Playwright coverage + manual test steps), and enforce ChatGPT non-ZIP ownership language while keeping Codex ZIP ownership intact."
280280
```
281+
282+
---
283+
PR_26124_002-palette-manager-strict-payload-guard
284+
285+
```bash
286+
npx @openai/codex run --model gpt-5.3-codex --reasoning medium "Implement PR_26124_002: fix the next failing tool from tool_completion_audit.md with a minimal single-tool palette-manager-v2 guard that rejects legacy payloadJson.paletteDocument.colors before render and validates required swatches contract."
287+
```

docs/dev/commit_comment.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
Add PR naming standard and tighten ChatGPT output contract (command, commit, Playwright coverage, manual tests) with Codex-only ZIP ownership - PR_26123_001-project-instructions-update
1+
Reject legacy paletteDocument.colors in Palette Manager V2 before render and require swatches contract - PR_26124_002-palette-manager-strict-payload-guard
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# PR_26124_002 Report
2+
3+
## Scope
4+
- Exactly one tool updated: `palette-manager-v2`
5+
- No schema changes
6+
- No other tool changes
7+
8+
## Change
9+
- File: `tools/palette-manager-v2/index.js`
10+
- Added pre-render invalid JSON guard:
11+
- reject `payloadJson.paletteDocument.colors`
12+
- require `payloadJson.paletteDocument.swatches`
13+
- visible actionable error emitted before render
14+
15+
## Requirements Check
16+
- Valid JSON (`payloadJson.paletteDocument.swatches`) still loads and renders.
17+
- Invalid JSON (`payloadJson.paletteDocument.colors`) now rejects before render with clear visible error.
18+
- No fallback/default injection added.
19+
- Workspace payload contract remains `payloadJson` and read-only in this tool.
20+
- Launch paths unchanged (sample/workspace).
21+
22+
## Validation
23+
- `node --check tools/palette-manager-v2/index.js` -> PASS
24+
- `npm run test:workspace-v2` -> PASS
25+
- `Workspace V2 Playwright Gate Summary: passed=1 failed=0`
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# BUILD_PR — PR_26124_002
2+
3+
## Scope
4+
- Single tool only: `palette-manager-v2`
5+
- Minimal surgical fix
6+
7+
## Implemented
8+
- Added strict validation in `loadContract`:
9+
- if `payloadJson.paletteDocument.colors` exists, reject session before render with a clear error:
10+
- `payloadJson.paletteDocument.colors is not supported; use payloadJson.paletteDocument.swatches.`
11+
12+
## Why
13+
- Keeps payload contract strict and deterministic.
14+
- Prevents legacy invalid palette JSON from rendering.
15+
16+
## Validation
17+
- `node --check tools/palette-manager-v2/index.js` -> PASS
18+
- `npm run test:workspace-v2` -> PASS (`1 passed`, `failed=0`)
19+
20+
## Samples Smoke
21+
- Skipped by design.
22+
- Reason: single-tool runtime guard update with targeted validation and no shared sample framework changes.
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# PLAN_PR — PR_26124_002
2+
3+
## Goal
4+
Fix the next failing tool from `tool_completion_audit.md` with a minimal single-tool change.
5+
6+
## Tool
7+
- `palette-manager-v2`
8+
9+
## Scoped Issue
10+
- Legacy palette payload key `payloadJson.paletteDocument.colors` must be rejected before render.
11+
12+
## Planned Change
13+
1. Add an explicit pre-render validation guard in `tools/palette-manager-v2/index.js`:
14+
- reject `payloadJson.paletteDocument.colors`
15+
- show clear visible actionable error
16+
17+
## Out of Scope
18+
- No schema edits
19+
- No other tool edits
20+
- No new features
21+
22+
## Validation
23+
- `node --check tools/palette-manager-v2/index.js`
24+
- `npm run test:workspace-v2`

tools/palette-manager-v2/index.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,10 @@ class PaletteManagerV2 {
182182
this.renderError("Palette Manager V2 session data is invalid. Expected payloadJson.paletteDocument.");
183183
return;
184184
}
185+
if (Object.prototype.hasOwnProperty.call(versionCheck.payload.payloadJson.paletteDocument, "colors")) {
186+
this.renderError("Palette Manager V2 session data is invalid. payloadJson.paletteDocument.colors is not supported; use payloadJson.paletteDocument.swatches.");
187+
return;
188+
}
185189
this.renderPalette(versionCheck.payload.payloadJson.paletteDocument, versionCheck.payload);
186190
}
187191

0 commit comments

Comments
 (0)