Allow early missing-selector failures in validation tests
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
# PromptKit request validation review remediation
|
# 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.
|
architectural redesign was identified as necessary.
|
||||||
|
|
||||||
## Review scope and evidence
|
## 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
|
## 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:**
|
**Location:**
|
||||||
[validation_command_test.go](../../integrations/ckprompt/validation_command_test.go),
|
[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
|
missing-selector case accepts early failure before application input allocation
|
||||||
without losing its guards against later work. No production change is required.
|
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
|
## R-2: Replace the complete provider-failure stderr snapshot
|
||||||
|
|
||||||
Status: open. Severity: low. Category: unnecessary presentation constraint in a test.
|
Status: open. Severity: low. Category: unnecessary presentation constraint in a test.
|
||||||
|
|||||||
@@ -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})
|
outcome := newPromptTestApp(t, Command(suite)).Execute(context.Background(), test.args, commandkit.Streams{Out: io.Discard, Err: io.Discard})
|
||||||
wantInputCalls := 0
|
if outcome.Kind != commandkit.OutcomeUsage || outcome.Status != 2 || checkCalls != 0 || newStateCalls != 0 || providerCalls != 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 {
|
|
||||||
t.Fatalf("preflight failure = %#v, input/check/state/provider=%d/%d/%d/%d", outcome, newInputCalls, checkCalls, newStateCalls, providerCalls)
|
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)
|
||||||
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user