Skip to content

chore(oc-path): retain wildcard array-path regression coverage - #172164

Open
fhgffy wants to merge 4 commits into
openclaw:mainfrom
fhgffy:fix/path-literal-wildcards
Open

fhgffy wants to merge 4 commits into
openclaw:mainfrom
fhgffy:fix/path-literal-wildcards

Conversation

@fhgffy

@fhgffy fhgffy commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

Related: #172161

What Problem This Solves

Keeps regression coverage for reusing path find results when TypeScript-style path mappings contain wildcard-looking keys and array values.

User Impact

No additional runtime change: current main already handles literal-key quoting. The retained tests protect resolving and updating the returned array paths without changing neighboring mappings.

Why This Change Was Made

Merged d6d7435f59ec to resolve the formatter and parser-test conflicts, preserving main's canonical implementation. The remaining diff is two test files: the in-process CLI-handler find -> array-node resolve -> set --value-json scenario for *, **, @app/*, and types*, plus four formatter round-trip cases not covered by the existing table.

Evidence

  • On 2026-10-17, built the native cliStartup / oc-path runtime successfully at f596a8a321ba9e35220b0986705f4221f6ccd99a and captured the actual shipped CLI flow below. All 11 independent CLI invocations exited 0. All four returned wildcard-looking array paths resolved and were updated with --value-json, preserving the other mappings after each write.
  • The earlier 2026-10-16 native test:extension oc-path --maxWorkers=1 run at this same head passed 33 files, with 348 tests passed and five existing tests skipped (Vitest 5.0.3, 30.41 seconds). The in-process handler scenario took 54 ms and the parser round-trip case 4 ms. Those are the previously recorded unit-test results, separate from this new CLI capture.
  • Targeted formatting, whitespace, and the independent two-file source/commit review passed. The hosted CI workflow at this head and its openclaw/ci-gate report success; selection-skipped jobs are not claimed as executed.
  • The earlier local type-aware lint attempt stopped in SDK declaration preparation (insufficient resources, worker exit 13), and its subsequent local typecheck did not run. That local lane was not rerun for this capture. The earlier CLI autoreview attempt produced no report because its configured review engine was unavailable. The new build and CLI capture do not stand in for a full local test/release suite.
Captured shipped CLI flow at f596a8a (11 independent invocations)

Executed on Windows with Node 24.21.0 and pinned pnpm 12.11.1 through the project's pnpm --silent openclaw entry (scripts/run-node.mjs). The normal launcher prepared its runtime artifacts; the command and parser were not mocked or imported from a test. The fixture and the oc-path-only CLI configuration were isolated from personal state.

Argument vectors below start at pnpm's arguments. Captured JSON stdout is pretty-printed, with only local filesystem paths replaced by <fixture>. Each invocation exited 0.

Initial fixture:

{
  "paths": {
    "*": [
      "types/*"
    ],
    "**": [
      "recursive/*"
    ],
    "@app/*": [
      "src/*"
    ],
    "types*": [
      "generated/*"
    ],
    "neighbor": [
      "keep/me"
    ]
  }
}

00-version — arguments:

["--silent", "openclaw", "--version"]

stdout:

OpenClaw 2026.10.4 (f596a8a)

Captured launcher stderr:

[openclaw] Syncing runtime artifacts (static_assets_not_prepared - runtime static assets were not verified).
[plugin-control-plane-loads] verified 0 built modules with native require and checked doctor closures
runtime-postbuild: 14 phases completed in 15818ms (slowest: previous release update compat chunks 12682ms)
[openclaw] Bun fork unavailable (unsupported platform win32-x64); using Node. Set OPENCLAW_VITEST_RUNTIME=node to silence.

01-find — arguments:

["--silent", "openclaw", "path", "find", "oc://config.jsonc/paths/*", "--cwd", "<fixture>", "--json"]

stdout:

{
  "pattern": "oc://config.jsonc/paths/*",
  "count": 5,
  "matches": [
    {
      "path": "oc://config.jsonc/paths/\"*\"",
      "match": {
        "kind": "node",
        "descriptor": "jsonc-array",
        "line": 3
      }
    },
    {
      "path": "oc://config.jsonc/paths/\"**\"",
      "match": {
        "kind": "node",
        "descriptor": "jsonc-array",
        "line": 6
      }
    },
    {
      "path": "oc://config.jsonc/paths/\"@app/*\"",
      "match": {
        "kind": "node",
        "descriptor": "jsonc-array",
        "line": 9
      }
    },
    {
      "path": "oc://config.jsonc/paths/types*",
      "match": {
        "kind": "node",
        "descriptor": "jsonc-array",
        "line": 12
      }
    },
    {
      "path": "oc://config.jsonc/paths/neighbor",
      "match": {
        "kind": "node",
        "descriptor": "jsonc-array",
        "line": 15
      }
    }
  ]
}

