mirror of
https://github.com/ajisaacs/OpenNest.git
synced 2026-10-28 04:51:05 -04:00
fix(engine): forged pinned-contour ordinal stays an Incomplete verdict
The 5.5 pinned-entry shortcut in ContourEntryFeasibility looked up the choice's contour before the probe's own validation, so an owned choice with an out-of-range contour ordinal threw instead of returning Incomplete as it did before. The lookup now runs only for an ordinal inside the preparation. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
6c691cc23b
commit
2f91f1b036
2 files changed
+5
-1
No files matched your search
@@ -90,7 +90,9 @@ public sealed class ContourEntryFeasibility
|
||||
return new(ContourFeasibilityStatus.Incomplete, "Foreign contour choice.");
|
||||
// A drawing pin's entry is a fixed emission, accepted as given: it is never filtered
|
||||
// out here. The emitted program's checks report its violations as warnings.
|
||||
if (prepared.PinnedEntry(choice.ContourOrdinal) == choice)
|
||||
// A forged ordinal falls through to the probe, which refuses it as Incomplete.
|
||||
if (choice.ContourOrdinal >= 0 && choice.ContourOrdinal < prepared.Count
|
||||
&& prepared.PinnedEntry(choice.ContourOrdinal) == choice)
|
||||
return new(ContourFeasibilityStatus.Clear, null);
|
||||
var key = new Key(choice.ContourOrdinal, choice.EntityOrdinal,
|
||||
choice.Point.X, choice.Point.Y, nodeContext ?? string.Empty);
|
||||
|
||||
@@ -176,12 +176,14 @@ public class ContourEntryFeasibilityTests
|
||||
var (other, _, _) = PreparedSquare();
|
||||
var forgedContour = choice with { Owner = other, ContourOrdinal = 99 };
|
||||
var forgedEntity = choice with { Owner = prepared, EntityOrdinal = 99 };
|
||||
var forgedOwnedContour = choice with { Owner = prepared, ContourOrdinal = 99 };
|
||||
var feasibility = new ContourEntryFeasibility(prepared, At, own, []);
|
||||
|
||||
var verdict = feasibility.Check(forgedContour);
|
||||
Assert.Equal(ContourFeasibilityStatus.Incomplete, verdict.Status);
|
||||
Assert.False(string.IsNullOrEmpty(verdict.Reason));
|
||||
Assert.Equal(ContourFeasibilityStatus.Incomplete, feasibility.Check(forgedEntity).Status);
|
||||
Assert.Equal(ContourFeasibilityStatus.Incomplete, feasibility.Check(forgedOwnedContour).Status);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
||||
Reference in new issue
Block a user