From 40499a43608bf60d1104cd8ee24caf18ac0e9e66 Mon Sep 17 00:00:00 2001 From: Eric Rakestraw Date: Mon, 12 Oct 2026 17:45:35 +0000 Subject: [PATCH] Check default YAML output semantically --- docs/roadmap/remediation.md | 17 +++++++++++++---- integrations/ckprompt/command_test.go | 5 +++-- 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/docs/roadmap/remediation.md b/docs/roadmap/remediation.md index 63ff552..2b45598 100644 --- a/docs/roadmap/remediation.md +++ b/docs/roadmap/remediation.md @@ -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. diff --git a/integrations/ckprompt/command_test.go b/integrations/ckprompt/command_test.go index 309dde9..3ad797c 100644 --- a/integrations/ckprompt/command_test.go +++ b/integrations/ckprompt/command_test.go @@ -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()) } }