fix(config): improve validation error messages with line numbers, bracket paths, and received values#106526
Conversation
|
Codex review: found issues before merge. Reviewed July 16, 2026, 9:54 PM ET / July 17, 2026, 01:54 UTC. Summary PR surface: Source +529, Tests +449. Total +978 across 6 files. Reproducibility: yes. Current main formats dotted validation paths directly, and an invalid enum under an array provides a concrete source-level reproduction; the contributor also supplies convincing after-fix CLI output. Review metrics: none identified. 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
Maintainer decision needed
Security Review findings
Review detailsBest possible solution: Keep raw root-file text only for source-location lookup, derive received scalar values from the resolved source config or validation issue, and expose them only under a maintainer-approved fail-closed sensitivity policy while preserving unchanged JSON output. Do we have a high-confidence way to reproduce the issue? Yes. Current main formats dotted validation paths directly, and an invalid enum under an array provides a concrete source-level reproduction; the contributor also supplies convincing after-fix CLI output. Is this the best way to solve the issue? No, not yet. Display-layer enrichment is the correct boundary, but received values must come from the effective validated config rather than pre-resolution input, and their disclosure policy must fail closed. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 1f5c8239d71c. Label changesLabel justifications:
Evidence reviewedPR surface: Source +529, Tests +449. Total +978 across 6 files. View PR surface stats
Security concerns:
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 (15 earlier review cycles; latest 8 shown)
|
525bfe5 to
1813722
Compare
…cket paths, and received values - Add JSON5-aware path navigator (issue-location.ts) that resolves line numbers and received values from raw config text without a full parser - Add formatConfigIssuePath() for bracket notation (agents.list[3]) - Add appendReceivedValueHint() for safe value display (got: "none") - Add attachConfigIssueDiagnostics() to enrich issues with location info - Wire enrichment into runConfigValidate() and loadValidConfig() in config-cli.ts - Add resolveIssueLocationPrefix() to issue-format.ts for sourceFile:line prefix - Sensitive paths and secret refs are never leaked in received value hints - Paths in 'd files gracefully degrade (no line number shown) Closes openclaw#104854
- Add sourceFile to ConfigIssueFormatOptions (used in resolveIssueLocationPrefix) - Fix readKey regex test for undefined raw[c.pos]
- Add braces to all single-line if/while/for statements - Run oxfmt for consistent formatting
- Add explicit supported-subset documentation to issue-location.ts header - Add 20 tests covering hex numbers, leading decimals, Infinity, NaN, null/bool, trailing commas, deep nesting, unicode escapes, multi-line strings, unicode keys, escaped quotes, numeric separators, block comments, mixed quotes, empty objects/arrays, and graceful degradation
- Remove numeric separator claim (not valid JSON5) - Remove 'None known' unsupported-syntax claim, document known limitations - Restructure scalar tests to exercise skipVal (resolve sibling after exotic value) - Remove numeric separator test
|
Merged via squash.
|
…cket paths, and received values (openclaw#106526) * fix(config): improve validation error messages with line numbers, bracket paths, and received values - Add JSON5-aware path navigator (issue-location.ts) that resolves line numbers and received values from raw config text without a full parser - Add formatConfigIssuePath() for bracket notation (agents.list[3]) - Add appendReceivedValueHint() for safe value display (got: "none") - Add attachConfigIssueDiagnostics() to enrich issues with location info - Wire enrichment into runConfigValidate() and loadValidConfig() in config-cli.ts - Add resolveIssueLocationPrefix() to issue-format.ts for sourceFile:line prefix - Sensitive paths and secret refs are never leaked in received value hints - Paths in 'd files gracefully degrade (no line number shown) Closes openclaw#104854 * fix(config): type fixes from tsgo:core validation - Add sourceFile to ConfigIssueFormatOptions (used in resolveIssueLocationPrefix) - Fix readKey regex test for undefined raw[c.pos] * fix(config): satisfy eslint(curly) and formatting for issue-location.ts - Add braces to all single-line if/while/for statements - Run oxfmt for consistent formatting * fix(config): trim issue-location.ts to 500 lines for LOC ratchet * fix(config): fix formatConfigIssuePath ternary bug from trimming * fix(config): trim issue-location.ts to 469 lines for LOC ratchet * fix(config): format issue-location.test.ts * fix(config): document JSON5 subset and add 20 edge case tests - Add explicit supported-subset documentation to issue-location.ts header - Add 20 tests covering hex numbers, leading decimals, Infinity, NaN, null/bool, trailing commas, deep nesting, unicode escapes, multi-line strings, unicode keys, escaped quotes, numeric separators, block comments, mixed quotes, empty objects/arrays, and graceful degradation * fix(config): address autoreview findings on JSON5 docs and tests - Remove numeric separator claim (not valid JSON5) - Remove 'None known' unsupported-syntax claim, document known limitations - Restructure scalar tests to exercise skipVal (resolve sibling after exotic value) - Remove numeric separator test * fix(config): constrain received value diagnostics * fix(config): preserve JSON5 diagnostic locations * fix(config): preserve validation path ownership * fix(config): redact dotted plugin paths * test(config): avoid diagnostic fixture shadowing * refactor(config): privatize diagnostic helpers --------- Co-authored-by: Erick Kinnee <[email protected]> Co-authored-by: Peter Steinberger <[email protected]>
What Problem This Solves
openclaw config validatereported lossy dot paths without source locations, making nested and array validation failures difficult to find. It also omitted the rejected scalar value even when that value was safe to display.Why This Change Was Made
This improves human-readable validation errors without changing the config schema, parser, or machine-readable issue shape:
agents.list[3].tools.profileopenclaw.json:<line>when the exact JSON5 value can be locatedgot:hintReceived values are omitted for sensitive paths, SecretRefs, plugin-owned config, channel config, objects, environment-substituted values, included-only values, and migrated values. Plugin IDs containing dots remain inside the same redaction boundary.
User Impact
A safe root-file failure can now render as:
When source ownership or value safety cannot be proven, output degrades to the existing path and message without a line or received value.
Evidence
node scripts/run-vitest.mjs src/config/issue-location.test.ts src/config/issue-format.test.ts src/config/validation.allowed-values.test.ts src/cli/config-cli.test.ts— 199 tests passed on rebased head2490aa0fc37enode scripts/check-changed.mjs -- <changed config files>— guards, formatting, core and core-test typechecks, full core lint, and database/runtime guards passed in hosted TestboxAI-assisted: implementation by Luci (OpenClaw agent), improved and reviewed by OpenClaw maintainers.
Closes #104854