Build artifact inventories only for pipeline run reports
Some checks failed
ci/woodpecker/push/verify Pipeline was canceled
Some checks failed
ci/woodpecker/push/verify Pipeline was canceled
This commit is contained in:
@@ -17,6 +17,10 @@ and remote-lock inspection while the context remains active. Preparation success
|
|||||||
is persisted even when later readiness fails; readiness itself creates no stage
|
is persisted even when later readiness fails; readiness itself creates no stage
|
||||||
or reusable success record.
|
or reusable success record.
|
||||||
|
|
||||||
|
Shared finalization retains terminal manifest evidence while locked. Normal
|
||||||
|
pipeline execution projects that evidence into its run-artifact inventory;
|
||||||
|
standalone preflight returns its readiness report without building that inventory.
|
||||||
|
|
||||||
Audita receives verified prepared glossary files and production selections with
|
Audita receives verified prepared glossary files and production selections with
|
||||||
an embedded synthetic transcript. Its adapter performs native provider smoke
|
an embedded synthetic transcript. Its adapter performs native provider smoke
|
||||||
checks and retains failure causes. Notarius receives production controls and
|
checks and retains failure causes. Notarius receives production controls and
|
||||||
|
|||||||
@@ -5,7 +5,8 @@ Reviewed baseline: `b2877c1`.
|
|||||||
Scope: the seven stages of [the implementation plan](implementation.md), with
|
Scope: the seven stages of [the implementation plan](implementation.md), with
|
||||||
attention to algorithmic cost in their shared collaborators. The findings below
|
attention to algorithmic cost in their shared collaborators. The findings below
|
||||||
are optimization opportunities for consideration, not demonstrated operational
|
are optimization opportunities for consideration, not demonstrated operational
|
||||||
failures or release blockers. No refactors were implemented in this audit.
|
failures or release blockers. The audit made no application changes; completion
|
||||||
|
notes below record subsequent remediation. Both findings are now complete.
|
||||||
|
|
||||||
The selected prepare/resume machinery, pure transcript-work projection,
|
The selected prepare/resume machinery, pure transcript-work projection,
|
||||||
enabled-versus-projected target selection, and independent native checks remain
|
enabled-versus-projected target selection, and independent native checks remain
|
||||||
@@ -65,7 +66,16 @@ unchanged. Avoid timing thresholds or a new diagnostic-count limit.
|
|||||||
|
|
||||||
## 2. Avoid Building A Discarded Run-Artifact Inventory
|
## 2. Avoid Building A Discarded Run-Artifact Inventory
|
||||||
|
|
||||||
Status: Open for consideration. Priority: P3.
|
Status: Complete. Priority: P3.
|
||||||
|
|
||||||
|
Completion: shared finalization now returns a lightweight invocation result with
|
||||||
|
terminal manifest evidence. Only normal pipeline execution builds the full run
|
||||||
|
summary and artifact inventory; standalone preflight does not traverse or sort
|
||||||
|
that inventory. Terminal persistence and durable-evidence recovery remain under
|
||||||
|
the session lock, and normal summary completion includes lock-release failures.
|
||||||
|
Updated lifecycle tests and internal documentation. Verified with Go 1.27.4:
|
||||||
|
`go test ./...`, `go test -race ./...`, `go vet ./...`, `go build ./...`, focused
|
||||||
|
application/preflight/documentation tests, and `git diff --check`.
|
||||||
|
|
||||||
Evidence: [standalone lifecycle caller](../../internal/app/session_readiness.go),
|
Evidence: [standalone lifecycle caller](../../internal/app/session_readiness.go),
|
||||||
lines 79–90, and [finalization](../../internal/app/runner_finalization.go),
|
lines 79–90, and [finalization](../../internal/app/runner_finalization.go),
|
||||||
|
|||||||
@@ -46,10 +46,14 @@ func executePlan(ctx context.Context, cfg *config.Config, plan BoundedPlan, opts
|
|||||||
}
|
}
|
||||||
|
|
||||||
func executePlanWithDependencies(ctx context.Context, cfg *config.Config, plan BoundedPlan, opts RunOptions, dependencies invocationDependencies) (*RunSummary, error) {
|
func executePlanWithDependencies(ctx context.Context, cfg *config.Config, plan BoundedPlan, opts RunOptions, dependencies invocationDependencies) (*RunSummary, error) {
|
||||||
return withLockedInvocation(ctx, cfg, plan, opts, dependencies, executeSelectedStages)
|
result, err := withLockedInvocation(ctx, cfg, plan, opts, dependencies, executeSelectedStages)
|
||||||
|
if result == nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return result.runSummary(err == nil), err
|
||||||
}
|
}
|
||||||
|
|
||||||
func withLockedInvocation(ctx context.Context, cfg *config.Config, plan BoundedPlan, opts RunOptions, dependencies invocationDependencies, operation func(*invocationRuntime) error) (summary *RunSummary, resultErr error) {
|
func withLockedInvocation(ctx context.Context, cfg *config.Config, plan BoundedPlan, opts RunOptions, dependencies invocationDependencies, operation func(*invocationRuntime) error) (result *invocationResult, resultErr error) {
|
||||||
dependencies = dependencies.normalized()
|
dependencies = dependencies.normalized()
|
||||||
runtime, err := prepareInvocation(ctx, cfg, plan, opts, dependencies)
|
runtime, err := prepareInvocation(ctx, cfg, plan, opts, dependencies)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -76,13 +80,10 @@ func withLockedInvocation(ctx context.Context, cfg *config.Config, plan BoundedP
|
|||||||
resultErr = errors.Join(resultErr, fmt.Errorf("release session lock: %w", releaseErr))
|
resultErr = errors.Join(resultErr, fmt.Errorf("release session lock: %w", releaseErr))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if summary != nil {
|
|
||||||
summary.Complete = resultErr == nil
|
|
||||||
}
|
|
||||||
}()
|
}()
|
||||||
defer func() {
|
defer func() {
|
||||||
if runtime.started {
|
if runtime.started {
|
||||||
summary, resultErr = finalizeInvocation(runtime, resultErr)
|
result, resultErr = finalizeInvocation(runtime, resultErr)
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
|
|
||||||
|
|||||||
@@ -28,7 +28,14 @@ type RunArtifact struct {
|
|||||||
Evidence string `json:"evidence"`
|
Evidence string `json:"evidence"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func finalizeInvocation(runtime *invocationRuntime, operationErr error) (*RunSummary, error) {
|
// invocationResult retains terminal evidence without projecting a report-specific
|
||||||
|
// artifact inventory. Preflight needs only whether the lifecycle started.
|
||||||
|
type invocationResult struct {
|
||||||
|
runtime *invocationRuntime
|
||||||
|
evidence *manifest.Manifest
|
||||||
|
}
|
||||||
|
|
||||||
|
func finalizeInvocation(runtime *invocationRuntime, operationErr error) (*invocationResult, error) {
|
||||||
evidence := runtime.manifest
|
evidence := runtime.manifest
|
||||||
resultErr := operationErr
|
resultErr := operationErr
|
||||||
if operationErr != nil {
|
if operationErr != nil {
|
||||||
@@ -42,13 +49,18 @@ func finalizeInvocation(runtime *invocationRuntime, operationErr error) (*RunSum
|
|||||||
evidence = nil
|
evidence = nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return &invocationResult{runtime: runtime, evidence: evidence}, resultErr
|
||||||
|
}
|
||||||
|
|
||||||
|
func (result *invocationResult) runSummary(complete bool) *RunSummary {
|
||||||
|
runtime := result.runtime
|
||||||
return &RunSummary{
|
return &RunSummary{
|
||||||
SessionID: runtime.identity.SessionID, RunID: runtime.identity.RunID,
|
SessionID: runtime.identity.SessionID, RunID: runtime.identity.RunID,
|
||||||
ManifestPath: runtime.manifestPath, StageNames: runtime.stageNames,
|
ManifestPath: runtime.manifestPath, StageNames: runtime.stageNames,
|
||||||
Executed: runtime.executed, Skipped: runtime.skipped,
|
Executed: runtime.executed, Skipped: runtime.skipped,
|
||||||
StageResults: runtime.stageResults, AvailableArtifacts: durableRunArtifacts(evidence),
|
StageResults: runtime.stageResults, AvailableArtifacts: durableRunArtifacts(result.evidence),
|
||||||
Complete: resultErr == nil,
|
Complete: complete,
|
||||||
}, resultErr
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func durableRunArtifacts(m *manifest.Manifest) []RunArtifact {
|
func durableRunArtifacts(m *manifest.Manifest) []RunArtifact {
|
||||||
|
|||||||
@@ -76,11 +76,11 @@ func inspectConfiguredSessionReadiness(ctx context.Context, cfg *config.Config,
|
|||||||
newObjectStore: func(ctx context.Context, cfg *config.Config) (storage.ObjectStore, error) {
|
newObjectStore: func(ctx context.Context, cfg *config.Config) (storage.ObjectStore, error) {
|
||||||
return initializeObjectStoreBackend(ctx, cfg, deps.newObjectStore)
|
return initializeObjectStoreBackend(ctx, cfg, deps.newObjectStore)
|
||||||
}}
|
}}
|
||||||
summary, err := withLockedInvocation(ctx, cfg, plan, RunOptions{Reporter: deps.reporter}, invocationDeps, func(runtime *invocationRuntime) error {
|
result, err := withLockedInvocation(ctx, cfg, plan, RunOptions{Reporter: deps.reporter}, invocationDeps, func(runtime *invocationRuntime) error {
|
||||||
report.RunID = runtime.identity.RunID
|
report.RunID = runtime.identity.RunID
|
||||||
return assessSessionReadiness(runtime, report, deps)
|
return assessSessionReadiness(runtime, report, deps)
|
||||||
})
|
})
|
||||||
if summary == nil && err != nil {
|
if result == nil && err != nil {
|
||||||
report.Findings = append(report.Findings, errorFinding("workspace", err.Error()))
|
report.Findings = append(report.Findings, errorFinding("workspace", err.Error()))
|
||||||
report.Checks = append(report.Checks, readinessCheck{Group: "workspace/storage", Outcome: "failed", Message: err.Error()})
|
report.Checks = append(report.Checks, readinessCheck{Group: "workspace/storage", Outcome: "failed", Message: err.Error()})
|
||||||
} else if err != nil {
|
} else if err != nil {
|
||||||
|
|||||||
@@ -165,9 +165,9 @@ func TestPreflightReportsPreparationPersistenceAndFinalizationFailures(t *testin
|
|||||||
}
|
}
|
||||||
report := &sessionReadinessReport{Preparation: preparationAssessment{Outcome: "not_attempted"}}
|
report := &sessionReadinessReport{Preparation: preparationAssessment{Outcome: "not_attempted"}}
|
||||||
invDeps := invocationDependencies{newAudita: deps.newAudita, newScriptorium: deps.newScriptorium, newNotarius: deps.newNotarius}
|
invDeps := invocationDependencies{newAudita: deps.newAudita, newScriptorium: deps.newScriptorium, newNotarius: deps.newNotarius}
|
||||||
summary, err := withLockedInvocation(context.Background(), cfg, plan, RunOptions{Env: &Env{ManifestStore: mstore, ArtifactStore: local}}, invDeps, func(runtime *invocationRuntime) error { return assessSessionReadiness(runtime, report, deps) })
|
result, err := withLockedInvocation(context.Background(), cfg, plan, RunOptions{Env: &Env{ManifestStore: mstore, ArtifactStore: local}}, invDeps, func(runtime *invocationRuntime) error { return assessSessionReadiness(runtime, report, deps) })
|
||||||
if summary == nil || summary.Complete || !errors.Is(err, releaseFailure) {
|
if result == nil || !errors.Is(err, releaseFailure) {
|
||||||
t.Fatalf("summary=%+v report=%+v error=%v", summary, report, err)
|
t.Fatalf("result=%+v report=%+v error=%v", result, report, err)
|
||||||
}
|
}
|
||||||
if failureAt == "preparation" {
|
if failureAt == "preparation" {
|
||||||
if report.Preparation.Outcome != "failed" || len(provider.PreflightRequests) != 0 {
|
if report.Preparation.Outcome != "failed" || len(provider.PreflightRequests) != 0 {
|
||||||
@@ -204,11 +204,11 @@ func TestPreflightCannotSucceedWithoutPreparedEvidence(t *testing.T) {
|
|||||||
deps := normalizeCommandDependencies(fakeCommandDependencies(&storage.FakeBackend{}, nil))
|
deps := normalizeCommandDependencies(fakeCommandDependencies(&storage.FakeBackend{}, nil))
|
||||||
report := &sessionReadinessReport{Preparation: preparationAssessment{Outcome: "not_attempted"}}
|
report := &sessionReadinessReport{Preparation: preparationAssessment{Outcome: "not_attempted"}}
|
||||||
plan := BoundedPlan{stages: []stage.Stage{resultStage{name: "prepare", result: &stage.StageResult{Disposition: stage.StageDispositionSkipped, SkipReason: "no inputs"}}}}
|
plan := BoundedPlan{stages: []stage.Stage{resultStage{name: "prepare", result: &stage.StageResult{Disposition: stage.StageDispositionSkipped, SkipReason: "no inputs"}}}}
|
||||||
summary, err := withLockedInvocation(context.Background(), cfg, plan, RunOptions{}, invocationDependencies{newAudita: deps.newAudita, newScriptorium: deps.newScriptorium}, func(runtime *invocationRuntime) error {
|
result, err := withLockedInvocation(context.Background(), cfg, plan, RunOptions{}, invocationDependencies{newAudita: deps.newAudita, newScriptorium: deps.newScriptorium}, func(runtime *invocationRuntime) error {
|
||||||
return assessSessionReadiness(runtime, report, deps)
|
return assessSessionReadiness(runtime, report, deps)
|
||||||
})
|
})
|
||||||
if err == nil || summary == nil || summary.Complete || report.Preparation.Outcome != "failed" {
|
if err == nil || result == nil || report.Preparation.Outcome != "failed" {
|
||||||
t.Fatalf("summary=%+v report=%+v error=%v", summary, report, err)
|
t.Fatalf("result=%+v report=%+v error=%v", result, report, err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user