Skip to content

Find tied containers' descendants regardless of insertion order - #557

Open
johnml1135 wants to merge 2 commits into
masterfrom
fix-554-tied-container-descendants
Open

johnml1135 wants to merge 2 commits into
masterfrom
fix-554-tied-container-descendants

Conversation

@johnml1135

@johnml1135 johnml1135 commented Oct 26, 2026 •

Copy link
Copy Markdown
Collaborator

Start here: src/SIL.Machine/Annotations/AnnotationList.cs, FindDepthFirst (+41 lines): the whole fix.

Ready for review. All CI checks pass.

AnnotationList.FindDepthFirst now tries every container that shares the range of the one Find returned. It used to descend only into that single container, so a segment inside an equal-range sibling was found or missed depending on insertion order and skip-list levels. The failing-lookup result (nearest descendant) is unchanged.

Reviewers arrive asking whether this changes lookups that already work. It does not: with one container at a range the group has one member and the path is the old one. The question worth your time: when several tied containers each own the offset, the walk returns the first match, trying the Find result, then earlier tied nodes, then later ones.

Where to look:

  • FindDepthFirst and the new private GetSameRange: walks the equal-range group in both list directions, so it does not depend on which tied node Find picks. Independent of the BidirList.Find boundary change in Fix directional annotation tie boundaries #556.
  • AnnotationTiedContainerTests: four tied containers, the owner at each position, six fixed skip-list seeds (set by reflection on the test instance only), both search directions. Pins flat ties, nested ties, and ties that do not own the offset.

Not here:

Verification: ./local_check.sh --agent-strict passed (comment hygiene, csharpier, build, tests). With only AnnotationList.cs reverted to master, most of the new test cases fail. Not run: this branch combined with #556.

Next: approve, or say which tied-ownership case is missing from the tests.


Reading this a year from now -- start here

Fixes #554 (open): FindDepthFirst missed descendants of tied containers depending on insertion order. Related open items: #506, #555. #500 and #556 are open PRs touching neighbouring tie behaviour. The fix is deliberately limited to AnnotationList.cs; the reasoning below is the only record.

Decisions, and why
  • Walk the equal-range group in both list directions instead of changing which tied node Find returns: that choice is what Fix directional annotation tie boundaries #556 changes, and this fix must hold whichever node Find picks.
  • Failing lookups still return the nearest descendant, so callers that rely on the miss result see no change.
Evidence
  • ./local_check.sh --agent-strict: passed (comment hygiene, csharpier, build, tests).
  • AnnotationTiedContainerTests passed with the fix in the earlier run; test case counts were not recomputed for this description.
  • With only AnnotationList.cs reverted to master, most of the new cases failed and a minority passed.
  • Not run: this branch combined with Fix directional annotation tie boundaries #556.

🤖 Generated with Claude Code


This change is Reviewable

@codecov-commenter

codecov-commenter commented Oct 26, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 86.20690% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 75.54%. Comparing base (e7422c1) to head (1446411).

Files with missing lines Patch % Lines
src/SIL.Machine/Annotations/AnnotationList.cs 86.20% 3 Missing and 1 partial ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##           master     #557   +/-   ##
=======================================
  Coverage   75.53%   75.54%           
=======================================
  Files         455      455           
  Lines       38933    38960   +27     
  Branches     5428     5434    +6     
=======================================
+ Hits        29407    29431   +24     
- Misses       8376     8379    +3     
  Partials     1150     1150           

☔ 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.

@claude

This comment has been minimized.

@claude

claude Bot commented Nov 1, 2026

Copy link
Copy Markdown
Contributor

Verdict: approve. d636b09 removes the second subtree search on a miss and keeps the old miss result.

Most important: nothing blocks. F4 (tests/SIL.Machine.Tests/Annotations/AnnotationTiedContainerTests.cs:17) is the only open finding. It is Low, so it needs no answer.

Counts: 0 Critical, 0 Important, 1 Low open. Nothing new this round.

Ran: git diff 04b7986 d636b09 and read the new loop. GetSameRange yields candidate first, and Annotation does not override equality, so miss is the old miss result. dotnet test filtered to SIL.Machine.Annotations: 257 passed. CI per gh pr checks 557: comment hygiene passed, while Build on ubuntu-22.04 and windows-latest is still pending.

Not verified: this branch combined with #556.

Public API, target framework, package, machine.py parity: None verified.

F1 withdrawn (the miss path is unchanged from master). F2 addressed. F3 withdrawn (the wider-sibling case is unchanged from master). F4 open.

Reviewed at d636b09

johnml1135 and others added 2 commits November 20, 2026 09:25
AnnotationList.FindDepthFirst only descended into the single container that
Find returned. When several containers share a range and only one owns the
children, the result depended on insertion order and skip-list levels. Try
every container with the same range as the one Find returned.

Fixes #554

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@johnml1135
johnml1135 force-pushed the fix-554-tied-container-descendants branch from d636b09 to 1446411 Compare November 20, 2026 15:14

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

AnnotationList.FindDepthFirst misses descendants in tied containers depending on insertion order

3 participants