Allow early missing-selector failures in validation tests

This commit is contained in:
2026-10-12 23:42:18 +00:00
parent 99e2089e75
commit 775c32479d
2 changed files with 14 additions and 9 deletions

View File

@@ -1,6 +1,6 @@
# PromptKit request validation review remediation
Status: two open findings; review complete. No production-code correction or
Status: one open finding; R-1 complete. No production-code correction or
architectural redesign was identified as necessary.
## Review scope and evidence
@@ -42,7 +42,7 @@ without changing production behavior or expanding public contracts.
## R-1: Remove the required factory call after missing-selector failure
Status: open. Severity: low. Category: unintended lifecycle guarantee in a test.
Status: complete. Severity: low. Category: unintended lifecycle guarantee in a test.
**Location:**
[validation_command_test.go](../../integrations/ckprompt/validation_command_test.go),
@@ -71,6 +71,14 @@ Keep successful-invocation and help/version lifecycle coverage.
missing-selector case accepts early failure before application input allocation
without losing its guards against later work. No production change is required.
**Completed:** 2026-10-12. Removed the missing-selector factory-count requirement
and private-ordering comment. Usage classification and checks preventing input
checks, state creation, and provider work remain; syntax/format cases still
require zero input-factory calls. The focused
`TestValidationCommandUsageAndInputFailuresStopProviderWork` test and
`GOTOOLCHAIN=local go test -count=1 ./...` passed from `integrations/ckprompt`,
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.

View File

@@ -273,15 +273,12 @@ func TestValidationCommandUsageAndInputFailuresStopProviderWork(t *testing.T) {
},
}
outcome := newPromptTestApp(t, Command(suite)).Execute(context.Background(), test.args, commandkit.Streams{Out: io.Discard, Err: io.Discard})
wantInputCalls := 0
if test.name == "missing required selector" {
// prepareSuiteInput initializes the caller input before core validates
// captured required bindings; CheckInput and provider work still stop.
wantInputCalls = 1
}
if outcome.Kind != commandkit.OutcomeUsage || outcome.Status != 2 || newInputCalls != wantInputCalls || checkCalls != 0 || newStateCalls != 0 || providerCalls != 0 {
if outcome.Kind != commandkit.OutcomeUsage || outcome.Status != 2 || checkCalls != 0 || newStateCalls != 0 || providerCalls != 0 {
t.Fatalf("preflight failure = %#v, input/check/state/provider=%d/%d/%d/%d", outcome, newInputCalls, checkCalls, newStateCalls, providerCalls)
}
if test.name != "missing required selector" && newInputCalls != 0 {
t.Fatalf("syntax or format failure invoked input factory %d times", newInputCalls)
}
})
}