02-resolve — arguments:

["--silent", "openclaw", "path", "resolve", "oc://config.jsonc/paths/\"*\"", "--cwd", "<fixture>", "--json"]

stdout:

{
  "resolved": true,
  "ocPath": "oc://config.jsonc/paths/\"*\"",
  "match": {
    "kind": "node",
    "descriptor": "jsonc-array",
    "line": 3
  }
}

02-set — arguments:

["--silent", "openclaw", "path", "set", "oc://config.jsonc/paths/\"*\"", "[\"updated/*\"]", "--value-json", "--cwd", "<fixture>", "--json"]

stdout:

{
  "ok": true,
  "dryRun": false,
  "bytesWritten": 216,
  "fsPath": "<fixture>\\config.jsonc"
}

Complete fixture after this write:

{
  "paths": {
    "*": [
      "updated/*"
    ],
    "**": [
      "recursive/*"
    ],
    "@app/*": [
      "src/*"
    ],
    "types*": [
      "generated/*"
    ],
    "neighbor": [
      "keep/me"
    ]
  }
}

03-resolve — arguments:

["--silent", "openclaw", "path", "resolve", "oc://config.jsonc/paths/\"**\"", "--cwd", "<fixture>", "--json"]

stdout:

{
  "resolved": true,
  "ocPath": "oc://config.jsonc/paths/\"**\"",
  "match": {
    "kind": "node",
    "descriptor": "jsonc-array",
    "line": 6
  }
}

03-set — arguments:

["--silent", "openclaw", "path", "set", "oc://config.jsonc/paths/\"**\"", "[\"updated/**\"]", "--value-json", "--cwd", "<fixture>", "--json"]

stdout:

{
  "ok": true,
  "dryRun": false,
  "bytesWritten": 215,
  "fsPath": "<fixture>\\config.jsonc"
}

Complete fixture after this write:

{
  "paths": {
    "*": [
      "updated/*"
    ],
    "**": [
      "updated/**"
    ],
    "@app/*": [
      "src/*"
    ],
    "types*": [
      "generated/*"
    ],
    "neighbor": [
      "keep/me"
    ]
  }
}

04-resolve — arguments:

["--silent", "openclaw", "path", "resolve", "oc://config.jsonc/paths/\"@app/*\"", "--cwd", "<fixture>", "--json"]

stdout:

{
  "resolved": true,
  "ocPath": "oc://config.jsonc/paths/\"@app/*\"",
  "match": {
    "kind": "node",
    "descriptor": "jsonc-array",
    "line": 9
  }
}

04-set — arguments:

["--silent", "openclaw", "path", "set", "oc://config.jsonc/paths/\"@app/*\"", "[\"updated/@app/*\"]", "--value-json", "--cwd", "<fixture>", "--json"]

stdout:

{
  "ok": true,
  "dryRun": false,
  "bytesWritten": 224,
  "fsPath": "<fixture>\\config.jsonc"
}

Complete fixture after this write:

{
  "paths": {
    "*": [
      "updated/*"
    ],
    "**": [
      "updated/**"
    ],
    "@app/*": [
      "updated/@app/*"
    ],
    "types*": [
      "generated/*"
    ],
    "neighbor": [
      "keep/me"
    ]
  }
}

05-resolve — arguments:

["--silent", "openclaw", "path", "resolve", "oc://config.jsonc/paths/types*", "--cwd", "<fixture>", "--json"]

stdout:

{
  "resolved": true,
  "ocPath": "oc://config.jsonc/paths/types*",
  "match": {
    "kind": "node",
    "descriptor": "jsonc-array",
    "line": 12
  }
}

05-set — arguments:

["--silent", "openclaw", "path", "set", "oc://config.jsonc/paths/types*", "[\"updated/types*\"]", "--value-json", "--cwd", "<fixture>", "--json"]

stdout:

{
  "ok": true,
  "dryRun": false,
  "bytesWritten": 227,
  "fsPath": "<fixture>\\config.jsonc"
}

Complete fixture after this write:

{
  "paths": {
    "*": [
      "updated/*"
    ],
    "**": [
      "updated/**"
    ],
    "@app/*": [
      "updated/@app/*"
    ],
    "types*": [
      "updated/types*"
    ],
    "neighbor": [
      "keep/me"
    ]
  }
}

06-find-after — arguments:

["--silent", "openclaw", "path", "find", "oc://config.jsonc/paths/*", "--cwd", "<fixture>", "--json"]

stdout:

