Run processing from the prepared invocation

This commit is contained in:
2026-11-27 01:17:45 +00:00
parent 2dc057b97e
commit b4bc5e5640
12 changed files with 133 additions and 66 deletions

View File

@@ -5,6 +5,7 @@ import (
"gitea.maximumdirect.net/eric/audita/v4/internal/core/config"
"gitea.maximumdirect.net/eric/audita/v4/internal/core/schema"
"gitea.maximumdirect.net/eric/audita/v4/internal/framework/contracts"
"gitea.maximumdirect.net/eric/audita/v4/internal/framework/preflight"
"gitea.maximumdirect.net/eric/audita/v4/internal/framework/structuredoutput"
)
@@ -26,5 +27,5 @@ func preparedTestInput(input testRunInput) RunInput {
if err != nil {
panic(err)
}
return RunInput{Sections: sections, Transcript: input.Transcript, ModuleSpecs: input.ModuleSpecs, Interactions: input.Interactions, Evidence: input.Evidence, Progress: input.Progress}
return RunInput{Plan: &preflight.Plan{Sections: sections, Transcript: input.Transcript, Specs: input.ModuleSpecs, Config: input.Config}, Interactions: input.Interactions, Evidence: input.Evidence, Progress: input.Progress}
}

View File

@@ -14,6 +14,7 @@ import (
"gitea.maximumdirect.net/eric/audita/v4/internal/core/schema"
"gitea.maximumdirect.net/eric/audita/v4/internal/framework/contracts"
"gitea.maximumdirect.net/eric/audita/v4/internal/framework/outcomes"
"gitea.maximumdirect.net/eric/audita/v4/internal/framework/preflight"
"gitea.maximumdirect.net/eric/audita/v4/internal/framework/promptcontext"
"gitea.maximumdirect.net/eric/audita/v4/internal/framework/proposals"
"gitea.maximumdirect.net/eric/audita/v4/internal/framework/structuredoutput"
@@ -113,9 +114,7 @@ func selectEvidence(selection *EvidenceSelection) evidenceNeeds {
// RunInput is the deterministic runner input.
type RunInput struct {
Sections []chunking.Section
Transcript *schema.Transcript
ModuleSpecs []contracts.ModuleRunSpec
Plan *preflight.Plan
Interactions structuredoutput.InteractionSink
Evidence *EvidenceSelection
Progress func(Progress)
@@ -138,16 +137,16 @@ func New(factory ModuleFactory) *Runner {
func (r *Runner) Run(ctx context.Context, input RunInput) (RunOutput, error) {
if err := ctx.Err(); err != nil {
return RunOutput{FinalTranscript: input.Transcript.Clone()}, &ExecutionFailure{Phase: "processing", Cause: err}
return RunOutput{FinalTranscript: input.Plan.Transcript.Clone()}, &ExecutionFailure{Phase: "processing", Cause: err}
}
if r == nil || r.factory == nil {
return RunOutput{}, &ExecutionFailure{Phase: "setup", Cause: errors.New("runner module factory is required")}
}
results := make([]ModuleResult, 0, len(input.ModuleSpecs))
sections := input.Sections
results := make([]ModuleResult, 0, len(input.Plan.Specs))
sections := input.Plan.Sections
evidence := selectEvidence(input.Evidence)
totals := outcomes.WorkTotals{Total: len(input.ModuleSpecs) * len(sections)}
totals := outcomes.WorkTotals{Total: len(input.Plan.Specs) * len(sections)}
var inventory []contracts.SectionMetadata
var workUnits []WorkUnitOutcome
var candidates []proposals.EnrichedCorrectionProposal
@@ -157,7 +156,7 @@ func (r *Runner) Run(ctx context.Context, input RunInput) (RunOutput, error) {
inventory[i] = contracts.SectionMetadataFromSection(section)
}
workUnits = make([]WorkUnitOutcome, 0, totals.Total)
for moduleIndex, spec := range input.ModuleSpecs {
for moduleIndex, spec := range input.Plan.Specs {
for _, section := range inventory {
workUnits = append(workUnits, newWorkUnit(spec, section, moduleIndex))
}
@@ -170,7 +169,7 @@ func (r *Runner) Run(ctx context.Context, input RunInput) (RunOutput, error) {
}
}
for moduleIndex, spec := range input.ModuleSpecs {
for moduleIndex, spec := range input.Plan.Specs {
progress := Progress{ModuleIndex: spec.Index, ModuleKey: spec.ModuleKey, ModuleID: spec.ID}
sectionCount := len(sections)
progress.emit(input.Progress, "started", nil, &sectionCount)