Skip preflight evidence setup when capture is disabled

This commit is contained in:
2026-11-28 16:14:43 +00:00
parent 00112f6fc2
commit 4801d0aac1
2 changed files with 21 additions and 9 deletions

View File

@@ -1,5 +1,8 @@
# Pipeline Preflight Review Remediation # 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 ## Scope And Overall Assessment
Reviewed implementation commit `c08e5ab` against all eleven stages of 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 ## 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. **Priority:** P3 — avoidable work; plan Stage 7.
**Owner:** [Preflight command](../../internal/cli/pipeline_preflight.go), lines **Owner:** [Preflight command](../../internal/cli/pipeline_preflight.go), lines

View File

@@ -176,16 +176,20 @@ func executePreflight(invocation commandkit.Invocation, input pipelineRunInput,
add("debug", preflightScope{Path: capture.Path()}, "failed", err.Error()) add("debug", preflightScope{Path: capture.Path()}, "failed", err.Error())
return finish(commandkit.Failure(err.Error()).WithCause(err)) return finish(commandkit.Failure(err.Error()).WithCause(err))
} }
evidence := newRunEvidenceRecorder(capture, loaded.result) var observe func(preflight.SmokeObservation) error
evidenceIndex := 0 if capture.Enabled() {
observations, err := preflight.RunSmokeChecksObserved(ctx, selected.engine, targets, input.Overrides.Execution.Execution, input.Overrides.Execution.TransientRetries, func(observation preflight.SmokeObservation) error { evidence := newRunEvidenceRecorder(capture, loaded.result)
if observation.Report != nil { evidenceIndex := 0
err := evidence.WriteJSON(fmt.Sprintf("smoke/%03d.json", evidenceIndex), observation.Report) observe = func(observation preflight.SmokeObservation) error {
evidenceIndex++ if observation.Report != nil {
return err 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 failedCheck := false
for _, observation := range observations { for _, observation := range observations {
if !observation.Applicable { if !observation.Applicable {