Move native debug accounting into the CLI capture lifecycle

This commit is contained in:
2026-11-23 02:35:19 +00:00
parent 051a91e397
commit 88ebdbd819
5 changed files with 64 additions and 58 deletions

View File

@@ -58,7 +58,8 @@ func TestRunnerCapturesActualArtifactsAndNoExecutionOnReuse(t *testing.T) {
for _, reuse := range []bool{false, true} {
evidence := &nativeEvidence{}
var group promptkit.ExecutionGroup
output, err := New().Run(context.Background(), RunInput{Prepared: prepared, RawInput: []byte("input"), Cache: store, Debug: evidence, Executions: &group, Workers: 1})
ctx := promptkit.WithExecutionObserver(context.Background(), group.Observe)
output, err := New().Run(ctx, RunInput{Prepared: prepared, RawInput: []byte("input"), Cache: store, Debug: evidence, Workers: 1})
if err != nil || output.FallbackCount != 0 || calls != 1 {
t.Fatalf("run: %#v %v, calls=%d", output, err, calls)
}
@@ -82,10 +83,10 @@ func TestRunnerCapturesActualArtifactsAndNoExecutionOnReuse(t *testing.T) {
if reuse && nativeEvidenceCount(evidence, "/cache/hit-artifact.json") != 1 {
t.Fatal("reused artifact bytes not retained")
}
var snapshot promptkit.ExecutionGroupSummary
if err := json.Unmarshal(evidence.files["executions.json"], &snapshot); err != nil {
t.Fatal(err)
if _, ok := evidence.files["executions.json"]; ok {
t.Fatal("runner wrote a consumer-owned execution summary")
}
snapshot := group.Snapshot()
if len(snapshot.Members) != map[bool]int{false: 1, true: 0}[reuse] || !snapshot.TerminalCoverageComplete {
t.Fatalf("incorrect current-run totals: %#v", snapshot)
}