fix(cutting): expose every unverified warning before consent

This commit is contained in:
aj committed 2026-10-08 13:50:12 -04:00
1 parent f50705c491
commit 7e887921ea
4 files changed
+28 -5

No files matched your search

@@ -343,10 +343,10 @@ public sealed class CuttingPlanProposal
{
yield return heading + $"best-effort, unverified. {Count(plate.PartCount, "part")}, "
+ $"{plate.RegeneratedCount} regenerated; review lead-ins and cutting order.";
foreach (var line in Limit(DescribeOverlap(plate.Overlap)))
yield return line;
foreach (var line in Limit(result.Findings.Select(DescribeFinding)))
yield return line;
// Unverified Apply requires the operator to see every finding, not just a
// bounded diagnostic summary that hides later parts behind "... and N more".
foreach (var line in DescribeOverlap(plate.Overlap).Concat(result.Findings.Select(DescribeFinding)))
yield return " - " + line;
yield break;
}
@@ -25,6 +25,25 @@ public class BestEffortCuttingPlanTests
Assert.True(ProgramContent.Equal(original, part.BaseDrawing.Program));
}
[Fact]
public void UnverifiedSummary_ShowsEveryWarningBeforeAcceptance()
{
var parts = Enumerable.Range(0, 6).Select(index =>
{
var part = TouchingContours();
part.Offset(index * 12, 0);
return part;
}).ToArray();
var proposal = CuttingPlanBatch.Capture([Plate(parts)], ExplicitContourTests.Parameters(), false).Plan();
Assert.True(proposal.RequiresWarningAcceptance);
var findings = Assert.Single(proposal.Plates).Result.Findings.ToArray();
Assert.True(findings.Length > 5);
Assert.Contains(findings, finding => finding.SourceOrdinal == 5);
var summary = string.Join("\n", proposal.Describe("in"));
Assert.Contains("Part 6", summary);
Assert.DoesNotContain("... and", summary);
}
[Fact]
public void AcceptWarnings_InstallsOwnedProgramsAndLeavesStrictApplyClosed()
{
+2
View File
@@ -57,6 +57,8 @@ public partial class CuttingPlanForm : Form
this.isOperationBusy = isOperationBusy;
unit = UnitsHelper.GetShortString(nest.Units);
InitializeComponent();
// Best-effort acceptance must be able to display every warning, even on large jobs.
summaryBox.MaxLength = int.MaxValue;
// Captured once: when Application.DoEvents ends the outermost message loop, WinForms
// uninstalls its ambient context, so progress and results must not depend on whichever
// context is current when planning starts.
+3 -1
View File
@@ -314,7 +314,9 @@ plans every plate that has parts. Both open one dialog built on
says the order was kept. Both are allowed 400 expansions per part (at least the
default 20000), because both still plan contour order and entries for every part.
- The summary lists every plate: ready plates with part counts and rapid travel, others
with their status and findings. Finding part numbers are the plate's current order, as the
with their status and findings. Unverified proposals show every overlap and route
warning in the scrollable summary before the acceptance checkbox is used; they do
not truncate later parts' warnings. Finding part numbers are the plate's current order, as the
editor numbers them. The preview shows the active plate detached from the nest (quantity
zero, so drawing quantities do not change) in the proposed order with the proposed
programs. Ready and best-effort proposals can be previewed only while the plate still