{
  "pattern": "oc://config.jsonc/paths/*",
  "count": 5,
  "matches": [
    {
      "path": "oc://config.jsonc/paths/\"*\"",
      "match": {
        "kind": "node",
        "descriptor": "jsonc-array",
        "line": 3
      }
    },
    {
      "path": "oc://config.jsonc/paths/\"**\"",
      "match": {
        "kind": "node",
        "descriptor": "jsonc-array",
        "line": 6
      }
    },
    {
      "path": "oc://config.jsonc/paths/\"@app/*\"",
      "match": {
        "kind": "node",
        "descriptor": "jsonc-array",
        "line": 9
      }
    },
    {
      "path": "oc://config.jsonc/paths/types*",
      "match": {
        "kind": "node",
        "descriptor": "jsonc-array",
        "line": 12
      }
    },
    {
      "path": "oc://config.jsonc/paths/neighbor",
      "match": {
        "kind": "node",
        "descriptor": "jsonc-array",
        "line": 15
      }
    }
  ]
}

The path strings returned by find were passed unchanged to resolve and set. Each resolution returned kind: node / descriptor: jsonc-array. After every write, the complete mapping matched the expected single-key update, including all neighboring mappings; the final find returned the same five paths. Later invocations emitted only the same Windows Bun-to-Node fallback notice shown above.

Quote exact literal wildcard keys while preserving structural selectors and keyed insertion markers. Cover registered CLI find/resolve/set reuse and canonical formatting.

Closes openclaw#172161
@clawsweeper

clawsweeper Bot commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Oct 14, 2026
@clawsweeper

clawsweeper Bot commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

This PR adds wildcard-key array-path CLI coverage and four canonical path-formatting cases.

Example: Find and update the array at the literal key "*" in config.jsonc.

  • Before: Main supports the operation, but existing scalar-key coverage does not protect reusing the returned array path with --value-json.
  • After: The added test resolves oc://config.jsonc/paths/"", updates it to ["updated/"], and checks every neighboring mapping.

Review scores

Measure Result What it means
Overall readiness 🦞 diamond lobster (5/6) Focused, useful test coverage with matching shipped CLI evidence, successful exact-head aggregate gates, and no actionable defects.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (terminal): The current body supplies the previously requested shipped CLI capture at f596a8a: Windows Node execution through the normal launcher finds wildcard-looking keys, resolves their array nodes, updates each with --value-json, and shows complete neighboring mappings preserved after every write.
Patch quality 🦞 diamond lobster (5/6) No actionable review findings were identified.

Product

Kind: Test only · Worth it: Yes · Fix scope: Complete
User problem: Scripts need returned paths for wildcard-looking mapping keys to remain usable for array reads and updates without changing neighboring mappings.
Reason: The retained tests cover array-node resolution and JSON replacement beyond existing scalar-key coverage without changing runtime policy or adding a competing implementation.

Merge readiness

✅ Ready for maintainer review

Keep open: this PR retains useful array-node regression coverage beyond main’s existing scalar-key tests, with no actionable findings.

Priority: P3
Reviewed head: f596a8a321ba9e35220b0986705f4221f6ccd99a

Before merge

None.

Findings

None.

Agent review details

How this fits together

The optional oc-path plugin registers local file commands; oc:// paths enter its parser and traversal adapters, which return matches or write the selected file value.

flowchart LR
  A[CLI arguments] --> B[Plugin command registration]
  B --> C[Path parser]
  C --> D[JSONC traversal]
  D --> E[Concrete array path]
  E --> F[Resolve or set]
  F --> G[File and JSON output]
Loading

Technical review

Best possible solution:

Retain the focused array-path and formatting coverage alongside main’s existing implementation.

Do we have a high-confidence way to reproduce the issue?

The remaining patch adds coverage rather than repairing a current-main failure; the supplied CLI transcript demonstrates the protected behavior at the reviewed head.

Is this the best way to solve the issue?

The registered-command scenario protects array replacement and neighbor preservation, while the formatting rows extend an existing independent canonical-path contract.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against ec430f5cd126.

Testing

Proof path: shipped entry point.

Security

None.

Evidence

What I checked:

  • Introduced changes are tests only: The pinned introduction diff adds a registered-command find-to-resolve-to-set scenario and four rows to the canonical formatting table; the comparison with fetched main has the same retained changes. (extensions/oc-path/src/cli.test.ts:1154, f596a8a321ba)
  • Distinct observable contract: Existing coverage exercises scalar special keys across JSONC, JSONL, and YAML; the added scenario instead reuses returned array-node paths, supplies --value-json, and checks the complete mapping after each write. (extensions/oc-path/src/cli.test.ts:234, f596a8a321ba)
  • Current implementation remains authoritative: Main’s traversal quotes enumerated object keys, and the shared syntax owner distinguishes literal wildcard keys from structural selectors; this PR leaves that implementation intact. (extensions/oc-path/src/oc-path/find.ts:309, ec430f5cd126)
  • Shipped CLI proof satisfies prior request: The full current PR body records Windows Node 24.21.0 execution through pnpm --silent openclaw at the reviewed head: find returns five paths, all four wildcard-looking array paths resolve and accept updates, and complete file readbacks preserve neighbors. (f596a8a321ba)
  • Exact-head aggregate checks pass: GitHub reports successful openclaw/ci-gate, dependency-review, and security-sensitive-review statuses for the reviewed head; cancelled context, label, and auto-response jobs establish no patch-caused failure. (f596a8a321ba)
  • Related merged work does not replace retained coverage: fix(oc-path): keep quoted positional keys literal #172382 merged the broader literal-token repair and scalar-key coverage; [Bug]: path find fails on a JSON mapping with a literal wildcard key #172161 remains open and paired with this PR by the same author. (ae55909c9026)

