Check PromptKit capabilities without assuming their order
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
# CommandKit implementation review remediation
|
||||
|
||||
Status: R-1 through R-5 are complete; R-6 is open. This document
|
||||
Status: all six findings are complete. This document
|
||||
tracks required follow-up work and its completion evidence.
|
||||
|
||||
## ConfigKit review baseline and scope
|
||||
@@ -294,12 +294,13 @@ availability. Formatting and documentation checks passed.
|
||||
|
||||
## R-6: Test comparison capability membership rather than its slice position
|
||||
|
||||
**Status:** Open. **Priority:** Low. **Category:** Inadvertently strengthened
|
||||
**Status:** Complete. **Priority:** Low. **Category:** Inadvertently strengthened
|
||||
test invariant.
|
||||
|
||||
**Evidence:** [adapters_test.go](../../integrations/ckprompt/adapters_test.go),
|
||||
**Evidence:** At the review baseline,
|
||||
[adapters_test.go](../../integrations/ckprompt/adapters_test.go),
|
||||
`TestConfigScopeCompareUsesNativeDiffAndLoadsBothEqualSelections`, line 165,
|
||||
requires `scope.Operations[4] == ckconfig.Diff`. The accepted requirement is that
|
||||
required `scope.Operations[4] == ckconfig.Diff`. The accepted requirement is that
|
||||
the bundled scope supports its ordinary operations and comparison; it does not
|
||||
assign Diff a public position in the returned declaration slice.
|
||||
|
||||
@@ -318,3 +319,14 @@ operator ordering contract.
|
||||
**Completion evidence:** The test still rejects missing comparison wiring or
|
||||
capabilities, but accepts an equivalent ordering of the same declared operations.
|
||||
It introduces no new public ordering guarantee or unrelated runtime changes.
|
||||
|
||||
**Completed 2026-10-12:** The adapter test now checks comparison wiring and
|
||||
membership of the five required capabilities using `slices.Contains`, without
|
||||
requiring a particular position or slice length. Native-result, side-input,
|
||||
shared-state, and ordered-loader assertions remain intact. Temporary Go overlays
|
||||
confirmed that the focused test accepts reordered capabilities and rejects
|
||||
missing Diff or a missing comparison provider. The full ckprompt suite,
|
||||
including its composed consumer, passed with `GOWORK=off GOTOOLCHAIN=local`,
|
||||
`-mod=readonly`, and `-count=1`, using fresh copied manifests with only local
|
||||
prerequisite replacements. Production code and module metadata were unchanged;
|
||||
the overlays were not retained. Formatting and documentation checks passed.
|
||||
|
||||
@@ -6,6 +6,7 @@ import (
|
||||
"errors"
|
||||
"io"
|
||||
"reflect"
|
||||
"slices"
|
||||
"strings"
|
||||
"testing"
|
||||
"testing/fstest"
|
||||
@@ -162,9 +163,14 @@ func TestConfigScopeCompareUsesNativeDiffAndLoadsBothEqualSelections(t *testing.
|
||||
}
|
||||
return rightEngine, nil
|
||||
})
|
||||
if scope.Compare == nil || len(scope.Operations) != 5 || scope.Operations[4] != ckconfig.Diff {
|
||||
if scope.Compare == nil {
|
||||
t.Fatalf("configuration scope does not declare comparison: %#v", scope)
|
||||
}
|
||||
for _, operation := range []ckconfig.Operation{ckconfig.Validate, ckconfig.Show, ckconfig.Sources, ckconfig.Explain, ckconfig.Diff} {
|
||||
if !slices.Contains(scope.Operations, operation) {
|
||||
t.Fatalf("configuration scope is missing operation %q: %#v", operation, scope.Operations)
|
||||
}
|
||||
}
|
||||
|
||||
selection := ckconfig.Selection{Config: commandkit.Supplied[string]{Value: "same-selection.yml", Set: true}}
|
||||
state := new(int)
|
||||
|
||||
Reference in New Issue
Block a user