diff --git a/docs/roadmap/implementation.md b/docs/roadmap/implementation.md index 53ec804..ec1fb04 100644 --- a/docs/roadmap/implementation.md +++ b/docs/roadmap/implementation.md @@ -1,232 +1,447 @@ -# CAT-10: Prerequisite-History Hydration +# Import Published Products: Implementation Plan -Status: Complete +Status: Pending -## Purpose and scope +## Scope and working rules -Implement [CAT-10](audit/catalog.md#cat-10--p2-hydrate-previous-inputs-for-the-full-analysis-prerequisite-closure): -hydrate previous-session inputs needed by the complete analysis prerequisite -closure. This plan replaces the completed CAT-13 plan; that work remains -implemented and closed. +Implement [Session Restore from Published Artifacts](session-restore.md). +That roadmap owns user intent, boundaries, and the three operator workflows. +This plan replaces the completed CAT-10 plan. CAT-10 and CAT-13 remain implemented. -Read the linked CAT-10 entry, [FC-01](audit/01-correctness.md#fc-01--p2-previous-session-hydration-omits-analysis-prerequisites), -and [TE-03](audit/08-testing.md#te-03--p2-previous-session-hydration-coverage-stops-short-of-dependency-closure). -These sections supply the existing analysis and missing regression scenario. -The original audit reports remain historical evidence. +Read the roadmap completely, then [Development](../development.md) and the +applicable agent, architecture, testing, and documentation policies. For the +original defect, read only [CAT-02](audit/catalog.md#cat-02--p2-make-restored-carried-products-agree-with-manifest-authority) +and its linked FC-02/TE-02 sections. Original audit reports remain historical +evidence; their historical-contract remedy is superseded by the roadmap. -Follow [development guidance](../development.md) and its applicable policy -reading guide. Complete these sequential stages as focused coding-agent units, -including their tests and relevant current-behavior documentation. Commit each -completed unit with a concise plain-English message. Pushing and releasing -require separate authorization. +Complete stages in order. Each stage is a focused coding-agent prompt; split +commits within a stage where independently reviewable. Keep the build and +focused tests usable while introducing shared foundations. The inventory, +publication, and restore stages form one coordinated cutover: record any expected +cross-stage test failures against the named pending stage, and resolve them +before declaring the cutover complete. Keep affected-owner tests meaningful; +do not weaken assertions to conceal unfinished integration. Transitional private +code may connect stages, but remove the old execution-snapshot workflow by +completion. Intermediate commits are not a finished release. Update owned +current-behavior documentation when each capability becomes implemented. -## Selected behavior and boundaries +This is a planning document. This pass changes no application code or policy. +Implementation commits use plain-English messages under agent policy; pushing +and releasing require separate authorization. -Keep two concepts distinct: +## Implementation decisions -- Targets are the enabled artifacts, or the exact normalized explicit selection - when supplied. `EffectiveArtifactSet` retains that meaning. -- The prerequisite closure contains those targets and all transitive configured - prerequisites, including disabled prerequisites. History requirements are - collected from this closure. +### Durable supplied products and coverage -For example, selected `summary` depends on disabled `history`, whose input is -`narratio.previous_session.artifact.history`. Preparation must hydrate that -previous product when available before analysis builds `history` and then -`summary`. An unrelated artifact contributes no history requirement unless it -is itself a target or belongs to the selected closure. +Add an optional, typed supplied-product collection to the local manifest, with +a collection version and records keyed by canonical source ID. Each record +contains its session-relative canonical path, checksum, size, and product +contract information needed for content interpretation. This is local acceptance +and availability evidence. Historical producer IDs, prompts, models, extraction +provenance, and generation fingerprints are not required fields. -Use the concrete dependency relation already derived by configuration, including -explicit ordering and configured-artifact input edges. Family selections have -already expanded to concrete keys. Collect requirements from the full selected -closure independently of current artifact reuse; this extends the existing -target-based preparation policy without adding a runtime input scheduler. +Keep existing executed-stage, speaker, and analysis checkpoint representations. +The additive collection leaves existing local manifests usable without a +migration. Maintain one authoritative accepted record per supplied source. +A successful local replacement retires the supplied record for that source and +uses ordinary local evidence thereafter. Stage transitions must not accidentally +reactivate an older supplied record after an authorized replacement attempt. -Preserve these existing policies: +Place supplied-product validation and the fixed stage/product coverage helper +in `internal/artifacts`; serialization belongs in `internal/manifest`, and +orchestration belongs in `internal/app`. Validate actual bytes with existing +content and confinement rules. Coverage is derived from valid supplied records, +not directory scanning or fabricated outputs. -- Requirements are deduplicated by previous artifact key; required wins over - optional references, and source locations and results remain deterministic. -- Available optional history is hydrated. Missing optional history follows - existing omission/reporting rules. Missing required history remains an error. - Preserve existing handling of absent previous-session IDs, storage failures, - and invalid remote evidence; optional does not mean every error is ignored. -- Force applies to targets under the current analysis policy. Prerequisites - retain ordinary reuse decisions, and publication selection remains unchanged. -- Analysis resolves previous inputs locally from manifest-backed prepared - records. Acquisition remains in preparation and existing restore handling. -- Preparation, its semantic evidence, storage composition, restore, and status - use the same prerequisite-inclusive requirement collector. +| Supplied product | Transcript work satisfied | +| --- | --- | +| Base multi-speaker JSON | transcribe, merge | +| Polished JSON | transcribe through polish | +| Normalized/final JSON | transcribe through normalize | +| Final trimmed JSON | transcribe through trim | -The shared dependency extraction below is the minimum needed for CAT-10. -[CAT-17](audit/catalog.md#cat-17--p3-centralize-configured-artifact-dependency-queries) -and CAT-18 retain broader graph ownership/indexing work. -The pending [session-restore roadmap](session-restore.md#adapt-preparation-and-operator-reporting) -retains its workflow and remote-authority changes. This plan corrects the -existing previous-cache restore path while preserving its current protocol. +Prepare remains responsible for actual needed references; a supplied transcript +satisfies the audio-generation prerequisite, not missing reference documents. +Markdown satisfies only selected render outputs. Bounds, extraction products, +configured artifacts, and previous inputs require their actual files. +No supplied record creates publish, notify, or cleanup execution authority. -No new flags, configuration fields, remote discovery fallback, manifest schema, -generic workflow engine, or compatibility layer is needed. Configuration -validation and ConfigKit's ownership boundary remain unchanged. +Use the same assessment for restore reports, bounded prerequisites, planning, +resume, readiness, and execution. Supplied products are independent inputs; +do not infer their historical relationships from co-publication. Ordinary local +dependents still use current input identities and existing invalidation rules. +Reference preparation preserves the supplied transcript baseline. Explicit +pipeline force retains its existing stage/range and artifact-target meaning; +it overrides relevant supplied completion and requires real generation inputs. -## Stage 1: Share the existing prerequisite closure below the stage boundary +### Render selection -Status: Complete +Add `render.variants`, a list containing `normalized` and/or `trimmed`. +The absent-field default is both. Treat the list as a set; duplicate entries +need not fail. An explicit empty/null selection requests no variants, and the +existing `render.enabled` control remains available. Reject unknown variant +names as unsupported. Use native ConfigKit schema/default handling and a single +domain variant-to-input/output mapping. -Read `internal/stage/analyze_plan.go`, the dependency-ordering helpers in -`analyze_fingerprint.go`, `internal/app/preflight_targets.go`, and the existing -analysis planning tests. +### Publication and restore -1. Move `AnalyzeTargetClosure` into `internal/artifacts`, where preparation, - analysis, and application composition can share it without an import cycle. - Move the ordering, queue, and normalization mechanics needed by that - operation rather than introducing a second traversal. -2. Update analysis planning, fingerprint ordering, and enabled preflight-target - selection to use the shared operations. Redirect other callers of any moved - normalization helper. Remove superseded stage implementations. -3. Preserve deterministic prerequisite-before-dependent ordering, handling of - duplicate/normalized edges, and existing unknown-key/cycle validation. - Configuration retains its origin-aware validation; reverse-edge and - invalidation policy stay with their current owners. -4. Retain the target-selection behavior of `ResolveEffectiveArtifactSet`. - Clarify comments that currently equate this target set with all executed work. -5. Move or adapt existing closure/order tests to their new owner and preserve - stage tests for target/prerequisite roles and force decisions. Cover a nested - disabled prerequisite and exclusion of an unrelated branch without asserting - private helper structure or incidental error wording. +Retain the current pointer and publication inventory format and transfer checks. +Readers bind to the selected inventory; they do not fetch or decode execution +snapshots. Existing inventories may contain obsolete snapshot declarations, +which readers ignore as execution authority. New publication stops emitting +those snapshots. Authored/standalone session configuration and needed reference +documents retain their distinct input purpose. -Validation: `go test ./internal/artifacts ./internal/stage ./internal/app`. -This stage relocates shared mechanics; artifact selections and fingerprints -remain behaviorally unchanged. +Restore plans from source identities, the product registry, and current concrete +artifact definitions. Keep local flat product placement independent of remote +publish destinations. Retain current supported source/path handling; do not add +historical-manifest or basename searches to discover products. -## Stage 2: Collect and consume prerequisite-inclusive history requirements +Restore merges into local state under the existing workspace lock. File +replacement requires existing conflict/force rules. Identical content preserves +existing valid local execution evidence; a fresh or otherwise unrecorded +accepted product receives a supplied record. Changed replacements invalidate +affected locally generated work through existing relations, preserve unrelated +checkpoints, and then install the products supplied by this import as its +baseline. There is no same-generation test between imported products. +Restore's `--force` authorizes file replacement, independently of pipeline +regeneration flags. -Status: Complete +Install the merged local manifest after accepted imports and retain the +incomplete-restore marker/retry mechanism. Dry runs report imports and resulting +coverage without installing durable products or a manifest. No rollback, +background checkpoint service, compatibility framework, or new safety limit is +part of this work. -Read `internal/artifacts/previous_requirements.go`, `effective_set.go`, -`internal/stage/prepare.go`, `semantic_contracts_initial.go`, and the callers -listed below. +## Stage 1: Introduce durable supplied-product records and fixed coverage -1. Have `CollectPreviousArtifactRequirements` expand the supplied target keys - through the shared closure and scan every included definition. Return an - error alongside requirements so closure failures can propagate. Preserve - existing merging, source-location diagnostics, and deterministic ordering. -2. Keep unresolved/default selection handling at the existing caller boundary. - A resolved empty target set remains empty. Do not replace the target set with - an expanded `EffectiveArtifactSet` or mutate configuration. -3. Update every production collector caller: +Status: Pending - - `collectPreparePreviousRequirements`, used by preparation and - `buildPrepareSemanticConfig`; - - `needsObjectStoreForRun`, used by `composeInvocation`; - - `buildPreviousCacheRestoreActions`; and - - `inspectSessionState` for previous-input readiness. -4. Let `needsObjectStoreForRun` return `(bool, error)` and propagate collection - errors through `composeInvocation`. A selected prepare stage with history - requirements and a previous-session ID must compose storage even when only - a prerequisite consumes history. Preserve the audio/publication branches - and existing behavior for ranges without preparation. -5. Feed the corrected requirements into the existing preparation fingerprint - payload. Preserve its schema/version and hash algorithm: changed requirement - content already changes the digest for affected sessions. Keep analysis - fingerprint versions and unrelated preparation evidence unchanged. -6. Extend collector and composition tests for enabled-target/disabled-parent - and explicit-target cases, nested dependencies, required/optional merging, - and unrelated-branch exclusion. Existing exact-selection tests should still - prove narrowing, with prerequisites now included deliberately. -7. Add semantic-evidence coverage showing that a reachable prerequisite's - history requirement affects preparation reuse, while an unrelated definition - does not. Reuse existing validation tests for malformed dependency graphs. +Read `internal/manifest/manifest.go`, manifest validation/store code, +`internal/artifactmodel`, and transcript/product registries. -Validation: `go test ./internal/artifacts ./internal/stage ./internal/app`. -Verify that force/publication callers still receive the original target set. +1. Revise the architecture policy's completion, resume, and restore constraints + to permit satisfaction by supplied products and inventory-based import, as + expressly selected in the roadmap. State the boundary positively and preserve + ordinary local generation and safety rules. These constraints govern the + following stages; implemented-behavior references advance with their code. +2. Add the typed optional collection described above and extend strict manifest + decoding/validation and cloning. Preserve existing local state contracts. +3. Implement narrow helpers to validate a supplied record against the canonical + path and actual bytes and to derive fixed transcript coverage. Reuse existing + source registries and content checks. +4. Represent actual products separately from satisfied producer stages. A + trimmed transcript must not create pretend base, polished, normalized, or + bounds artifact records. +5. Test round-trip persistence, absent supplied collections on ordinary + manifests, missing/tampered supplied products, and each coverage boundary. + Cover Markdown and independent products not implying transcript coverage. -## Stage 3: Protect the real preparation-to-analysis workflow +Validation: `go test ./internal/manifest ./internal/artifacts`. -Status: Complete +## Stage 2: Implement variant-selectable rendering -Use `prepare_effective_artifacts_test.go`, `prepare_previous_test.go`, -`prepare_test.go`, and `analyze_incremental_execution_test.go` as fixture -references. Replace the missing combination identified by TE-03 with a focused -assembled regression. +Status: Pending -1. Run real preparation and analysis against the same resolved configuration, - manifest, and temporary workspace. Use the existing fake object store and - Scriptorium runner only at external boundaries. Supply valid transcript - evidence where the fixture needs it. -2. Cover both default enabled-target selection and an explicit child selection. - Give the child a disabled prerequisite with a previous-session input and add - unrelated work. For explicit selection, include an otherwise enabled - unrelated artifact to prove explicit narrowing is preserved. -3. Exercise required-present and optional-present history. Assert the canonical - previous source and checksum in preparation's input records, the actual - history bytes/path passed in the prerequisite's generation request, and - prerequisite-before-child execution. Unrelated history is neither required - nor fetched and unrelated artifact generation is excluded. -4. Exercise optional absence through the same workflow: preparation records the - existing missing-optional outcome and generation omits that binding. Verify - required absence fails preparation and prevents analysis from proceeding; - reuse narrow existing absence tests where they already cover the same risk. -5. Include explicit and inferred configured-artifact edges across the selected - fixtures, using normal domain catalog derivation for inferred edges. -6. Verify that a previously successful preparation with a different history - requirement set is reconsidered by normal semantic resume. An unchanged - requirement set retains normal reuse. Retain existing forced-target/current- - prerequisite coverage rather than broadening force to every closure member. +Read `internal/config` render schema/default/validation, `stage/render.go`, +and render portions of `semantic_contracts_refinement.go`. -Validation: `go test ./internal/stage ./internal/artifacts ./internal/previouscache`. -The principal regression must fail with the original target-only collector. -Do not manually supply the expected requirements list or pre-populate the -missing prepared history to bypass the collection/hydration path. +1. Implement the selected `render.variants` contract and central mapping. Update + render to resolve and convert only selected JSON inputs, retaining canonical + filenames and existing conversion/materialization behavior. +2. Make semantic evidence describe selected variants and their input/output + identities. Preserve the both-variant default and disablement behavior. + Deliberately revise render's semantic contract version if its changed payload + requires it; do not bump unrelated stage contracts. +3. Test trimmed-only without normalized JSON, normalized-only without trimmed + JSON, omitted selection, explicit empty selection, unknown names, and missing + selected inputs. Verify changes in selection affect reuse and later coverage. +4. Update configuration reference and a maintained example for the new field. -## Stage 4: Verify restore and operator readiness use the same requirements +Validation: `go test ./internal/config ./internal/stage ./internal/doccheck`. -Status: Complete +## Stage 3: Resolve supplied built-in and extraction products -Read `internal/app/restore_plan.go`, `restore_plan_test.go`, -`restore_execution_test.go`, `restore_workflow_test.go`, -`session_state_command.go`, and `session_readiness_test.go`. +Status: Pending -1. Extend previous-cache restore coverage to an enabled child with a disabled - prerequisite consuming history. Restore uses its current default target - selection; this work adds no artifact-selection option to restore. -2. Verify the dry-run action set includes the required prerequisite history, - excludes unrelated history, and leaves durable session files unchanged. - Verify actual restore installs the selected declared product at the existing - canonical cache path. Cover optional-present history and retain existing - missing-required/missing-optional behavior. -3. Exercise restored history reaching prerequisite analysis through the existing - local resolver. Seed valid matching committed manifest/input evidence before - restore; do not repair missing authority records after restore to make the - test pass. Synthesizing a new execution baseline or reconciling a changed - remote history with historical manifest evidence belongs to the separate - session-restore roadmap. -4. Verify status/readiness includes the prerequisite's previous requirement and - preserves required/optional classifications. Exercise standalone preflight - through its real preparation flow so it hydrates prerequisite history using - normal storage composition. Reuse Stage 3's data-selection coverage. -5. Preserve existing reports and failure conventions, restore transfer/conflict - handling, and analysis's local-only previous-input resolution. Keep S3 - planning/preflight behavior established by CAT-13 intact. +Read `artifact_resolver.go`, `prepared_input.go`, `extraction_evidence.go`, +`extraction_input.go`, and catalog/bootstrap code under `internal/artifacts`. -Validation: `go test ./internal/app ./internal/previouscache ./internal/stage`. -Use committed remote fixtures and fake adapters; no live services or credentials -are required. +1. Let normal source resolution and catalogs consume valid supplied built-ins, + configured product records, and extraction products. Preserve ordinary + generation-evidence validation for locally generated products. +2. Supplied extraction products need their actual payload/content contract, not + old Notarius metadata or an original transcript fingerprint. Partial imports + remain individually available; extract completion requires its current + required product set. Executing extraction retains the existing full-bundle + behavior rather than adding per-lane generation checkpoints. +3. Make supplied configured products available through their existing canonical + source IDs without inventing analyze fingerprints or producer runs. +4. Ensure coverage alone cannot resolve an absent intermediate file. Test + supplied trimmed JSON, separately supplied bounds, partial extraction, and + configured outputs after manifest reload. +5. Cover publication's local-source resolver using supplied products. Remote + publication locks and local content/path validation remain unchanged. -## Stage 5: Document the corrected scope and close CAT-10 +Validation: `go test ./internal/artifacts ./internal/stage`. -Status: Complete +## Stage 4: Integrate supplied products into incremental analysis -1. Update [Artifact Internals](../internal/artifacts.md#previous-requirement-collection) - to define targets versus prerequisite-inclusive requirements and shared - closure ownership. Update [Preparation Internals](../internal/stage-prepare.md), - [Analysis Internals](../internal/stage-analyze.md), and - [Restore Internals](../internal/command-restore.md) where their descriptions - currently imply target-only collection or stage-owned closure mechanics. -2. Update [operations](../operations.md#artifact-development-workflows) and its - restore workflow only where operator guidance needs the corrected history - scope. Keep current force/publication and required/optional policies intact. - Link to canonical contracts rather than duplicating them. -3. Run the repository checks with the maintained toolchain: +Status: Pending + +Read `analyze_reconciliation.go`, `analyze_fingerprint.go`, +`analyze_plan.go`, and analysis execution/checkpoint handling. + +1. Classify valid supplied configured artifacts before evaluating their + historical generation inputs/fingerprints. Avoid the current eager + fingerprint pass demanding absent old inputs for an accepted supplied result. +2. Reuse supplied targets and prerequisites individually. Generate missing + selected work in normal dependency order and compute its ordinary fingerprints + using actual resolved input identities. +3. Preserve explicit-target force versus prerequisite reuse. A local replacement + transitions its source to local checkpoint evidence; failures retain the + existing retry/retention policy without reviving superseded imported evidence. +4. Permit mixed supplied and locally generated artifact collections. Keep the + original target set separate from the prerequisite closure. +5. Test partial import plus a new target, a supplied disabled prerequisite, + changed historical model/prompt settings, forced target replacement, and an + ordinary partial local failure/retry. No blanket bypass of local freshness. + +Validation: `go test ./internal/stage ./internal/artifacts ./internal/manifest`. + +## Stage 5: Share supplied completion across planning and execution + +Status: Pending + +Read `internal/app/semantic_resume.go`, `plan.go`, +`runner_stage_execution.go`, `run_control.go`, bounded prerequisites, and +stage resume validators. + +1. Consult validated supplied coverage before requiring historical semantic or + per-speaker evidence for covered transcript work. Recheck actual supplied + files; invalid/missing products cannot sustain completion. +2. Make full-run and bounded-run decisions agree. In a restored context, missing + independent render/extract work does not block selected analysis unless its + actual required sources need those products. Do not mark unrelated stages + complete simply to satisfy the old all-prefix status check. +3. Keep actual consumer input checks: a request for absent intermediate JSON + still fails with actionable guidance. Use the fixed mapping and existing + input declarations rather than a configurable stage DAG. +4. Honor selected force and existing dependent invalidation. A supplied + completion shortcut must not defeat an explicit regeneration request. +5. Project decisions on cloned manifests without workspace writes, execution + adapters, or readiness probes. Retain CAT-13's relevant read-only S3 checks + for actual raw-audio preparation reuse. +6. Test full and bounded plans against real execution with missing superseded + transcripts, changed historical settings, and forced work. + +Validation: `go test ./internal/app ./internal/stage`. + +## Stage 6: Separate reference preparation from audio acquisition + +Status: Pending + +Read `config/validate_core.go`, `stage/prepare*.go`, and preparation semantic +evidence. Preserve ConfigKit's completed-configuration boundary. + +1. Allow absent audio selection in configuration; retain validation of any + supplied audio mode and existing mutual-exclusion/path rules. Require audio + when selected remaining work actually consumes it, including forced + transcription or ordinary uncovered source-based execution. +2. Separate stable-reference/history materialization from audio acquisition + through narrow preparation helpers. Reuse existing renderers and CAT-10's + prerequisite-inclusive history collector, not another input scheduler. +3. Persist honest preparation evidence for the work actually performed. Reference + preparation does not certify audio or manufacture missing documents. Retain + ordinary prepared-copy/source checks and reuse for raw-audio sessions. +4. Test reference-only preparation with supplied transcript coverage, absent or + invalid required references, and source-based preparation without audio. + Reference refresh preserves supplied transcript records and unrelated local + checkpoints. Keep the current raw-audio workflow covered. + +Validation: `go test ./internal/config ./internal/stage ./internal/artifacts`. + +## Stage 7: Wire artifact-only preparation into commands and readiness + +Status: Pending + +Read runner acquisition/composition, `session_readiness.go`, bounded +prerequisites, `plan.go`, and downstream readiness request builders. + +1. Determine supplied coverage before rejecting absent audio or missing old + prefix statuses. Under the workspace lock, make required references/history + available before downstream input checks, including bounded runs that start + after prepare. Reference-only work preserves supplied transcript coverage. +2. Compose adapters from remaining work. Standalone preflight keeps its enabled + capability checks and provider probes, but uses artifact-only references + without rebuilding covered transcript producers. +3. Project this preparation honestly without writes in `session plan`. A missing + real consumer input is still reported; coverage is not file reconstruction. +4. Verify full and bounded artifact-only execution with real references, no + audio, and no superseded transcripts. Check preflight, planning/execution + agreement, missing-reference/history diagnostics, and forced transcription. + Reuse CAT-10/CAT-13 checks for unchanged acquisition behavior. + +Validation: `go test ./internal/app ./internal/stage ./internal/config`. + +## Stage 8: Separate publication inventory reads from execution snapshots + +Status: Pending + +Read `artifacts/current_state*.go`, `remote_commit.go`, application remote +discovery/status/configuration consumers, and their tests. + +1. Extract the shared pointer/inventory reader so publication identity and + declarations are available without requesting a session-manifest object. + Retain pointer/commit identity, namespace, checksum, size, generation, and + bounded-read checks. +2. Expose campaign/session/run publication identity from the inventory. It is + remote publication identity, not proof of local stage execution. +3. Update remote status, published-artifact inspection, and distinct session + configuration acquisition to use inventory evidence. Retain the authored + session configuration's own acquisition/validation. +4. Add tests for an inventory without a snapshot, and an existing inventory whose + obsolete snapshot body is missing, malformed, or unsupported. These cases + must not obstruct publication inspection or configuration acquisition. +5. Keep any temporary old restore-reader wiring private until Stage 11's + cutover. The completed workflow has one inventory reader and no ledger-fetch + fallback. + +Validation: `go test ./internal/artifacts ./internal/app`. + +## Stage 9: Use inventory-only history and stop publishing execution ledgers + +Status: Pending + +Read `internal/previouscache`, `stage/prepare_previous.go`, +`publish*.go`, and consumers of remote manifest fields. + +1. Resolve previous-session products from exact published-output declarations + using the inventory reader. Remove the mandatory previous execution-manifest + transfer and its prepared-input record; retain actual history products and + required/optional handling. +2. Remove snapshot production, declaration, upload, and snapshot-only archive + paths from publication. Review run-file selection so diagnostic archives do + not accidentally reintroduce a remote progress-backup feature. +3. Preserve independently useful authored/prepared input publication, including + the session configuration used for remote acquisition. Keep product inventory, + immutable object transfer, lock carry-forward, pointer-last commit, and + cleanup authorization intact. +4. Keep old snapshot declaration recognition only as needed to read existing + inventories; never download or interpret their contents as authority. +5. Test previous history with no snapshot, locked carry-forward declarations, + optional absence versus access/integrity errors, and new publication with + no execution-ledger payload. Retain CAT-10 closure coverage. + +Validation: `go test ./internal/previouscache ./internal/stage ./internal/artifacts`. + +## Stage 10: Plan product imports and synthesized completion + +Status: Pending + +Read `internal/app/restore_plan.go`, product-path mapping, restore reports, +and the source registries/current concrete artifact catalog. + +1. Replace manifest-based product mapping with inventory source-to-canonical-path + mapping. Published remote destination names do not dictate local product + names. Preserve supported reference/audio import handling and `--include-audio`. +2. Import publication products, not arbitrary execution diagnostics or historical + output records. Resolve configured product locations through current concrete + definitions and existing product rules; preserve flat products and collision + detection. No remote producer paths or old configuration are required. +3. Classify downloads, identical files, and conflicts using existing filesystem + and force rules. Retain exact transfer declarations, including carried older + immutable objects. +4. Build a candidate local baseline from accepted products plus preserved local + evidence. Use the shared coverage helper and render selection; no publish or + cleanup success is synthesized. +5. Extend dry-run reports with actual imports and resulting satisfied/remaining + work. Do not fetch snapshots or write products/manifests to produce the report. +6. Test source-based mapping, configured remote rename, partial product sets, + collision/conflict behavior, and trimmed-only rendering coverage. + +Validation: `go test ./internal/app ./internal/artifacts`. + +## Stage 11: Install and merge local baselines under the existing lock + +Status: Pending + +Read `restore_execute.go`, restore recovery/marker code, manifest persistence, +and the existing shared workspace-lock lifecycle. + +1. Cut restore discovery/execution over to the inventory plan. Load existing + local progress under lock or create a fresh local manifest; never install a + downloaded execution ledger. +2. Install and verify selected files through existing confined sibling-temp + transfers. Update supplied records only for accepted installed/identical + products. Merge per-source changes, preserving unrelated stage evidence, + speaker records, analysis checkpoints, and local diagnostics. +3. For changed products, apply existing local dependent invalidation, then + register the supplied products in this import without checking historical + cross-product generation consistency. Preserve valid local authority for + identical files rather than gratuitously replacing it with supplied authority. +4. Save the merged baseline last; retain the incomplete-restore marker until + installation and save succeed. Retry after partial transfer or save failure + must converge without whole-workspace rollback. +5. Remove producer-path rebasing, downloaded-manifest install/classification, + and temporary dual-reader wiring. Update restore reports to describe local + import completion rather than restoration of a remote execution run. +6. Test fresh restore, existing local progress, identical/conflicting/forced + replacements, unrelated checkpoint preservation, cancellation, failed final + save, and retry. Reuse existing path and transfer tests for unchanged risks. + +Validation: `go test ./internal/app ./internal/manifest ./internal/artifacts`. + +## Stage 12: Prove the three operator workflows end to end + +Status: Pending + +Use real internal collaborators, temporary files, and fake external storage, +subprocess, and generation boundaries. Avoid post-restore manifest repairs. + +1. Publish A, lock it, generate local B, republish, then import into a fresh + workspace. Verify A resolves and supports downstream work. Cover a built-in + transcript and configured artifact; make the old snapshot unavailable. +2. Restore final trimmed JSON without audio or superseded transcripts. Reload + the saved manifest, compare plan and execution for full and bounded runs, + and generate extraction/analysis with required references. Covered transcript + producers make no adapter calls. +3. Cover trimmed-only rendering; default both-variant selection still reports + a missing normalized JSON when that selected input is needed. Selecting + another unavailable source reports absence rather than inventing a file. +4. Import partial analysis/extraction products, consume their ordinary source + IDs, add a new selected analysis artifact, and republish supplied products. + Verify local replacements establish normal checkpoints and semantic evidence. +5. Restore into local progress and demonstrate preservation, ordinary conflicts, + authorized replacement, and local-dependent invalidation. Demonstrate failed + local speaker/artifact work still resumes normally without remote restore. +6. Verify forced transcription requires audio; reference-only preparation keeps + the supplied baseline; standalone preflight retains its distinct probes. + Missing selected inputs/references remain errors. +7. Consolidate obsolete snapshot-based tests into these workflow and narrower + boundary tests. Keep meaningful lock, transfer, conflict, and recovery coverage. + +Validation: run focused workflow tests uncached, then `go test ./...`. + +## Stage 13: Align policy, documentation, and audit disposition + +Status: Pending + +1. Finalize and check the Stage 1 architecture policy adaptations: completion + can express executed work or satisfaction by supplied products; product + acceptance uses actual local + records; remote publication authority is the inventory. Remove requirements + for downloaded execution ledgers and historical fingerprints on supplied + products. Preserve ordinary generation evidence and safety boundaries. +2. Update canonical CLI, configuration, operations, troubleshooting, and focused + manifest/artifact/prepare/render/analyze/extract/publish/restore internals. + Explain original-source runs, product imports, and local resume. Include + render selection, local merge/conflicts, force distinctions, and deferred + remote execution recovery. Keep upstream library documentation linked. +3. Update maintained examples and affected example-loading tests. Remove + obsolete snapshot terminology and dead snapshot/rebasing helpers or fields + only where this cutover made them unused; preserve distinct session YAML. +4. Run all checks with the maintained toolchain: ```sh GOTOOLCHAIN=go1.27.4 go test ./... @@ -235,16 +450,12 @@ Status: Complete GOTOOLCHAIN=go1.27.4 go build ./... ``` -4. Review the diff for duplicated dependency algorithms, expanded target sets, - blanket fingerprint invalidation, and changes to optional-error semantics. - Confirm the new shared operations remain proportionate to CAT-10. -5. After successful validation, close CAT-10 in the audit catalog with links to - implementation commits and regression coverage; update its summary counts. - Note the implemented collector for future session-restore work and the narrow - shared-closure extraction under CAT-17 without closing that broader finding. - Leave original audit reports and unrelated statuses unchanged. -6. Mark these stages complete. Preserve pending roadmap work. - -Completion means every consumer derives history needs from the same selected -prerequisite closure, history reaches actual prerequisite generation, and target, -force, publication, and existing acquisition/restore policies remain intact. +5. Check every validation outcome in the feature roadmap against tests/current + behavior. Review for invented generation claims, new publication-wide + consistency rules, blanket checkpoint resets, or new migration machinery. +6. Close CAT-02 only after its round trips pass. Review other roadmap-assigned + findings individually: close only those whose offending lifecycle was removed + or remediation verified. Keep independent P3 work open and original audit + reports unchanged. Update discussion/catalog links and counts accordingly. +7. Mark implementation stages and feature status complete only after the entire + supplied-product workflow, documentation, and validation are complete.