Check validation diagnostics without fixing their layout

This commit is contained in:
2026-10-12 23:43:16 +00:00
parent 775c32479d
commit 5f633e3fee
2 changed files with 14 additions and 3 deletions

View File

@@ -1,6 +1,6 @@
# PromptKit request validation review remediation
Status: one open finding; R-1 complete. No production-code correction or
Status: complete; R-1 and R-2 addressed. No production-code correction or
architectural redesign was identified as necessary.
## Review scope and evidence
@@ -81,7 +81,7 @@ including the composed consumer. Production code is unchanged.
## R-2: Replace the complete provider-failure stderr snapshot
Status: open. Severity: low. Category: unnecessary presentation constraint in a test.
Status: complete. Severity: low. Category: unnecessary presentation constraint in a test.
**Location:**
[validation_command_test.go](../../integrations/ckprompt/validation_command_test.go),
@@ -110,3 +110,11 @@ of bytes explicitly supplied by the test's own writer.
**Completion evidence:** The focused test and ckprompt suite pass and still
detect lost or duplicate diagnostics without fixing incidental error decoration
or line layout. Preserve current production delivery behavior and order.
**Completed:** 2026-10-12. Replaced the failed-stderr snapshot with independent
single-occurrence checks for the synthetic warning and provider error. Retained
operational classification, status, cause identity, and diagnostic payload
checks, and verified complete diagnostic delivery. The focused
`TestValidationCommandRetainsProviderDiagnosticsAndClassifiesFailures` test and
`GOTOOLCHAIN=local go test -count=1 ./...` passed from `integrations/ckprompt`,
including the composed consumer. Production formatting and delivery are unchanged.

View File

@@ -388,9 +388,12 @@ func TestValidationCommandRetainsProviderDiagnosticsAndClassifiesFailures(t *tes
}}))
diagnostics.Reset()
outcome = failedApp.Execute(context.Background(), []string{"promptkit", "requirements", "validate", "briefing"}, commandkit.Streams{Out: io.Discard, Err: &diagnostics})
if outcome.Kind != commandkit.OutcomeOperational || outcome.Status != 1 || !errors.Is(outcome.Cause, providerErr) || !withWarning(outcome.Diagnostics) || diagnostics.String() != "validation warning\nvalidation provider failed\n" {
if outcome.Kind != commandkit.OutcomeOperational || outcome.Status != 1 || !errors.Is(outcome.Cause, providerErr) || !withWarning(outcome.Diagnostics) || outcome.DiagnosticDelivery != commandkit.DeliveryComplete {
t.Fatalf("provider failure = %#v, stderr=%q", outcome, diagnostics.String())
}
if strings.Count(diagnostics.String(), "validation warning") != 1 || strings.Count(diagnostics.String(), providerErr.Error()) != 1 {
t.Fatalf("provider diagnostics were lost or duplicated: stderr=%q", diagnostics.String())
}
builderErr := errors.New("request builder failed")
loaderCalls := 0