Check default YAML output semantically

This commit is contained in:
2026-10-12 17:45:35 +00:00
parent e5faa1855d
commit 40499a4360
2 changed files with 16 additions and 6 deletions

View File

@@ -1,7 +1,7 @@
# PromptKit requirements inspection review
Status: R-1 and R-2 completed; R-3 open. This document records follow-up work;
the review does not change implementation or current contracts.
Status: all three findings completed. This document records review and remediation
evidence; production behavior and selected contracts are unchanged.
## Review scope and authority
@@ -99,7 +99,7 @@ and report coverage; a field-inventory check, local links/fragments, and
## R-3: Remove an incidental YAML key-order requirement from a test
Status: open. Priority: low. Category: inadvertently strengthened test contract.
Status: completed. Priority: low. Category: inadvertently strengthened test contract.
**Evidence:** `TestRequirementsCommandCapturesContextAndVariableAssignments` in
[command_test.go](../../integrations/ckprompt/command_test.go), lines 190–192,
@@ -122,6 +122,14 @@ the CLI documentation to justify the current test.
mapping-key order or document-marker style. Run the affected requirements test
and owning module suite after changing the assertion.
**Completed:** Replaced the prefix assertion with decoding into a fresh YAML map
and checking the selected prompt identity. Existing success, invocation lifecycle,
and empty-context assertions remain intact. `gofmt` and `git diff --check` passed.
From `integrations/ckprompt`, both
`GOTOOLCHAIN=local go test -count=1 -run '^TestRequirementsCommandCapturesContextAndVariableAssignments$' .`
and `GOTOOLCHAIN=local go test -count=1 ./...` passed, including the composed
consumer. The test no longer requires a mapping-key order or document-marker style.
## Review validation
At reviewed commit `cfc2d1d`, on Go 1.26.8:
@@ -148,4 +156,5 @@ At reviewed commit `cfc2d1d`, on Go 1.26.8:
PromptKit v0.14.0's known lack of a public fixture path for successful engine
configuration warnings remains a validation limitation, not a new implementation
gap. Existing custom-callback coverage exercises command diagnostic handling.
These passing checks do not resolve the three findings above.
Those review-time checks preceded remediation; completion evidence is recorded
under each finding above.

View File

@@ -187,8 +187,9 @@ func TestRequirementsCommandCapturesContextAndVariableAssignments(t *testing.T)
if len(received.Inspection.Vars) != 0 || received.Inspection.PromptVersion != "" || received.Inspection.ProfileID != "" || received.Inspection.SessionID != "" {
t.Fatalf("second invocation retained native values: %#v", received.Inspection)
}
if !strings.HasPrefix(output.String(), "prompt_id:") {
t.Fatalf("omitted format did not default to YAML: %q", output.String())
var defaultReport map[string]any
if err := yaml.Unmarshal(output.Bytes(), &defaultReport); err != nil || defaultReport["prompt_id"] != "briefing" {
t.Fatalf("omitted format did not produce the selected prompt's YAML report: %#v (decode error %v), output=%q", defaultReport, err, output.String())
}
}