Repository navigation
Find tied containers' descendants regardless of insertion order - #557
johnml1135 wants to merge 2 commits into
Conversation
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>
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #557 +/- ##
==========================================
+ Coverage 74.57% 74.58% +0.01%
==========================================
Files 453 453
Lines 38314 38341 +27
Branches 5280 5286 +6
==========================================
+ Hits 28573 28597 +24
- Misses 8576 8579 +3
Partials 1165 1165 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
| { | ||
| var annotations = new AnnotationList<ShapeNode>(); | ||
| typeof(BidirList<Annotation<ShapeNode>>) | ||
| .GetField("_rand", BindingFlags.Instance | BindingFlags.NonPublic)! |
There was a problem hiding this comment.
FYI: F4. Because _rand is set by reflection, renaming that private field would make all 252 cases fail with a NullReferenceException from the !. SIL.Machine already declares InternalsVisibleTo("SIL.Machine.Tests"), so an internal seed constructor on BidirList would give the tests a typed hook instead.
This comment has been minimized.
This comment has been minimized.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
|
Verdict: approve. d636b09 removes the second subtree search on a miss and keeps the old miss result. Most important: nothing blocks. F4 ( Counts: 0 Critical, 0 Important, 1 Low open. Nothing new this round. Ran: 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 |
Start here:
src/SIL.Machine/Annotations/AnnotationList.cs,FindDepthFirst(+41 lines): the whole fix.Ready for review. All CI checks pass.
AnnotationList.FindDepthFirstnow tries every container that shares the range of the oneFindreturned. 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
Findresult, then earlier tied nodes, then later ones.Where to look:
FindDepthFirstand the new privateGetSameRange: walks the equal-range group in both list directions, so it does not depend on which tied nodeFindpicks. Independent of theBidirList.Findboundary 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:
BidirList.Find(HermitCrab: investigate unstable zero-width morpheme identities across fresh processes #506, Fix directional annotation tie boundaries #556).Shape.Remove(Shape.Remove can leave a spanning annotation anchored to a removed end segment #555).GetNodes,Shape.UpdateAnnotationsandMatcher: outside AnnotationList.FindDepthFirst misses descendants in tied containers depending on insertion order #554's acceptance criteria.Verification:
./local_check.sh --agent-strictpassed (comment hygiene, csharpier, build, tests). With onlyAnnotationList.csreverted 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):
FindDepthFirstmissed 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 toAnnotationList.cs; the reasoning below is the only record.Decisions, and why
Findreturns: that choice is what Fix directional annotation tie boundaries #556 changes, and this fix must hold whichever nodeFindpicks.Evidence
./local_check.sh --agent-strict: passed (comment hygiene, csharpier, build, tests).AnnotationTiedContainerTestspassed with the fix in the earlier run; test case counts were not recomputed for this description.AnnotationList.csreverted to master, most of the new cases failed and a minority passed.🤖 Generated with Claude Code
This change is