Preserve local prerequisite history during reference preparation
This commit is contained in:
@@ -182,9 +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.
|
||||
`PreviousArtifactRequirementsForKeys` applies the same source collection to
|
||||
planned generation and reused local checkpoint keys. Bounded reference
|
||||
preparation uses it after analysis planning has resolved supplied-product reuse
|
||||
boundaries.
|
||||
|
||||
## Current-State Helpers
|
||||
|
||||
|
||||
@@ -56,8 +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.
|
||||
Bounded reference preparation uses projected work and reused local checkpoint
|
||||
keys, preserving their history while excluding supplied 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;
|
||||
|
||||
@@ -1,13 +1,16 @@
|
||||
# Published Product Import Review
|
||||
|
||||
Status: Complete
|
||||
|
||||
Reviewed commit: `e5d91cb19be27ec25380a6b1306eee49ab9c0977`.
|
||||
|
||||
Scope: the thirteen completed stages in [implementation.md](implementation.md)
|
||||
against the [session-restore roadmap](session-restore.md). The inventory-only
|
||||
publication/import boundary, durable supplied records, transcript coverage,
|
||||
render selection, local merge, and ordinary local checkpoints are implemented.
|
||||
The following gaps remain. This document records review findings, not additional
|
||||
product requirements or an implementation plan.
|
||||
The findings below record the gaps identified and their completed remediations.
|
||||
This document records review outcomes, not additional product requirements or
|
||||
an implementation plan.
|
||||
|
||||
## 1. P2: Stop dependency work at accepted supplied analysis products
|
||||
|
||||
@@ -55,11 +58,14 @@ 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.
|
||||
reuse exclude audio checks and collect history for projected generation work
|
||||
and reused local checkpoints, preserving their ordinary input evidence.
|
||||
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
|
||||
after an actual import/replacement. A mixed-workflow regression also verifies
|
||||
that generating a child retains a current local prerequisite's history. Verified
|
||||
with
|
||||
`go test ./internal/app ./internal/stage ./internal/artifacts ./internal/config`.
|
||||
|
||||
Affected stages: 5, 7, and 12.
|
||||
@@ -150,8 +156,18 @@ and run `go test ./internal/doccheck`.
|
||||
|
||||
## Review Validation
|
||||
|
||||
The existing uncached full test suite, vet, and build passed with Go 1.27.4.
|
||||
Separate temporary Go overlay tests reproduced findings 1–3 using real internal
|
||||
collaborators and fake external boundaries. They were diagnostic review probes;
|
||||
the repository test suite currently lacks these cases. The remediation should
|
||||
add durable regressions at the relevant behavioral boundaries.
|
||||
At the review baseline, the uncached full test suite, vet, and build passed with
|
||||
Go 1.27.4. Temporary Go overlay tests reproduced findings 1–3 using real internal
|
||||
collaborators and fake external boundaries. The remediation adds durable
|
||||
behavioral regressions for these cases and the mixed local/imported workflows
|
||||
described above.
|
||||
|
||||
Final verification passed with Go 1.27.4:
|
||||
|
||||
- `go test -count=1 ./...`
|
||||
- `go test -race ./...`
|
||||
- `go vet ./...`
|
||||
- `go build ./...`
|
||||
- `go test ./internal/doccheck`
|
||||
|
||||
Each behavior regression was observed failing before its corresponding fix.
|
||||
|
||||
@@ -111,6 +111,13 @@ func referenceHistoryRequirements(cfg *config.Config, effective artifacts.Effect
|
||||
for _, work := range item.Analysis.ExecutionOrder {
|
||||
keys = append(keys, work.Key)
|
||||
}
|
||||
// Local checkpoints still rely on their ordinary input evidence. Keep
|
||||
// their history available across reference preparation and revalidation.
|
||||
for _, reused := range item.Analysis.ReusedCurrent {
|
||||
if reused.Reason != "supplied" {
|
||||
keys = append(keys, reused.Key)
|
||||
}
|
||||
}
|
||||
}
|
||||
requirements, err := artifacts.PreviousArtifactRequirementsForKeys(configuredScriptoriumArtifacts(cfg), keys)
|
||||
// An explicit empty set distinguishes no planned history from the ordinary
|
||||
|
||||
@@ -237,6 +237,56 @@ func TestBoundedAnalysisContinuesAfterLastSuppliedProductIsReplaced(t *testing.T
|
||||
}
|
||||
}
|
||||
|
||||
func TestBoundedReferencePreparationRetainsHistoryForCurrentLocalPrerequisites(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": {PromptID: "recap", OutputPath: "artifacts/session_recap.md", Inputs: map[string]config.ScriptoriumInputConfig{
|
||||
"history": {Source: artifactpolicy.PreviousSessionSourceID("session_recap"), Required: true},
|
||||
}},
|
||||
"child": {Enabled: true, PromptID: "child", OutputPath: "artifacts/child.md", DependsOn: []string{"session_recap"}, Inputs: map[string]config.ScriptoriumInputConfig{
|
||||
"parent": {Source: artifacts.ConfiguredArtifactSourceID("session_recap"), Required: true},
|
||||
}},
|
||||
}
|
||||
remote := &storage.FakeBackend{}
|
||||
currentID := cfg.Session.SessionID
|
||||
cfg.Session.SessionID = "2026-05-02"
|
||||
seedCommittedRestoreSnapshot(t, cfg, remote, "20260519T010203Z-a1b2c3d4", map[string][]byte{"artifacts/session_recap.md": []byte("previous recap\n")})
|
||||
cfg.Session.PreviousSessionID = cfg.Session.SessionID
|
||||
cfg.Session.SessionID = currentID
|
||||
seedCommittedRestoreSnapshot(t, cfg, remote, "20260520T010203Z-a1b2c3d4", map[string][]byte{"transcripts/final.trimmed.json": []byte(`{"segments":[]}`)})
|
||||
if _, err := restoreSessionState(ctx, cfg, RestorePlanOptions{}, normalizeCommandDependencies(restoreCommandDependencies(remote))); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
plan := mustBoundedPlan(t, "analyze", "analyze")
|
||||
runner := &scriptorium.FakeRunner{}
|
||||
for _, target := range []string{"session_recap", "child"} {
|
||||
if _, err := executePlan(ctx, cfg, plan, RunOptions{SelectedArtifacts: []string{target}, Env: &Env{Scriptorium: runner, ObjectStore: remote}}); err != nil {
|
||||
t.Fatalf("generate %s: %v", target, err)
|
||||
}
|
||||
}
|
||||
if len(runner.RunRequests) != 2 {
|
||||
t.Fatalf("current local prerequisite regenerated: %+v", runner.RunRequests)
|
||||
}
|
||||
saved, err := (&manifest.LocalStore{}).Load(ctx, manifestPathFor(cfg))
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
paths := artifacts.NewLocalStore(cfg.Pipeline.Workspace.Root).SessionPathsFor(cfg.Session.Campaign, cfg.Session.SessionID)
|
||||
catalog, err := buildHelperArtifactCatalog(cfg, saved)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if _, err := artifacts.ResolveSessionArtifactWithCatalog(paths, saved, artifactpolicy.PreviousSessionSourceID("session_recap"), catalog); err != nil {
|
||||
t.Fatalf("lost local prerequisite's history: %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestFullRunWithSuppliedTranscriptPreparesAndRendersSelectedVariant(t *testing.T) {
|
||||
root := t.TempDir()
|
||||
pipeline, campaign, session := writeValidConfigFilesWithScriptoriumArtifacts(t, root)
|
||||
|
||||
@@ -33,9 +33,9 @@ func CollectPreviousArtifactRequirements(
|
||||
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.
|
||||
// PreviousArtifactRequirementsForKeys collects history for already planned
|
||||
// artifact keys, including local checkpoints whose input evidence remains needed.
|
||||
// Structural prerequisite collection uses the wrapper above.
|
||||
func PreviousArtifactRequirementsForKeys(
|
||||
artifactsCfg map[string]config.ScriptoriumArtifactConfig,
|
||||
artifactNames []string,
|
||||
|
||||
Reference in New Issue
Block a user