diff --git a/docs/cli.md b/docs/cli.md index df3fad3..28d0e12 100644 --- a/docs/cli.md +++ b/docs/cli.md @@ -91,9 +91,10 @@ The default is the full canonical pipeline: `--from` and `--through` select inclusive contiguous bounds. `--stage` selects one stage and cannot accompany explicitly supplied range flags. `--force` reruns selected work; dependent invalidation can extend beyond that range. -Bounded starts require valid preceding state or applicable supplied-product -coverage. When covered transcript work permits a downstream start, Narratio -prepares required references before downstream checks. Ordinary execution uses +Bounded starts use valid preceding state or an imported-product baseline. +In an imported workspace, selected consumers require their actual inputs; +unrelated producer-stage history is unnecessary. Narratio prepares required +references before downstream checks. Ordinary execution uses semantic resume checks rather than rerunning all selected work. After preparation, `run` checks projected Audita, Notarius, and Scriptorium work before diff --git a/docs/internal/artifacts.md b/docs/internal/artifacts.md index ef394dc..94a0c7c 100644 --- a/docs/internal/artifacts.md +++ b/docs/internal/artifacts.md @@ -182,6 +182,10 @@ Validation by content type: - merges required and optional references (required wins); - returns deterministic ordering and source locations. +`PreviousArtifactRequirementsForKeys` applies the same source collection to an +already planned set of generation keys. Bounded reference preparation uses it +after analysis planning has resolved supplied-product reuse boundaries. + ## Current-State Helpers Artifacts package owns shared remote current-state loading mechanics used by diff --git a/docs/internal/stage-prepare.md b/docs/internal/stage-prepare.md index c41ad6f..f88a4ff 100644 --- a/docs/internal/stage-prepare.md +++ b/docs/internal/stage-prepare.md @@ -35,7 +35,9 @@ Materialize canonical current-session inputs before processing stages. - bounded downstream runs may prepare or reuse references under the workspace lock before readiness checks, even when prepare lies outside the selected range. Existing audio input records remain available without being recertified by - reference-only preparation. + reference-only preparation. An imported configured or extraction product can + support this workflow without any transcript. Reference-only validation + explicitly excludes audio acquisition and source checks. - derives the party glossary and resolves the remaining named collections through `internal/glossary`; writes four individual shared envelopes and a combined envelope with checksums, sizes, and provenance. The combined record declares @@ -54,6 +56,8 @@ Materialize canonical current-session inputs before processing stages. - collects `narratio.previous_session.artifact.*` requirements from the selected targets and their full prerequisite closure, including disabled prerequisites; see [previous requirement collection](artifacts.md#previous-requirement-collection). + Bounded reference preparation uses the actual projected generation keys, + preserving history needed by new work while excluding reused products' history. - clears managed `inputs/previous/` state on every invocation, then, when requirements exist: - resolves the pointer-selected previous source through the shared resolver; - downloads declared previous artifacts; diff --git a/docs/roadmap/remediation.md b/docs/roadmap/remediation.md index c3646d2..adfe79f 100644 --- a/docs/roadmap/remediation.md +++ b/docs/roadmap/remediation.md @@ -51,7 +51,16 @@ inputs for independent supplied products, contrary to the agreed import model. ## 2. P2: Permit downstream continuation without a supplied transcript -Status: Open +Status: Complete + +Resolution: bounded import continuation checks actual consumer inputs rather +than requiring transcript-producer statuses. Reference-only acquisition and +reuse exclude audio checks and collect history for projected generation work. +The import context survives replacement of its last supplied product by a local +checkpoint. Regressions cover configured and extraction inputs, required +references, absent real inputs, historical-input exclusion, and local reuse +after an actual import/replacement. Verified with +`go test ./internal/app ./internal/stage ./internal/artifacts ./internal/config`. Affected stages: 5, 7, and 12. diff --git a/internal/app/bounded_prerequisites.go b/internal/app/bounded_prerequisites.go index d2a49e4..ae4dacd 100644 --- a/internal/app/bounded_prerequisites.go +++ b/internal/app/bounded_prerequisites.go @@ -14,11 +14,20 @@ func validateBoundedPrerequisites(plan BoundedPlan, m *manifest.Manifest, cfg *c return nil } coverage := suppliedCompletion(cfg, m) - hasTranscript := coverage["transcribe"] + supplied := hasSuppliedBaseline(m) for _, name := range plan.PrefixNames() { - if coverage[name] || (hasTranscript && (name == "prepare" || name == "render" || name == "extract")) { + if coverage[name] { continue } + if supplied { + // Imported products replace producer history as the starting point. + // Selected consumers validate their actual inputs. Publication and + // post-publication actions retain their own execution prerequisites. + switch name { + case "prepare", "transcribe", "merge", "polish", "normalize", "trim", "render", "extract", "analyze": + continue + } + } status := "absent" if m != nil && m.Stages != nil && m.Stages[name] != nil { stageStatus := m.Stages[name].Status diff --git a/internal/app/plan_command.go b/internal/app/plan_command.go index 184d465..3042b42 100644 --- a/internal/app/plan_command.go +++ b/internal/app/plan_command.go @@ -119,9 +119,13 @@ func buildSessionPlan(ctx context.Context, cfg *config.Config, input *executionI return nil, err } report := &sessionPlanReport{Campaign: config.CampaignID(cfg.Campaign), SessionID: cfg.Session.SessionID, Stages: []plannedStage{}, Publication: []plannedPublication{}} - if m != nil && !input.plan.Contains("prepare") && suppliedCompletion(cfg, m)["transcribe"] && projectionNeedsReferences(projection) { + if m != nil && !input.plan.Contains("prepare") && hasSuppliedBaseline(m) && projectionNeedsReferences(projection) { report.ReferencePreparation = &preparationAssessment{Outcome: "planned", Reason: "reference-only preparation before downstream work"} - current, checkErr := referencePreparationCurrent(ctx, cfg, m, store, effective) + requirements, requirementErr := referenceHistoryRequirements(cfg, effective, projection) + if requirementErr != nil { + return report, requirementErr + } + current, checkErr := referencePreparationCurrent(ctx, cfg, m, store, effective, requirements) if checkErr != nil { return report, checkErr } @@ -133,10 +137,6 @@ func buildSessionPlan(ctx context.Context, cfg *config.Config, input *executionI report.ReferencePreparation.Outcome = "blocked" report.ReferencePreparation.Reason = validationErr.Error() } - requirements, requirementErr := artifacts.CollectPreviousArtifactRequirements(configuredScriptoriumArtifacts(cfg), effective) - if requirementErr != nil { - return report, requirementErr - } if strings.TrimSpace(cfg.Session.PreviousSessionID) == "" { for _, requirement := range requirements { if requirement.Required { diff --git a/internal/app/plan_inputs.go b/internal/app/plan_inputs.go index 95ef294..95122ce 100644 --- a/internal/app/plan_inputs.go +++ b/internal/app/plan_inputs.go @@ -15,7 +15,7 @@ import ( // unavailablePlannedBuiltIns reports selected real inputs that neither exist // nor have a producer scheduled by this projection. func unavailablePlannedBuiltIns(cfg *config.Config, m *manifest.Manifest, projection *workProjection) []string { - if cfg == nil || cfg.Pipeline == nil || cfg.Session == nil || m == nil || !suppliedCompletion(cfg, m)["transcribe"] { + if cfg == nil || cfg.Pipeline == nil || cfg.Session == nil || !hasSuppliedBaseline(m) { return nil } paths := artifacts.NewLocalStore(cfg.Pipeline.Workspace.Root).SessionPathsFor(cfg.Session.Campaign, cfg.Session.SessionID) diff --git a/internal/app/reference_preparation.go b/internal/app/reference_preparation.go index 0fc55db..9d3f9d8 100644 --- a/internal/app/reference_preparation.go +++ b/internal/app/reference_preparation.go @@ -13,9 +13,9 @@ import ( ) // prepareBoundedReferences makes current references available before downstream -// checks when a supplied transcript replaces the normal preparation prefix. +// checks when supplied products replace the normal preparation prefix. func prepareBoundedReferences(runtime *invocationRuntime) error { - if runtime.plan.Contains("prepare") || !suppliedCompletion(runtime.cfg, runtime.manifest)["transcribe"] { + if runtime.plan.Contains("prepare") || !hasSuppliedBaseline(runtime.manifest) { return nil } if !stagesContainAny(runtime.stages, "polish", "trim", "extract", "analyze") { @@ -34,17 +34,19 @@ func prepareBoundedReferences(runtime *invocationRuntime) error { } env := *runtime.env env.Force = false - current, err := referencePreparationCurrent(runtime.ctx, runtime.cfg, runtime.manifest, runtime.artifactStore, runtime.effectiveArtifacts) + env.ReferenceOnly = true + requirements, err := referenceHistoryRequirements(runtime.cfg, runtime.effectiveArtifacts, projection) + if err != nil { + return fmt.Errorf("reference preparation requirements: %w", err) + } + env.PreparePreviousRequirements = requirements + current, err := referencePreparationCurrent(runtime.ctx, runtime.cfg, runtime.manifest, runtime.artifactStore, runtime.effectiveArtifacts, requirements) if err != nil { return err } if current { return nil } - requirements, err := artifacts.CollectPreviousArtifactRequirements(configuredScriptoriumArtifacts(runtime.cfg), runtime.effectiveArtifacts) - if err != nil { - return fmt.Errorf("reference preparation requirements: %w", err) - } if len(requirements) > 0 && strings.TrimSpace(runtime.cfg.Session.PreviousSessionID) != "" && runtime.env.ObjectStore == nil { runtime.env.ObjectStore, err = runtime.dependencies.newObjectStore(runtime.ctx, runtime.cfg) if err != nil { @@ -52,7 +54,9 @@ func prepareBoundedReferences(runtime *invocationRuntime) error { } } priorInputs := append([]manifest.InputRecord(nil), runtime.manifest.Inputs...) - result, err := stage.PrepareReferences(runtime.ctx, runtime.env, runtime.manifest) + // Preserve any lazily composed history store on the reference environment. + env.ObjectStore = runtime.env.ObjectStore + result, err := stage.PrepareReferences(runtime.ctx, &env, runtime.manifest) if err != nil { return fmt.Errorf("prepare references: %w", err) } @@ -75,7 +79,7 @@ func prepareBoundedReferences(runtime *invocationRuntime) error { return nil } -func referencePreparationCurrent(ctx context.Context, cfg *config.Config, m *manifest.Manifest, store artifacts.Store, effective artifacts.EffectiveArtifactSet) (bool, error) { +func referencePreparationCurrent(ctx context.Context, cfg *config.Config, m *manifest.Manifest, store artifacts.Store, effective artifacts.EffectiveArtifactSet, requirements []artifacts.PreviousArtifactRequirement) (bool, error) { if recordedStageStatus(m, "prepare") != manifest.StatusSucceeded { return false, nil } @@ -83,7 +87,7 @@ func referencePreparationCurrent(ctx context.Context, cfg *config.Config, m *man if err != nil { return false, err } - env := &stage.Env{Config: cfg, ArtifactStore: store, EffectiveArtifacts: effective} + env := &stage.Env{Config: cfg, ArtifactStore: store, EffectiveArtifacts: effective, ReferenceOnly: true, PreparePreviousRequirements: requirements} semantic, err := currentStageSemanticConfig(prepare, env) if err != nil { return false, err @@ -95,6 +99,28 @@ func referencePreparationCurrent(ctx context.Context, cfg *config.Config, m *man return validation != nil && validation.Resumable, nil } +func referenceHistoryRequirements(cfg *config.Config, effective artifacts.EffectiveArtifactSet, projection *workProjection) ([]artifacts.PreviousArtifactRequirement, error) { + var keys []string + for _, item := range projection.Stages { + if item.Name != "analyze" || item.Decision.action != stageActionRun { + continue + } + if item.Analysis == nil { + return artifacts.CollectPreviousArtifactRequirements(configuredScriptoriumArtifacts(cfg), effective) + } + for _, work := range item.Analysis.ExecutionOrder { + keys = append(keys, work.Key) + } + } + requirements, err := artifacts.PreviousArtifactRequirementsForKeys(configuredScriptoriumArtifacts(cfg), keys) + // An explicit empty set distinguishes no planned history from the ordinary + // preparation default, which collects the full structural target closure. + if requirements == nil { + requirements = []artifacts.PreviousArtifactRequirement{} + } + return requirements, err +} + func projectionNeedsReferences(projection *workProjection) bool { needsReferences := false for _, item := range projection.Stages { diff --git a/internal/app/reference_preparation_test.go b/internal/app/reference_preparation_test.go index d076fd8..099fe46 100644 --- a/internal/app/reference_preparation_test.go +++ b/internal/app/reference_preparation_test.go @@ -83,6 +83,160 @@ func TestBoundedAnalysisPreparesReferencesForSuppliedTranscript(t *testing.T) { } } +func TestBoundedAnalysisConsumesSuppliedProductsWithoutTranscripts(t *testing.T) { + for _, extraction := range []bool{false, true} { + name := "configured artifact" + if extraction { + name = "extraction product" + } + t.Run(name, func(t *testing.T) { + ctx := context.Background() + pipeline, campaign, session := writeValidConfigFilesWithScriptoriumArtifacts(t, t.TempDir()) + cfg, err := config.LoadWithSessionOptions(pipeline, campaign, session, config.SessionLoadOptions{}) + if err != nil { + t.Fatal(err) + } + cfg.Session.Inputs.AudioDir = "" + cfg.Session.Inputs.AudioFiles = nil + cfg.Session.Inputs.AudioS3 = nil + source, relative, body := artifacts.ConfiguredArtifactSourceID("parent"), "artifacts/parent.md", "supplied parent\n" + cfg.ArtifactCatalog.Artifacts = map[string]config.ScriptoriumArtifactConfig{ + "parent": {PromptID: "parent", OutputPath: relative, Inputs: map[string]config.ScriptoriumInputConfig{ + "old_history": {Source: artifactpolicy.PreviousSessionSourceID("parent"), Required: true}, + }}, + } + if extraction { + source, relative, body = artifacts.ExtractionArtifactSourceID("entities"), "artifacts/entities.json", `{"entities":[]}` + cfg.Pipeline.Notarius = &config.NotariusConfig{Enabled: true, Outputs: map[string]config.NotariusOutputConfig{"entities": {LaneID: "entities"}}} + } + cfg.ArtifactCatalog.Artifacts["child"] = config.ScriptoriumArtifactConfig{ + Enabled: true, PromptID: "child", OutputPath: "artifacts/child.md", + Inputs: map[string]config.ScriptoriumInputConfig{ + "parent": {Source: source, Required: true}, + "party": {Source: artifactpolicy.SourceInputParty, Required: true}, + }, + } + if !extraction { + child := cfg.ArtifactCatalog.Artifacts["child"] + child.DependsOn = []string{"parent"} + cfg.ArtifactCatalog.Artifacts["child"] = child + } + paths := artifacts.NewLocalStore(cfg.Pipeline.Workspace.Root).SessionPathsFor(cfg.Session.Campaign, cfg.Session.SessionID) + path := filepath.Join(paths.Root, relative) + mustWriteTestFile(t, path, body) + sum, err := artifacts.SHA256File(path) + if err != nil { + t.Fatal(err) + } + m := manifest.New(cfg.Session.SessionID, time.Now().UTC()) + m.Campaign = cfg.Session.Campaign + m.SuppliedProducts = &manifest.SuppliedProductCollection{Version: manifest.SuppliedProductVersion, Products: map[string]manifest.SuppliedProduct{ + source: {Path: relative, Checksum: sum, Size: int64(len(body))}, + }} + saveBoundedManifest(t, cfg, m) + plan := mustBoundedPlan(t, "analyze", "analyze") + effective, err := resolveEffectiveArtifacts(cfg, nil) + if err != nil { + t.Fatal(err) + } + preview, err := buildSessionPlan(ctx, cfg, &executionInput{plan: plan}, nil, effective, commandDependencies{}) + if err != nil { + t.Fatal(err) + } + if len(preview.InputIssues) != 0 || preview.ReferencePreparation == nil || preview.ReferencePreparation.Outcome != "planned" { + t.Fatalf("preview %+v", preview) + } + if len(preview.Stages) != 1 || len(preview.Stages[0].Analysis.Execute) != 1 || preview.Stages[0].Analysis.Execute[0].Key != "child" { + t.Fatalf("analysis preview %+v", preview.Stages) + } + if _, err := os.Stat(filepath.Join(paths.InputsDir, "party.yml")); !os.IsNotExist(err) { + t.Fatalf("plan wrote references: %v", err) + } + runner := &scriptorium.FakeRunner{} + result, err := executePlan(ctx, cfg, plan, RunOptions{Env: &Env{Scriptorium: runner}}) + if err != nil { + t.Fatal(err) + } + if len(runner.RunRequests) != 1 || runner.RunRequests[0].InputPaths["parent"] != path || runner.RunRequests[0].InputPaths["party"] != filepath.Join(paths.InputsDir, "party.yml") { + t.Fatalf("requests %+v", runner.RunRequests) + } + saved, err := (&manifest.LocalStore{}).Load(ctx, result.ManifestPath) + if err != nil { + t.Fatal(err) + } + if saved.Stages["prepare"].Metadata["audio_prepared"] != false || saved.Stages["transcribe"] != nil || saved.Stages["extract"] != nil { + t.Fatalf("fabricated producer evidence: %+v", saved.Stages) + } + if current, err := referencePreparationCurrent(ctx, cfg, saved, artifacts.NewLocalStore(cfg.Pipeline.Workspace.Root), effective, []artifacts.PreviousArtifactRequirement{}); err != nil || !current { + t.Fatalf("reference-only reuse = %v, %v", current, err) + } + // Available imported inputs do not substitute for another required file. + child := cfg.ArtifactCatalog.Artifacts["child"] + child.Inputs["missing"] = config.ScriptoriumInputConfig{Source: artifacts.ArtifactTranscriptFinalTrimmed, Required: true} + cfg.ArtifactCatalog.Artifacts["child"] = child + input := &executionInput{plan: plan} + input.Force.Value = true + preview, err = buildSessionPlan(ctx, cfg, input, nil, effective, commandDependencies{}) + if err != nil || preview == nil || !strings.Contains(strings.Join(preview.InputIssues, " "), artifacts.ArtifactTranscriptFinalTrimmed) { + t.Fatalf("missing actual input preview %+v, %v", preview, err) + } + if _, err := executePlan(ctx, cfg, plan, RunOptions{Force: true, Env: &Env{Scriptorium: runner}}); err == nil || !strings.Contains(err.Error(), artifacts.ArtifactTranscriptFinalTrimmed) { + t.Fatalf("missing actual input error = %v", err) + } + if len(runner.RunRequests) != 1 { + t.Fatal("generated output despite missing required input") + } + }) + } +} + +func TestBoundedAnalysisContinuesAfterLastSuppliedProductIsReplaced(t *testing.T) { + ctx := context.Background() + pipeline, campaign, session := writeValidConfigFilesWithScriptoriumArtifacts(t, t.TempDir()) + cfg, err := config.LoadWithSessionOptions(pipeline, campaign, session, config.SessionLoadOptions{}) + if err != nil { + t.Fatal(err) + } + cfg.Session.Inputs.AudioDir = "" + cfg.ArtifactCatalog.Artifacts = map[string]config.ScriptoriumArtifactConfig{ + "session_recap": {Enabled: true, PromptID: "recap", OutputPath: "artifacts/session_recap.md", Inputs: map[string]config.ScriptoriumInputConfig{ + "party": {Source: artifactpolicy.SourceInputParty, Required: true}, + }}, + } + remote := &storage.FakeBackend{} + seedCommittedRestoreSnapshot(t, cfg, remote, "20260519T010203Z-a1b2c3d4", map[string][]byte{"artifacts/session_recap.md": []byte("supplied recap\n")}) + if _, err := restoreSessionState(ctx, cfg, RestorePlanOptions{}, normalizeCommandDependencies(restoreCommandDependencies(remote))); err != nil { + t.Fatal(err) + } + plan := mustBoundedPlan(t, "analyze", "analyze") + runner := &scriptorium.FakeRunner{} + result, err := executePlan(ctx, cfg, plan, RunOptions{Force: true, Env: &Env{Scriptorium: runner}}) + if err != nil { + t.Fatal(err) + } + saved, err := (&manifest.LocalStore{}).Load(ctx, result.ManifestPath) + if err != nil { + t.Fatal(err) + } + if len(saved.SuppliedProducts.Products) != 0 || saved.Stages["transcribe"] != nil { + t.Fatalf("replacement baseline %+v", saved) + } + effective, err := resolveEffectiveArtifacts(cfg, nil) + if err != nil { + t.Fatal(err) + } + preview, err := buildSessionPlan(ctx, cfg, &executionInput{plan: plan}, nil, effective, commandDependencies{}) + if err != nil || preview == nil || len(preview.InputIssues) != 0 || len(preview.Stages[0].Analysis.Execute) != 0 { + t.Fatalf("local checkpoint preview %+v, %v", preview, err) + } + if _, err := executePlan(ctx, cfg, plan, RunOptions{Env: &Env{Scriptorium: runner}}); err != nil { + t.Fatal(err) + } + if len(runner.RunRequests) != 1 { + t.Fatalf("ordinary continuation regenerated a local checkpoint: %+v", runner.RunRequests) + } +} + func TestFullRunWithSuppliedTranscriptPreparesAndRendersSelectedVariant(t *testing.T) { root := t.TempDir() pipeline, campaign, session := writeValidConfigFilesWithScriptoriumArtifacts(t, root) diff --git a/internal/app/supplied_completion.go b/internal/app/supplied_completion.go index 93cbf72..25e8ed8 100644 --- a/internal/app/supplied_completion.go +++ b/internal/app/supplied_completion.go @@ -42,6 +42,13 @@ func suppliedCompletion(cfg *config.Config, m *manifest.Manifest) map[string]boo return covered } +// hasSuppliedBaseline identifies an import context, including after its supplied +// products become local checkpoints. It grants no product availability or stage +// completion: selected consumers still resolve and validate their actual inputs. +func hasSuppliedBaseline(m *manifest.Manifest) bool { + return m != nil && m.SuppliedProducts != nil && manifest.ValidateSuppliedProducts(m.SuppliedProducts) == nil +} + // retireSuppliedForAttempt prevents older supplied completion from returning // after a selected producer begins replacement work. func retireSuppliedForAttempt(cfg *config.Config, m *manifest.Manifest, name string) { diff --git a/internal/artifacts/previous_requirements.go b/internal/artifacts/previous_requirements.go index 6097988..5e1bdce 100644 --- a/internal/artifacts/previous_requirements.go +++ b/internal/artifacts/previous_requirements.go @@ -30,11 +30,23 @@ func CollectPreviousArtifactRequirements( if err != nil { return nil, err } - sort.Strings(artifactNames) + return PreviousArtifactRequirementsForKeys(artifactsCfg, artifactNames) +} + +// PreviousArtifactRequirementsForKeys collects history for an already planned +// set of generation work. It does not expand historical dependencies of reused +// products. Structural prerequisite collection uses the wrapper above. +func PreviousArtifactRequirementsForKeys( + artifactsCfg map[string]config.ScriptoriumArtifactConfig, + artifactNames []string, +) ([]PreviousArtifactRequirement, error) { byName := map[string]PreviousArtifactRequirement{} for _, artifactName := range artifactNames { - artifactCfg := artifactsCfg[artifactName] + artifactCfg, ok := artifactsCfg[artifactName] + if !ok { + return nil, fmt.Errorf("analysis artifact %q is not configured", artifactName) + } inputNames := sortedScriptoriumInputKeys(artifactCfg.Inputs) for _, inputName := range inputNames { diff --git a/internal/stage/prepare.go b/internal/stage/prepare.go index 6c8fd02..d0cce34 100644 --- a/internal/stage/prepare.go +++ b/internal/stage/prepare.go @@ -34,6 +34,9 @@ func PrepareReferences(ctx context.Context, env *Env, m *manifest.Manifest) (*St } func prepareNeedsAudio(env *Env, m *manifest.Manifest) bool { + if env != nil && env.ReferenceOnly { + return false + } if env == nil || env.Config == nil || env.Config.Session == nil || env.ArtifactStore == nil || m == nil || env.Force { return true } @@ -241,7 +244,7 @@ func prepareInputs(ctx context.Context, env *Env, m *manifest.Manifest, acquireA } } - previousRequirements, err := collectPreparePreviousRequirements(env.Config, env.EffectiveArtifacts) + previousRequirements, err := preparePreviousRequirements(env) if err != nil { return nil, fmt.Errorf("prepare: resolve previous artifact requirements: %w", err) } @@ -441,6 +444,13 @@ func countAudioInputs(inputs []manifest.InputRecord) int { return count } +func preparePreviousRequirements(env *Env) ([]artifacts.PreviousArtifactRequirement, error) { + if env.PreparePreviousRequirements != nil { + return env.PreparePreviousRequirements, nil + } + return collectPreparePreviousRequirements(env.Config, env.EffectiveArtifacts) +} + func collectPreparePreviousRequirements(cfg *config.Config, effective artifacts.EffectiveArtifactSet) ([]artifacts.PreviousArtifactRequirement, error) { if cfg == nil || cfg.Pipeline == nil || cfg.Pipeline.Scriptorium == nil { return nil, nil diff --git a/internal/stage/prepare_resume.go b/internal/stage/prepare_resume.go index e144198..5e46ae1 100644 --- a/internal/stage/prepare_resume.go +++ b/internal/stage/prepare_resume.go @@ -28,6 +28,7 @@ func ValidateReferenceSources(ctx context.Context, env *Env, m *manifest.Manifes } copyEnv := *env copyEnv.Force = false + copyEnv.ReferenceOnly = true _, err := currentPrepareSourceInputs(ctx, ©Env, m) return err } diff --git a/internal/stage/semantic_contracts_initial.go b/internal/stage/semantic_contracts_initial.go index 4ff0e43..d37207e 100644 --- a/internal/stage/semantic_contracts_initial.go +++ b/internal/stage/semantic_contracts_initial.go @@ -101,7 +101,7 @@ func buildPrepareSemanticConfig(env *Env) (prepareSemanticConfig, error) { return prepareSemanticConfig{}, fmt.Errorf("prepare semantic configuration requires resolved pipeline and session config") } cfg := env.Config - requirements, err := collectPreparePreviousRequirements(cfg, env.EffectiveArtifacts) + requirements, err := preparePreviousRequirements(env) if err != nil { return prepareSemanticConfig{}, fmt.Errorf("resolve previous artifact requirements: %w", err) } diff --git a/internal/stage/stage.go b/internal/stage/stage.go index 513802e..907a29a 100644 --- a/internal/stage/stage.go +++ b/internal/stage/stage.go @@ -27,6 +27,10 @@ type Env struct { ManifestStore manifest.Store Reporter logging.Reporter Force bool + ReferenceOnly bool // Preparation checks and materialization exclude audio. + // Nil uses the selection's structural prerequisite closure. Bounded reference + // preparation supplies the history needed by its actual generation plan. + PreparePreviousRequirements []artifacts.PreviousArtifactRequirement WhisperX whisperx.Client Seriatim seriatim.Runner