Skip to content

refactor(oc-path): reuse YAML path resolution - #107340

Merged
steipete merged 1 commit into
mainfrom
codex/yaml-native-helpers
Jul 14, 2026
Merged

steipete merged 1 commit into
mainfrom
codex/yaml-native-helpers

Conversation

@steipete

Copy link
Copy Markdown
Contributor

What Problem This Solves

OC Path's YAML editor duplicated the reader's path splitting, positional-token resolution, and map/sequence traversal. The two implementations could drift while adding 90 avoidable lines.

Why This Change Was Made

Reuse resolveYamlOcPath as the canonical addressing pass, then feed its concrete path into YAML's native hasIn, getIn, setIn, and addIn mutation APIs. This preserves OC Path's stricter sequence-index and typed-map-key rules, which raw YAML path lookup does not provide.

User Impact

No intended user-visible behavior change. YAML reads and edits now share one path-resolution implementation. Net reduction: 90 lines.

Evidence

  • node scripts/run-vitest.mjs extensions/oc-path/src — 40 files, 696 tests passed
  • focused YAML, universal, and CLI tests — 3 files, 118 tests passed
  • git diff --check — clean
  • fresh local autoreview — no accepted/actionable findings
  • exact [email protected] source inspected for Document path methods, typed map-key equality, sequence-index coercion, and clone range behavior

Hosted CI and the full repository suite were not awaited per maintainer instruction.

@steipete

steipete commented Jul 14, 2026 •

Copy link
Copy Markdown
Contributor Author

Land-ready at b732062a1a77a913f2d1be4aa5e696494ae79c7e after rebasing onto current main.

Work completed:

  • removed the YAML editor's duplicate path parser and walker
  • reused the canonical resolver for positional tokens and concrete path selection
  • retained native YAML document mutation methods and the existing reparsing/range refresh
  • net reduction 90 lines

Proof on the rebased head:

  • node scripts/run-vitest.mjs extensions/oc-path/src — 40 files, 696 tests passed
  • git diff --check origin/main...HEAD — clean
  • fresh branch autoreview — no accepted/actionable findings

Known proof gap: hosted CI and the full repository suite were not awaited per maintainer instruction. Exact [email protected] path, key, index, and clone contracts were inspected directly.

@steipete
steipete force-pushed the codex/yaml-native-helpers branch from 9d27c74 to b732062 Compare July 14, 2026 09:32
@steipete
steipete merged commit 88e5dc1 into main Jul 14, 2026
35 of 38 checks passed
@steipete
steipete deleted the codex/yaml-native-helpers branch July 14, 2026 09:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant