Repository navigation
fix(oc-path): keep quoted positional keys literal - #172382
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: needs real behavior proof before merge. What this changesPreserves quoted keys as literals across JSONC, JSONL, and YAML reads, writes, and emitted find paths. Example: Run path set 'oc://config.jsonc/"$first"' 42 on {"head":"keep-first","$first":7,"tail":"keep-last"}.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness⛔ Blocked before merge - 1 item remains Keep open: this PR repairs a current wrong-target and wrong-type editing bug, preserves the separate JSONL byte-preservation fix, and has no actionable code findings. Priority: P2 Before merge
FindingsNone. Tests
Agent review detailsHow this fits togetherThe bundled oc-path plugin parses CLI addresses and workspace files, resolves format-specific targets, and returns matches, previews, or updated file bytes. flowchart LR
A[Path CLI] --> B[Address parser]
B --> C[Literal and selector dispatch]
D[Workspace file] --> E[Format adapter]
C --> E
E --> F[Matches or edited bytes]
Technical reviewBest possible solution: Keep literal decoding in the shared parser and use the existing format resolvers consistently for reads, mutation targeting, and concrete-path emission. Do we have a high-confidence way to reproduce the issue? Source confirms quote loss before positional interpretation and traces the incorrectly selected value into type coercion and mutation; this read-only review executed no target code. Is this the best way to solve the issue? The patch fixes the owning boundary, removes duplicate JSONL traversal, and preserves the earlier concrete-path quoting and source-byte preservation contracts. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 520302d8ee63. Provenance checked
TestingProof path: in-process harness. SecurityNone. EvidenceWhat I checked:
PR surfaceSource -46, Tests +130, Docs +2. Total +86 across 10 files. Added test files: 0. View PR surface stats
Review metrics
LabelsLabel changes: No label changes. Label justifications:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior. WorkflowClawSweeper edits this one comment on every review. Comment HistoryReview history (1 earlier review cycle)
Reviewed October 15, 2026, 2:12 AM ET / 06:12 UTC (Revision 2). |
Keep quote and escape handling in the shared path parser. Reuse the JSONC value resolver for JSONL writes, preserving source-token edits and removing duplicate traversal. Cover special tokens and escaped keys through registered CLI reads, dry runs, writes, and find across JSONC, JSONL, and YAML. Fixes openclaw#172375 Co-authored-by: fhgffy <[email protected]>
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
Merged via squash.
|
* fix(oc-path): keep quoted positional keys literal * fix(oc-path): preserve literal special keys through reads and writes Keep quote and escape handling in the shared path parser. Reuse the JSONC value resolver for JSONL writes, preserving source-token edits and removing duplicate traversal. Cover special tokens and escaped keys through registered CLI reads, dry runs, writes, and find across JSONC, JSONL, and YAML. Fixes openclaw#172375 Co-authored-by: fhgffy <[email protected]> --------- Co-authored-by: Peter Steinberger <[email protected]> Co-authored-by: fhgffy <[email protected]>
Fixes #172375
What Problem This Solves
Fixes
path resolve,find, andsettreating quoted$first/$lastkeys as positional selectors, which can overwrite a neighboring JSONC/YAML entry or give a JSONL value the wrong type.User Impact
Quoted special keys remain literal across JSONC, JSONL, and YAML. Unquoted
$first/$lastkeep selecting the first or last entry. Returnedfindpaths retain literal token identity, including wildcard, ordinal, insertion, union, and predicate-shaped keys. Quoted segments support escaped quotes (\") and backslashes (\\); other escapes remain rejected. No migration or configuration change is required.Why This Change Was Made
The shared parser now preserves quote spelling through selector dispatch and owns literal decoding and quoting. JSONL writes reuse the JSONC resolver's typed key/index path instead of maintaining a second traversal, while retaining the exact source-token edit from #172410. Positional
findresults quote raw object/map keys before lookup so a key containing literal quotes is not decoded twice.Original fix by @fhgffy; maintainer cleanup extends the literal/escape contract, consolidates JSONL traversal, and preserves the sibling's byte-preservation fix. Contributor commit
051bf809653f5bd90e799502d963e04a95edfc83remains in branch history.Evidence
3d6a3dc1d820802f05769d285d30dd5a244672d9:splitOcPathSlotsstrips quotes before JSONC/YAML positional dispatch. Commit4d06fa489bab6e90315cd6608d896da57a32326aintroduced that shared splitter; this is provenance for the splitter, not a claim about the defect's original introduction.3b03f7ac58ebc303399c825880325149209175ef: CI run 38686615207 finished with all selected static checks passing (production/test types, lint, docs, guards, architecture, source contracts, and baseline ratchets). The eight Node test jobs failed before checkout; the aggregate gate is red and unit behavior remains unverified on this head.keeps quoted special and escaped keys literal in %s CLI reads, writes, and findruns for JSONC, JSONL, and YAML. It checks numeric types, untouched siblings, dry-run byte preservation, persisted writes, wildcard traversal/emission, and ordinary selectors selecting literal token or quote-bearing keys. Parser coverage extendsround-trip canonical formsand addsrejects invalid quoted escapes: %s; the existing Windows path containment test now checks the decoded absolute-path rejection.ui/**/*.tsxoverride and retained every applicable rule; no dependency installation or tracked configuration change.54691736d026cba16ee8623bb3729f8c2c4c5af7:scoped-clean, no actionable P0–P2 findings. Both were source-only reviews.Remaining CI blocker
All eight failed Node jobs hit the same setup error before checking out this patch:
An action could not be foundforactions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e. Examples: PR changed-tests job 116263180110 and PR small-4 job 116263180106. The same signature is present in the newest scheduled main run 38687324602, job 116265300311, at main headc58d6181af08cbd56ad42466d03295145d94068b: inherited infrastructure failure. The PR failure classifier compared the previous scheduled run, so its new/unknown rows predate this matching main evidence.The affected PR jobs are
checks-node-changed,checks-node-changed-boundary,checks-node-changed-compact-large-13,checks-node-changed-extensions-config, andchecks-node-compact-small-1through-4. Their logs were inspected individually. Planned unit coverage includes the oc-path CLI regressions and existing JSONL byte-preservation tests, but none of these jobs reached tests. The action archive still returned HTTP 404 at 05:34 UTC; no blind rerun, workflow pin change, or proof-policy bypass was attempted. Restore action-download availability, then rerun the failed jobs on this exact head before declaring it land-ready. No merge was performed.