Shape.Remove can leave a spanning annotation anchored to a removed end segment
メンテナーはふだん 1 日以内に返信
評価
調査の方向性
Start in Shape.Remove, follow the call to Shape.UpdateAnnotations, then inspect AnnotationList.Find for directional range boundaries. Use the deterministic reproduction in the issue as the first check, then add the requested single-span and tied-span controls for both endpoint directions, including last and interior segment removal. Done means surviving annotations have endpoints in the shape, payloads and unaffected annotations are preserved, and empty spans are removed.
索引モデルが issue の本文から書いたものです。
説明
Removing the rightmost segment of a shape can leave a spanning annotation pointing at the detached node instead of shrinking its end to the previous segment. A single spanning annotation is enough; this is separate from #506's tied-node skip-list fix and #554's equal-container descent.
I reran this minimal reproduction against the #506 candidate based on 259920414132bdd5a85542722d9af5509aed8943, with the first-match-in-search-direction change in BidirList.Find. No Shape.Remove or AnnotationList.Find(offset, direction) changes are included in that candidate.
Expected after removing nodes[3]: the annotation spans [nodes[1], nodes[2]], and none of its endpoints refers to nodes[3].
Observed:
singleSpanRightShrink=False; staleEndpoint=True
Reproduction (reference src/SIL.Machine/SIL.Machine.csproj; RNG seeding is confined to this test instance):
using System.Reflection;
using SIL.Machine.Annotations;
using SIL.Machine.DataStructures;
using SIL.Machine.FeatureModel;
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[] nodes = Enumerable.Range(0, 4).Select(_ => shape.Add(FeatureStruct.New().Value)).ToArray();
var span = new Annotation<ShapeNode>(Range<ShapeNode>.Create(nodes[1], nodes[3]), FeatureStruct.New().Value);
shape.Annotations.Add(span, false);
shape.Remove(nodes[3]);
bool shrunk = shape.Annotations.Any(annotation => annotation.Range.Start == nodes[1] && annotation.Range.End == nodes[2]);
bool stale = shape.Annotations.Any(annotation => annotation.Range.Start == nodes[1] && annotation.Range.End == nodes[3]);
Console.WriteLine($"singleSpanRightShrink={shrunk}; staleEndpoint={stale}");
The source path is Shape.Remove → Shape.UpdateAnnotations → AnnotationList.Find for the directional range boundaries. The new #506 tests distinguish tie-boundary loss from this existing right-end range case; fixing tie equality alone does not repair it.
Acceptance criteria:
- Correctly shrink a spanning annotation when its ending segment is removed, including the shape's last segment and an interior segment.
- Preserve annotation payloads/children and unaffected annotations; remove only annotations whose span becomes empty.
- Include deterministic single-span and tied-span controls, both endpoint directions, and verify actual endpoint membership in the surviving shape.
- Keep this follow-up independently reviewable from #506 and #554. No HermitCrab grammar manifestation has been demonstrated by this reproduction.
- 主要言語
- C#
- スター
- 29
- フォーク
- 16
- 平均マージ
- 6日 13時間
- マージ済み PR(30日)
- 12
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドなし
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
sillsdev/machine のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
メンテナーはふだん 1 日以内に返信
-
enhancement Hermit Crab
難易度 5/5 1週間以上 初心者へのやさしさ 25/100
メンテナーはふだん 1 日以内に返信
-
enhancement Hermit Crab
難易度 5/5 1週間以上 初心者へのやさしさ 25/100
メンテナーはふだん 1 日以内に返信
-
enhancement Hermit Crab
難易度 5/5 1週間以上 初心者へのやさしさ 20/100
メンテナーはふだん 1 日以内に返信
-
enhancement Hermit Crab
難易度 5/5 1週間以上 初心者へのやさしさ 30/100
sillsdev/machine#565 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
sillsdev/machine の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 77/100
メンテナーはふだん 1 日以内に返信
-
:watch: Not Triaged advanced-concepts/subsvc dotnet-csharp/svc
難易度 1/5 1〜3時間 初心者へのやさしさ 84/100
メンテナーはふだん 1 日以内に返信
-
enhancement no-stack-trace
難易度 2/5 1〜3時間 初心者へのやさしさ 66/100
greenshot/greenshot#1618 · コメント 3 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 67/100
microsoft/aspire.dev#1962 ·
メンテナーはふだん 1 日以内に返信
-
needs-area-label
難易度 2/5 1〜3時間 初心者へのやさしさ 73/100
メンテナーはふだん 1 日以内に返信