Repository navigation
refactor: consolidate safe JSON parsing - #99688
Conversation
|
Land-ready proof for
Known proof gaps: none for this refactor scope. GitHub PR CI is still pending. |
|
Codex review: needs maintainer review before merge. Reviewed July 4, 2026, 4:09 PM ET / 20:09 UTC. Summary PR surface: Source -19, Tests +12. Total -7 across 7 files. Reproducibility: not applicable. this is a refactor PR rather than a bug report. Source inspection confirms current main lacks the helper and the branch consolidates duplicate tolerant parser wrappers. Review metrics: 1 noteworthy metric.
Stored data model Root-cause cluster Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Rank-up moves:
Risk before merge
Maintainer options:
Next step before merge
Security Review detailsBest possible solution: Land this narrowed refactor after required exact-head CI passes, keeping the helper limited to syntax-failure suppression and leaving different public, logging, filesystem, JSONL, and validation contracts local. Do we have a high-confidence way to reproduce the issue? Not applicable: this is a refactor PR rather than a bug report. Source inspection confirms current main lacks the helper and the branch consolidates duplicate tolerant parser wrappers. Is this the best way to solve the issue? Yes: normalization-core is the existing shared coercion owner, and the updated diff keeps parsing mechanics separate from caller-specific record coercion, defaults, logging, and compatibility contracts. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 7a0188cbd20d. Label changesLabel justifications:
Evidence reviewedPR surface: Source -19, Tests +12. Total -7 across 7 files. View PR surface stats
What I checked:
Likely related people:
What the crustacean ranks mean
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics. How this review workflow works
Review history (4 earlier review cycles)
|
5fae325 to
5ea4b41
Compare
b1e4507 to
9fa6a2c
Compare
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. |
9fa6a2c to
117d0c2
Compare
117d0c2 to
ce42b74
Compare
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. |
ce42b74 to
1d81eaf
Compare
|
Reduced the PR from +149/-69 across 22 files to +34/-41 across 7 files. The updated implementation exports the helper only from the existing private normalization-core root and deletes all new subpath/resolver/build/UI plumbing. It also drops the logging migration and refactor-only caller tests where the contracts or proof value did not justify the added surface. Proof on head 1d81eaf:
|
Closes #99665
What Problem This Solves
Pure tolerant JSON parsing was reimplemented in several core callers, mixing parsing mechanics with each caller's record coercion and fallback policy.
Why This Change Was Made
Adds a dependency-free
safeParseJson(value: string): unknownhelper to the existing private@openclaw/normalization-coreroot export and migrates four record-only internal callers. The helper returnsundefinedonly for syntax failures; callers still own record coercion, trimming, and defaults.The earlier package-subpath approach was intentionally removed. This version adds no package export, resolver, tsconfig, Vitest, build-entry, extension-boundary, or Control UI alias plumbing. Logging/redaction parsing and the public
src/utils.tsnull-contract helper remain unchanged because their contracts differ.User Impact
No intended user-visible behavior change. The migrated caller slice now shares one parsing primitive while production code decreases.
Evidence
OPENCLAW_HEAVY_CHECK_LOCK_SCOPE=worktree node scripts/run-vitest.mjs packages/normalization-core/src/json-coercion.test.ts src/acp/runtime/session-meta.test.ts src/agents/embedded-agent-message-tool-source-reply.test.ts src/chat/canvas-render.test.ts src/agents/tools/message-tool.internal-source-reply.integration.test.ts— 37 tests passed across four Vitest shards.pnpm build— passed, including normalization-core declarations/runtime output, plugin SDK export checks, and Control UI production build.packages/normalization-core/dist/index.mjsandindex.d.mtsexportsafeParseJsonthrough the existing root entry..agents/skills/autoreview/scripts/autoreview --mode branch --base origin/main --prompt-file /tmp/pr99688-autoreview.md --stream-engine-output— clean, no accepted/actionable findings; correctness confidence 0.98.tbx_01kwqakqby8pg3gwnt3tf476gz,tbx_01kwqb2f7dn16tztfg12m8efzf) but Blacksmith timed out while reading lease status before either command executed; both leases were stopped. AWS fallback was unavailable because broker auth is not configured in this environment.JSON.parse.