Skip to content

fix: build low models from immutable YAML merge views - #658

Merged
daveshanley merged 1 commit into
pb33f:mainfrom
CaliLuke:codex/immutable-merge-views
Oct 19, 2026
Merged

daveshanley merged 1 commit into
pb33f:mainfrom
CaliLuke:codex/immutable-merge-views

Conversation

@CaliLuke

Copy link
Copy Markdown
Contributor

Building a document with YAML merges can mutate a shared yaml.Node.Content while another model-building goroutine reads it, as reproduced in #657. Model construction now reads merge-expanded views without rewriting the published source graph.

The existing merge-view helper is exposed as utils.ResolveMergeNodes and used throughout low-level model construction. It preserves local-key and merge-sequence precedence, retains original key/value nodes and metadata, and preserves node identity when expansion is unnecessary. Low-level roots describe the effective mapping; source nodes retain their authored merges. CheckForMergeNodes keeps its explicitly destructive public behavior.

Typed map fields also consume effective contents directly. This removes the discriminator parser's dependency on an earlier validation call mutating its mapping, while retaining source nodes in field metadata.

Regression coverage checks source preservation, merged fields, original metadata pointers, alias/sequence precedence, mapping cycles, and render/reload behavior. Validation includes race-enabled helper and low/high model packages, the public-API reproduction, and merge/alias/sibling-reference/discriminator integration checks.

Fixes #657.

@codecov

codecov Bot commented Oct 13, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (c4c4be7) to head (3180fde).

Additional details and impacted files
@@            Coverage Diff            @@
##              main      #658   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files          309       309           
  Lines        39213     39178   -35     
=========================================
- Hits         39213     39178   -35     
Flag Coverage Δ
unittests 100.00% <100.00%> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@CaliLuke

Copy link
Copy Markdown
Contributor Author

@daveshanley can I get a review?

@daveshanley
daveshanley merged commit 02c96ab into pb33f:main Oct 19, 2026
4 checks passed
@CaliLuke
CaliLuke deleted the codex/immutable-merge-views branch October 20, 2026 03:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

BuildV3Model races on YAML merge mappings during a single call

2 participants