Run downstream preflight after preparation

This commit is contained in:
2026-11-27 16:45:46 +00:00
parent b9b154e59e
commit d178e2c437
8 changed files with 256 additions and 34 deletions

View File

@@ -12,6 +12,11 @@ import (
// NoopRunner is a deterministic no-op audita adapter.
type NoopRunner struct{}
// Preflight accepts the synthetic request in no-op environments.
func (*NoopRunner) Preflight(ctx context.Context, _ PolishRequest) (PreflightResult, error) {
return PreflightResult{}, ctx.Err()
}
// Run returns requested output path with placeholder metadata.
func (n *NoopRunner) Run(ctx context.Context, req PolishRequest) (PolishResult, error) {
if err := ctx.Err(); err != nil {
@@ -31,9 +36,20 @@ func (n *NoopRunner) Run(ctx context.Context, req PolishRequest) (PolishResult,
// FakeRunner captures polish requests and returns deterministic responses.
type FakeRunner struct {
Requests []PolishRequest
Err error
Result PolishResult
Requests []PolishRequest
Err error
Result PolishResult
PreflightRequests []PolishRequest
PreflightErr error
}
// Preflight records a readiness request in deterministic tests.
func (f *FakeRunner) Preflight(ctx context.Context, req PolishRequest) (PreflightResult, error) {
if err := ctx.Err(); err != nil {
return PreflightResult{}, err
}
f.PreflightRequests = append(f.PreflightRequests, req)
return PreflightResult{}, f.PreflightErr
}
// Run records request and returns configured response.