From 4801d0aac1a54df8b067394dcb7c169cd1476268 Mon Sep 17 00:00:00 2001 From: Eric Rakestraw Date: Sat, 28 Nov 2026 16:14:43 +0000 Subject: [PATCH] Skip preflight evidence setup when capture is disabled --- docs/roadmap/remediation.md | 8 ++++++++ internal/cli/pipeline_preflight.go | 22 +++++++++++++--------- 2 files changed, 21 insertions(+), 9 deletions(-) diff --git a/docs/roadmap/remediation.md b/docs/roadmap/remediation.md index c36f18fe..993f4b3f 100644 --- a/docs/roadmap/remediation.md +++ b/docs/roadmap/remediation.md @@ -1,5 +1,8 @@ # Pipeline Preflight Review Remediation +All five findings are implemented and individually verified. The audit text below +is retained as context; each finding's completion marker records its resolution. + ## Scope And Overall Assessment Reviewed implementation commit `c08e5ab` against all eleven stages of @@ -245,6 +248,11 @@ thresholds and production benchmarks are unnecessary. ## Finding 5: Skip Evidence Preparation When Capture Is Disabled +**Status: Complete.** Disabled capture now passes a nil smoke observer and never +constructs the evidence writer or its mask indexes. Enabled capture retains the +same evidence lifecycle. Focused enabled/disabled command, capture-failure, +native-verdict, and provider-count tests pass. + **Priority:** P3 — avoidable work; plan Stage 7. **Owner:** [Preflight command](../../internal/cli/pipeline_preflight.go), lines diff --git a/internal/cli/pipeline_preflight.go b/internal/cli/pipeline_preflight.go index bb53f72e..b4099692 100644 --- a/internal/cli/pipeline_preflight.go +++ b/internal/cli/pipeline_preflight.go @@ -176,16 +176,20 @@ func executePreflight(invocation commandkit.Invocation, input pipelineRunInput, add("debug", preflightScope{Path: capture.Path()}, "failed", err.Error()) return finish(commandkit.Failure(err.Error()).WithCause(err)) } - evidence := newRunEvidenceRecorder(capture, loaded.result) - evidenceIndex := 0 - observations, err := preflight.RunSmokeChecksObserved(ctx, selected.engine, targets, input.Overrides.Execution.Execution, input.Overrides.Execution.TransientRetries, func(observation preflight.SmokeObservation) error { - if observation.Report != nil { - err := evidence.WriteJSON(fmt.Sprintf("smoke/%03d.json", evidenceIndex), observation.Report) - evidenceIndex++ - return err + var observe func(preflight.SmokeObservation) error + if capture.Enabled() { + evidence := newRunEvidenceRecorder(capture, loaded.result) + evidenceIndex := 0 + observe = func(observation preflight.SmokeObservation) error { + if observation.Report != nil { + err := evidence.WriteJSON(fmt.Sprintf("smoke/%03d.json", evidenceIndex), observation.Report) + evidenceIndex++ + return err + } + return nil } - return nil - }) + } + observations, err := preflight.RunSmokeChecksObserved(ctx, selected.engine, targets, input.Overrides.Execution.Execution, input.Overrides.Execution.TransientRetries, observe) failedCheck := false for _, observation := range observations { if !observation.Applicable {