Likely related people:

  • Peter Steinberger: Raw commit 58cca1d adds extensions/oc-path/src/cli.test.ts:82 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 58cca1d98a5e; files: extensions/oc-path/src/cli.test.ts)
  • fhgffy: Raw commit ae55909 adds extensions/oc-path/src/cli.test.ts:234 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: ae55909c9026; files: extensions/oc-path/src/cli.test.ts)

PR surface

Tests +52. Total +52 across 2 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 0 0 0 0
Tests 2 52 0 +52
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 2 52 0 +52

Labels

Label changes:

  • add proof: sufficient: Contributor real behavior proof is sufficient.
  • add rating: 🦞 diamond lobster: Overall readiness is 🦞 diamond lobster; proof is 🦞 diamond lobster and patch quality is 🦞 diamond lobster.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.
  • remove rating: 🧂 unranked krab: Current PR rating is rating: 🦞 diamond lobster, so this older rating label is no longer current.
  • remove status: 📣 needs proof: Current PR status label is status: 👀 ready for maintainer look.

Label justifications:

  • P3: This is focused test maintenance with no production behavior change.
  • rating: 🦞 diamond lobster: Overall readiness is 🦞 diamond lobster; proof is 🦞 diamond lobster and patch quality is 🦞 diamond lobster.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.
  • proof: sufficient: Contributor real behavior proof is sufficient.

Rating scale

6/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.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

History

Review history (3 earlier review cycles)
  • reviewed 2026-10-14T13:42:35.093Z sha 14fe080 :: needs real behavior proof before merge. :: none
  • reviewed 2026-10-14T13:55:21.862Z sha 14fe080 :: needs real behavior proof before merge. :: none
  • reviewed 2026-10-16T22:49:06.716Z sha f596a8a :: needs real behavior proof before merge. :: none

Reviewed October 17, 2026, 4:27 AM ET / 08:27 UTC (Revision 4).

Merge upstream main to resolve formatter and parser-test conflicts. Keep the canonical implementation and retain the original find-to-resolve-to-set regression coverage for array values and embedded wildcard keys.
@fhgffy fhgffy changed the title fix(oc-path): handle literal wildcard keys in path find chore(oc-path): retain wildcard array-path regression coverage Oct 16, 2026
@fhgffy

fhgffy commented Oct 16, 2026

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. and removed P2 Normal backlog priority with limited blast radius. clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Oct 16, 2026
@fhgffy

fhgffy commented Oct 17, 2026

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Oct 17, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. and removed rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. clawsweeper:intake:bug Preliminary submission classification; full source review pending. labels Oct 17, 2026
@clawsweeper clawsweeper Bot added the status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. label Oct 17, 2026
Merge upstream main d79a7b6, preserving the runtime implementation and
expanded registered-CLI coverage. Retain the wildcard-array round trip
and four parser cases.

Validation: 34 oc-path files / 437 tests, targeted typecheck, formatting,
whitespace check, and independent source review passed. Local type-aware
lint could not start because SDK declaration preparation exited 13;
exact-head hosted CI remains required.
Merge upstream a6ee6a1, preserving the current runtime implementation
and existing CLI coverage. Move the wildcard-array scenario into its own
focused test file to respect the CLI suite line cap. Retain four canonical
parser cases and allocate the exact 67 net test lines.

Validation: 34 oc-path files / 488 tests, targeted typecheck, type-aware
lint, formatting, test-line ratchet, whitespace, and independent review.
Full repository and package/release builds were not run.

fhgffy commented Nov 7, 2026

Copy link
Copy Markdown
Contributor Author

Updated to 11f4d43 by merging a6ee6a1 and preserving upstream behavior. The wildcard-array regression now has a focused test file to satisfy the CLI suite’s line limit, with an exact 67-line growth allocation.

Validation passed: 34 oc-path files / 488 tests, targeted typecheck, type-aware lint, formatting, test-line ratchet, whitespace, and independent review. Full-repository tests and full package/release builds were not run. CI for this head is still running.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

extensions: oc-path P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. size: S status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant