From b82ab47c6c7723750b63132affa6a90f7952d7ea Mon Sep 17 00:00:00 2001 From: Eric Rakestraw Date: Wed, 2 Dec 2026 14:37:39 +0000 Subject: [PATCH] Document prerequisite history and close the audit finding --- docs/internal/artifacts.md | 11 +++-- docs/internal/command-restore.md | 2 + docs/internal/stage-analyze.md | 6 ++- docs/internal/stage-prepare.md | 6 ++- docs/operations.md | 7 ++- docs/roadmap/audit/catalog.md | 46 +++++++++++-------- docs/roadmap/implementation.md | 4 +- docs/roadmap/session-restore.md | 4 ++ .../stage/prepare_analyze_history_test.go | 5 +- 9 files changed, 59 insertions(+), 32 deletions(-) diff --git a/docs/internal/artifacts.md b/docs/internal/artifacts.md index 2fe2e15..4ac2d94 100644 --- a/docs/internal/artifacts.md +++ b/docs/internal/artifacts.md @@ -60,8 +60,9 @@ the effective analyze set contains enabled definitions. With `--artifacts`, the exact named configured definitions become the effective set for that invocation, regardless of their `enabled` value. The effective-set resolver itself does not expand dependencies. Shared domain catalog derivation has materialized the sorted -union of explicit ordering edges and configured-artifact input edges, and the analyze -work planner closes targets over that one concrete prerequisite graph. +union of explicit ordering edges and configured-artifact input edges. The +shared artifact closure orders targets and their prerequisites on that one concrete +graph; the analyze work planner uses that order for its decisions. Availability is separate from executability. Invocation selection normalizes a family selection into its concrete generated members before this resolver runs. The effective set retains optional family @@ -166,7 +167,9 @@ Validation by content type: `CollectPreviousArtifactRequirements`: -- scans the effective configured artifact set; +- expands the effective target set to its full configured prerequisite closure, + including disabled prerequisites, independently of artifact reuse; +- scans only definitions in that closure; - extracts only canonical previous-session sources; - deduplicates by artifact key; - merges required and optional references (required wins); @@ -294,7 +297,7 @@ physical layout. `internal/artifacts/current_state_commit.go`, - Paths and keys: `internal/artifacts/paths.go`, `internal/artifacts/s3_keys.go` -- Previous requirements: `internal/artifacts/previous_requirements.go` +- Previous requirements: `internal/artifacts/previous_requirements.go`, `internal/artifacts/dependencies.go` - Tests: `internal/artifacts/artifact_resolver_test.go`, `internal/artifacts/catalog_test.go`, `internal/artifacts/extraction_catalog_test.go`, diff --git a/docs/internal/command-restore.md b/docs/internal/command-restore.md index f1c1cd6..46bbd6d 100644 --- a/docs/internal/command-restore.md +++ b/docs/internal/command-restore.md @@ -54,6 +54,8 @@ Planner behavior: For a non-dry-run restore, planning/classification happens only after acquiring the workspace lock. Runner manifest/reuse checks acquire that same lock first. +Restore uses the default enabled targets and their full prerequisite closure to +collect previous requirements as described in [Artifact Internals](artifacts.md#previous-requirement-collection). Previous-cache readiness is resolved through `previouscache.Resolve` for restore, prepare, status, and validation. Each requirement selects the unique `published_output` for its canonical source in the pointer-selected commit, diff --git a/docs/internal/stage-analyze.md b/docs/internal/stage-analyze.md index c682b0d..becb4e8 100644 --- a/docs/internal/stage-analyze.md +++ b/docs/internal/stage-analyze.md @@ -52,7 +52,8 @@ Supported source families: - makes a non-executable configured artifact reusable only when its current manifest record and durable output pass the configured-artifact evidence contract; an incidental or stale canonical file is unavailable. -- validates selected artifact dependency order (cycle-safe topo ordering). +- uses the shared artifact closure and cycle-safe dependency ordering described in + [Artifact Internals](artifacts.md#previous-requirement-collection). - consumes only the concrete dependency graph derived in the shared domain catalog; planning, prerequisite closure, execution, reuse, invalidation, and semantic evidence do not infer a second graph from inputs. @@ -138,7 +139,8 @@ Supported source families: order after the complete reconciled collection has been checkpointed; unrelated stale records do not make an otherwise successful partial invocation fail. -- resolves previous-session sources from local `previous/` cache only. +- resolves previous-session sources from manifest-backed local `previous/` cache + only; preparation collects requirements for the selected prerequisite closure. - runs optional render-debug, then artifact execution. - validates non-empty output files and materializes canonical outputs. - shares effective prompt context and variables with requirements inspection; diff --git a/docs/internal/stage-prepare.md b/docs/internal/stage-prepare.md index b06f354..1835546 100644 --- a/docs/internal/stage-prepare.md +++ b/docs/internal/stage-prepare.md @@ -9,7 +9,7 @@ Materialize canonical current-session inputs before processing stages. - resolved campaign, session, and pipeline configuration - the stable speakers input, inline autocorrection rules, canonical party, and optional glossary selections - one resolved local or S3 audio source -- enabled configured artifact input requirements for previous-session sources +- previous-session input requirements from selected targets and their configured prerequisites ## Outputs @@ -44,7 +44,9 @@ Materialize canonical current-session inputs before processing stages. size, and source provenance, including an empty list when no rules apply. - renders standalone effective campaign, session, and canonical party documents, and deterministically generates the prepared players projection. -- scans enabled configured artifact inputs for `narratio.previous_session.artifact.*` requirements. +- 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). - clears managed `inputs/previous/` state on every invocation, then, when requirements exist: - resolves the pointer-selected previous source through the shared resolver; - downloads previous manifest/artifacts; diff --git a/docs/operations.md b/docs/operations.md index 1b99ce6..ad77226 100644 --- a/docs/operations.md +++ b/docs/operations.md @@ -422,6 +422,8 @@ Selection behavior: - validates names against the derived concrete catalog and family selections; - selects explicit analyze targets and permits their required configured prerequisites to be reused or rebuilt first; +- uses those targets and their full prerequisite closure when preparation + collects previous-session input requirements; - filters publish rules for `narratio.artifact.` sources only; - does not suppress built-in transcript, bounds, or explicitly configured `narratio.extraction.` publish sources; and @@ -657,8 +659,9 @@ Default restore scope: - the committed session manifest, prepared inputs, and transcript/artifact objects declared by the selected remote commit -- `inputs/previous/**` when needed by configured previous-session artifact inputs; - each is selected from its exact committed `published_output` declaration +- `inputs/previous/**` when needed by enabled targets or their configured + prerequisites, including disabled prerequisites; each is selected from its + exact committed `published_output` declaration Optional: diff --git a/docs/roadmap/audit/catalog.md b/docs/roadmap/audit/catalog.md index ceda2e5..18cbd5b 100644 --- a/docs/roadmap/audit/catalog.md +++ b/docs/roadmap/audit/catalog.md @@ -41,10 +41,9 @@ their scope. Unless assigned otherwise, a finding remains independent audit remediation. Shared code does not make a refactoring a prerequisite or assign the whole finding to a roadmap. -Eleven entries are closed by the safety, transfer, audio discovery, and S3 -planning work; 32 -remain open. **Planned** identifies an agreed remedy awaiting -implementation. **Potentially eliminated** requires verification that the offending +Twelve entries are closed by the safety, transfer, audio discovery, S3 +planning, and prerequisite-history work; 31 remain open. **Planned** identifies +an agreed remedy awaiting implementation. **Potentially eliminated** requires verification that the offending lifecycle is removed. **Coordinate** identifies shared changes, not a commitment that the roadmap implements the entire finding. Findings close only after their relevant behavior or code removal is verified. Original audit reports, finding @@ -326,27 +325,32 @@ Related: [CAT-14](#cat-14--p3-close-temporary-committed-manifest-cleanup-gaps). ### CAT-10 — P2: Hydrate previous inputs for the full analysis prerequisite closure -Status: Open +Status: Closed -**Disposition / owner.** Coordinate — the [restore roadmap](../session-restore.md#adapt-preparation-and-operator-reporting) -changes preparation and previous-session acquisition. The prerequisite-inclusive -requirement fix still needs explicit implementation and regression coverage; -publication-inventory-only discovery does not supply the missing closure. +**Closure.** The shared closure and prerequisite-inclusive history collector were +implemented in [a057ce3](https://forge.maximumdirect.net/eric/narratio/commit/a057ce3) +and [7a25a50](https://forge.maximumdirect.net/eric/narratio/commit/7a25a50). +Preparation-to-analysis and semantic resume regressions landed in +[76f9918](https://forge.maximumdirect.net/eric/narratio/commit/76f9918), with +restore, status, and preflight coverage in +[663e02e](https://forge.maximumdirect.net/eric/narratio/commit/663e02e). +The [restore roadmap](../session-restore.md#adapt-preparation-and-operator-reporting) +retains its separate acquisition and workflow changes. Original findings: [FC-01](01-correctness.md#fc-01--p2-previous-session-hydration-omits-analysis-prerequisites), [TE-03](08-testing.md#te-03--p2-previous-session-hydration-coverage-stops-short-of-dependency-closure). -**Issue.** Preparation and previous-cache restore collect history requirements -from enabled/explicit targets only, while analyze separately schedules -prerequisites. A prerequisite's required history can remain unavailable despite an -available remote product; optional history can disappear silently. Existing tests -cover these mechanisms separately. +**Original issue.** Preparation and previous-cache restore collected history requirements +from enabled/explicit targets only, while analyze separately scheduled +prerequisites. A prerequisite's required history could remain unavailable despite an +available remote product; optional history could disappear silently. Existing tests +covered these mechanisms separately. -**Direction.** Use one prerequisite-inclusive requirements view for preparation, -semantic evidence, store composition, and restore. Retain explicit targets -separately for force/publication policy. Add selected-child/disabled-prerequisite -preparation-to-analysis coverage for required and optional history, unrelated-work -exclusion, and restore. +**Implemented direction.** A shared prerequisite-inclusive requirements view feeds +preparation, semantic evidence, store composition, and restore. Explicit targets +remain separate for force and publication. Regression tests cover selected children +and disabled prerequisites, required and optional history, unrelated-work exclusion, +and restore. Related: [CAT-17](#cat-17--p3-centralize-configured-artifact-dependency-queries). @@ -505,6 +509,10 @@ uses a fixed stage/output coverage mapping, not this configured-artifact graph. Do not make graph consolidation a prerequisite; coordinate only where existing artifact reconciliation is actually changed. +The CAT-10 work moved the existing prerequisite closure, ordering, and dependency +normalization to `internal/artifacts`; broader graph ownership and dependent +queries remain open. + Original findings: [CX-05](03-complexity.md#cx-05--p3-artifact-dependency-semantics-span-several-representations-and-owners), [EQ-03](10-equivalence.md#eq-03--p3-configured-artifact-dependency-mechanics-have-multiple-owners), [BN-05](11-boundaries.md#bn-05--p3-configured-artifact-graph-operations-are-fragmented-across-domain-owners). diff --git a/docs/roadmap/implementation.md b/docs/roadmap/implementation.md index 6d693dd..53ec804 100644 --- a/docs/roadmap/implementation.md +++ b/docs/roadmap/implementation.md @@ -1,6 +1,6 @@ # CAT-10: Prerequisite-History Hydration -Status: Pending +Status: Complete ## Purpose and scope @@ -214,7 +214,7 @@ are required. ## Stage 5: Document the corrected scope and close CAT-10 -Status: Pending +Status: Complete 1. Update [Artifact Internals](../internal/artifacts.md#previous-requirement-collection) to define targets versus prerequisite-inclusive requirements and shared diff --git a/docs/roadmap/session-restore.md b/docs/roadmap/session-restore.md index 0686b03..8428450 100644 --- a/docs/roadmap/session-restore.md +++ b/docs/roadmap/session-restore.md @@ -294,6 +294,10 @@ and stage-owned resume/checkpoint handling. ### Adapt preparation and operator reporting +The current prerequisite-inclusive previous-input collector is shared by +preparation, restore, status, and storage composition; retain it while changing +previous-session acquisition. + Review unconditional session audio validation, prepare materialization and reuse, and readiness/composition for actual remaining work. Preserve local per-speaker and per-artifact retry behavior while allowing restored completion to bypass diff --git a/internal/stage/prepare_analyze_history_test.go b/internal/stage/prepare_analyze_history_test.go index 3efd83e..caf9bab 100644 --- a/internal/stage/prepare_analyze_history_test.go +++ b/internal/stage/prepare_analyze_history_test.go @@ -76,7 +76,7 @@ func TestPrepareAndAnalyzeHydratesPrerequisiteHistory(t *testing.T) { } if tc.present { input := findInputByKind(m.Inputs, preparePreviousInputKindArtifact) - if input == nil || input.Source != "narratio.previous_session.artifact.session_recap" || input.Checksum != preparePreviousSHA256([]byte("history bytes\n")) { + if input == nil || input.Source != "narratio.previous_session.artifact.session_recap" || input.Path != filepath.Join(paths.PreviousArtifactsDir, "session_recap.md") || input.Checksum != preparePreviousSHA256([]byte("history bytes\n")) { t.Fatalf("history record = %#v", input) } if !containsString(capture.accessKeys, seed.ArtifactKey) { @@ -109,6 +109,9 @@ func TestPrepareAndAnalyzeHydratesPrerequisiteHistory(t *testing.T) { t.Fatalf("history binding = %q, present = %v", path, exists) } if tc.present { + if path != filepath.Join(paths.PreviousArtifactsDir, "session_recap.md") { + t.Fatalf("history path = %q", path) + } bytes, err := os.ReadFile(path) if err != nil || string(bytes) != "history bytes\n" { t.Fatalf("history = %q, error = %v", bytes, err)