AnnotationList.FindDepthFirst misses descendants in tied containers depending on insertion order
Maintainer thường phản hồi trong vòng 1 ngày
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 56/100
Hướng nghiên cứu
Start with src/SIL.Machine/Annotations/AnnotationList.cs::FindDepthFirst and the minimal reproduction in the issue. Add deterministic tests for tied and nested containers in both insertion orders and search directions; verify the expected descendant is found without returning an unrelated annotation. Keep the change separate from #506.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
AnnotationList.FindDepthFirst can miss a segment inside equal-range sibling containers solely because their insertion order changes. This is separate from #506's skip-list boundary defect.
Reproduced against Machine 259920414132bdd5a85542722d9af5509aed8943 and again with the proposed first-match-in-search-direction fix applied locally. The latter fixes range traversal but leaves this case unchanged. This report concerns the shared annotation API; no HermitCrab grammar reaching the case has been demonstrated.
Two sibling annotations both cover [n0,n2]; only one owns the three segment annotations. Looking up n1 should return its annotation regardless of which sibling was inserted first. Current results:
ownerAddedFirst=True; found=False; foundSegment=False
ownerAddedFirst=False; found=True; foundSegment=True
The non-found path in src/SIL.Machine/Annotations/AnnotationList.cs::FindDepthFirst descends only into the single candidate returned by Find; it does not search another equal-range container when that candidate cannot supply the descendant. A deterministic layout alone cannot resolve this ownership choice.
Minimal console reproduction (reference src/SIL.Machine/SIL.Machine.csproj; reflection sets only the test instance RNG, with no production hook):
using System.Reflection;
using SIL.Machine.Annotations;
using SIL.Machine.DataStructures;
using SIL.Machine.FeatureModel;
foreach (bool ownerAddedFirst in new[] { true, false })
{
var annotations = new AnnotationList<ShapeNode>();
typeof(BidirList<Annotation<ShapeNode>>)
.GetField("_rand", BindingFlags.Instance | BindingFlags.NonPublic)!
.SetValue(annotations, new Random(0));
var shape = new Shape(begin => new ShapeNode(FeatureStruct.New().Value), annotations);
ShapeNode n0 = shape.Add(FeatureStruct.New().Value);
ShapeNode n1 = shape.Add(FeatureStruct.New().Value);
ShapeNode n2 = shape.Add(FeatureStruct.New().Value);
var owner = new Annotation<ShapeNode>(Range<ShapeNode>.Create(n0, n2), FeatureStruct.New().Value);
owner.Children.AddRange(new[] { n0.Annotation, n1.Annotation, n2.Annotation });
var empty = new Annotation<ShapeNode>(Range<ShapeNode>.Create(n0, n2), FeatureStruct.New().Value);
if (ownerAddedFirst)
{
shape.Annotations.Add(owner, false);
shape.Annotations.Add(empty, false);
}
else
{
shape.Annotations.Add(empty, false);
shape.Annotations.Add(owner, false);
}
bool found = shape.Annotations.FindDepthFirst(n1, out Annotation<ShapeNode> result);
Console.WriteLine($"ownerAddedFirst={ownerAddedFirst}; found={found}; foundSegment={ReferenceEquals(result, n1.Annotation)}");
}
Acceptance criteria:
- Find the descendant in both insertion orders and both search directions, with deterministic coverage of tied containers and nested containers.
- Preserve existing direction and boundary semantics, and verify that no unrelated annotation is returned.
- Keep the fix separately reviewable from #506. Do not claim a parser-level reproduction without one.
Related: #506, #500. The reproduction was rerun directly during the 2026-10-23 investigation; the first-match boundary fix does not solve this case.
- Ngôn ngữ chính
- C#
- Star
- 29
- Fork
- 16
- Merge trung bình
- 10 ngày 4 giờ
- Pull request đã merge (30 ngày)
- 13
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Không có hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của sillsdev/machine
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Shape.Remove can leave a spanning annotation anchored to a removed end segmentCó thể đã có người làm Có pull request liên kết đang mở hoặc đã được merge. Đang mở
Độ khó 4/5 1-2 ngày Mức phù hợp với người mới 62/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Hermit Crab
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 52/100
sillsdev/machine#552 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
HermitCrab: partial lexical entries switch off final-template pruning for the whole grammarCó thể đã có người làm @johnml1135 đã nhận 2 ngày trước. Đang mởHermit Crab
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 35/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Hermit Crab
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 25/100
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của sillsdev/machine
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
unoplatform/uno.check#591 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
weaviate/csharp-client#378 ·
-
confirmed enhancement
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
Maintainer thường phản hồi trong vòng 1 ngày
-
agentic-workflows automated testing
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 85/100
Azure-Samples/Legacy-Modernization-Agents#194 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
area-encryption area-security p1-recommended technical-debt
Độ khó 2/5 Dưới một giờ Mức phù hợp với người mới 85/100
Maintainer thường phản hồi trong vòng 1 ngày