Record delegated configuration exit status gaps

This commit is contained in:
2026-11-16 03:32:19 +00:00
parent d226bdd697
commit e34672f7fe
2 changed files with 58 additions and 3 deletions

View File

@@ -51,6 +51,40 @@ input, and status 1 for cancellation. While the supporting release is pending,
record the mismatch explicitly. A test that asserts only nonzero status does
not verify this fix.
**Complete.** The upstream handoff is recorded below. The exit-status fix
remains outstanding for the final verification pass.
Build a temporary executable with `go build -o /tmp/audita-inspection ./cmd/audita`.
In a scratch directory, put `version: 3` in `config.yml`, `profiles: [` in the
adjacent `prompts.yml`, and `[]` in `transcript.json`. End each file with a newline.
| Invocation with `/tmp/audita-inspection` | Status | Diagnostic |
| --- | --- | --- |
| `promptkit list prompts --config config.yml` | 1 | `yaml.invalid` in `prompts.yml` |
| `process transcript.json --config config.yml` | 2 | `yaml.invalid` in `prompts.yml` |
| `config show --scope promptkit --config config.yml` | 1 | `yaml.invalid` in `prompts.yml` |
`config sources`, `config validate`, `config explain --list`, and
`config diff --against-config config.yml` also returned 1 for the `promptkit`
scope with the same diagnostic. All five `app` scope operations succeeded
with the malformed companion and returned 1 with `yaml.invalid` for a
separately selected main file containing `version: [`. These failures occur
during configuration loading, before provider work. The cancellation test
passes an already canceled context through the application entry point and
verifies status 1, `context.Canceled`, and empty stdout for catalog listing,
configuration show, and processing.
Both native adapters receive the typed ConfigKit load cause from Audita's
existing loaders. In `ckprompt`, `runCatalogList` assigns the operational
outcome through `definitionFailure`. In `ckconfig`, the scope handlers
assign it through `configFailure`, with `show` calling it through
`configAcquisitionFailure`. The upstream owners are the respective CommandKit
integrations. They need to assign status 2 for typed operator-input failures
at those boundaries, preserving diagnostics, available inspection evidence,
and the cause. Cancellation and other operational failures need status 1.
The upstream tag list contained releases through `v0.7.0` for each
integration, which are already pinned. Recheck both in the final stage.
## Stage 2 — Remove application credential substitution
Audit #3, #9, #31 (source bytes), #63–65. Use the

View File

@@ -3,10 +3,13 @@ package cli
import (
"bytes"
"context"
"errors"
"os"
"path/filepath"
"strings"
"testing"
commandkit "go.maximumdirect.net/commandkit"
)
func writeRuntimeErrorConfig(t *testing.T, operatorDocument string) string {
@@ -44,10 +47,28 @@ func TestResourceCommandsClassifyOperatorPromptErrorsAsInputErrors(t *testing.T)
func TestResourceCommandKeepsCallerCancellationAsFailure(t *testing.T) {
main := writeRuntimeErrorConfig(t, "profiles:\n - id: proposal\n model: local-model\n")
transcript := filepath.Join(filepath.Dir(main), "transcript.json")
if err := os.WriteFile(transcript, []byte("[]\n"), 0600); err != nil {
t.Fatal(err)
}
app, err := buildApplication()
if err != nil {
t.Fatal(err)
}
ctx, cancel := context.WithCancel(context.Background())
cancel()
var stdout, stderr bytes.Buffer
if code := Run(ctx, []string{"promptkit", "list", "prompts", "--config", main}, &stdout, &stderr); code == 0 {
t.Fatalf("cancellation succeeded: stdout=%q stderr=%q", stdout.String(), stderr.String())
commands := map[string][]string{
"prompt catalog": {"promptkit", "list", "prompts", "--config", main},
"configuration": {"config", "show", "--scope", "promptkit", "--config", main},
"process": {"process", transcript, "--config", main},
}
for name, args := range commands {
t.Run(name, func(t *testing.T) {
var stdout, stderr bytes.Buffer
outcome := app.Execute(ctx, args, commandkit.Streams{Out: &stdout, Err: &stderr})
if outcome.Status != 1 || !errors.Is(outcome.Cause, context.Canceled) || stdout.Len() != 0 {
t.Fatalf("cancellation: status=%d cause=%v stdout=%q stderr=%q", outcome.Status, outcome.Cause, stdout.String(), stderr.String())
}
})
}
}