Skip to content

fix(index): avoid out-of-range panic when a $ref with siblings is resolved in place - #737

Open
nicoandrewss wants to merge 1 commit into
pb33f:mainfrom
nicoandrewss:fix/resolver-ref-siblings-panic
Open

nicoandrewss wants to merge 1 commit into
pb33f:mainfrom
nicoandrewss:fix/resolver-ref-siblings-panic

Conversation

@nicoandrewss

Copy link
Copy Markdown

Fixes #736

extractRelativesWithState ranged over node.Content but re-read node.Content[i-1] inside the loop.
extractRelativeReference can replace node.Content with the resolved target during that loop (external
$ref with sibling keys), so a shorter target caused an index out of range. The loop now walks and indexes
a single snapshot of the content.

  • Adds TestResolver_ExternalRefWithSiblingsLargerThanTarget (panics without the fix)
  • go test ./index/ passes

@codecov

codecov Bot commented Nov 27, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (ef96408) to head (81dfb37).

Additional details and impacted files
@@            Coverage Diff            @@
##              main      #737   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files          316       316           
  Lines        40239     40240    +1     
=========================================
+ Hits         40239     40240    +1     
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.

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.

Rolodex.Resolve panics (index out of range) on an external $ref with sibling keys

1 participant