21 KiB
Session Restore from Published Artifacts
Status: Agreed scope; implementation pending
Goal
Define narratio session restore ID as retrieving the identified session's
published artifacts and making them usable as inputs to subsequent work.
Restore constructs local manifest completion state from the products available
after import. Completion means that a stage's work is satisfied by those
products; it does not assert that the stage executed in this workspace.
The operator can start from original audio, start downstream work from published products, or continue interrupted work in an existing local workspace. Remote execution-checkpoint upload and recovery are deferred.
This is a feature roadmap, not a staged implementation plan. It incorporates the decisions in the audit discussion and the subsequent agreement to synthesize stage completion using a small stage/output mapping. That agreement supersedes earlier suggestions that restore must reconstruct historical producer evidence or avoid marking covered upstream stages complete.
Current Baseline
Reviewed against d8bc99b17efdddd0a728ef519b2e5a1d25f85fa9.
- Publication writes immutable objects, a remote commit inventory, and a current pointer. The inventory already identifies sources, exact object keys, sizes, checksums, and storage generations. It also includes a session-manifest snapshot.
- Remote-state discovery requires that snapshot and decodes its execution ledger. Restore uses it to map products, rebase producer-machine paths, and install a local manifest after downloading files.
- Publication locks can retain output A while the local execution ledger describes replacement B. Current restore can install A alongside B's completion evidence, report success, and leave normal artifact resolution rejecting the result.
- Built-in, extraction, and configured-artifact resolution depend on recorded producer success or generation evidence. Files copied into canonical locations alone are insufficient.
- Bounded runs require preceding stage statuses. A full run additionally applies
semantic and content resume checks, so merely writing
succeededwould not establish a durable restored baseline under the current validators. - Prepare combines stable reference materialization, audio acquisition, and previous-session inputs. Session validation requires an audio source. These responsibilities currently obstruct a fresh artifact-only workflow.
- Previous-session artifact selection already uses the publication inventory, but its shared discovery and local cache still require the execution snapshot.
- Local speaker and analysis checkpoints already retain completed work after ordinary failures. They do not need remote backup to support local retry.
Implemented mechanics are documented in restore, artifacts, manifests, prepare, and publication. The original defect and test gap are linked from CAT-02. Their historical-evidence remediation direction is replaced by this roadmap's product-import model.
Operator Workflows
Start from original sources
Supply the authored campaign/session inputs and raw audio in a fresh workspace. Run Narratio normally. Processing stages generate their products and record ordinary local progress and reuse evidence.
Start from published products
Run narratio session restore ID using the selected campaign and remote storage.
Restore retrieves that session's published products, places them in the local
workspace, and constructs the corresponding completion baseline.
Then select downstream stages, or run the ordinary full pipeline. Covered work is reused; remaining work proceeds in canonical order when its actual inputs are available. Required campaign/session configuration and references remain inputs to the new work. Restoring a transcript does not reconstruct all authored configuration or make unrelated inputs appear.
For example, a restored final trimmed JSON transcript should allow extraction and analysis without raw audio, per-speaker transcripts, or earlier combined transcripts. The selected work still needs its configured party, glossary, and other required inputs. Configure render for the transcript variants to produce; a trimmed-only selection needs no untrimmed JSON transcript.
Continue local work
Rerun Narratio against the existing local workspace. Ordinary local checkpoints retain completed speakers/artifacts, and normal local resume decides what work remains. Restore is unnecessary for this workflow.
Targeted End State
Publication is the import authority
Restore selects published products through the current pointer and its publication inventory, including exact older declarations preserved by publication locks. It uses source identities and Narratio's local product-path definitions rather than a remote execution manifest to place and register products.
Imported products are accepted as supplied inputs. Their historical prompts, models, configuration, generation fingerprints, producer run IDs, and generation provenance are unnecessary for acceptance and use. Existing transfer-integrity, content, and destination checks remain distinct from generation history.
The product inventory remains useful for selecting and verifying files. A remote session-progress snapshot is not a prerequisite for publication consumption. Products from different generations can coexist in one publication.
Restore synthesizes a local completion baseline
Use a small, centrally owned mapping of stages to products and the ultimate products that satisfy earlier transcript work. Use the existing artifact identities and fixed pipeline rather than a configurable workflow graph.
Illustrative coverage:
| Restored product | Work satisfied for continuation |
|---|---|
| Base JSON transcript | Transcription and merge |
| Polished JSON transcript | The transcript chain through polish |
| Final normalized JSON transcript | The transcript chain through normalize |
| Final trimmed JSON transcript | The transcript chain through trim |
| Rendered Markdown products | Their configured render output work; they do not substitute for JSON inputs |
| Extraction products | Corresponding extraction output availability and aggregate coverage when its required products are present |
| Configured analysis artifacts | Their individual artifact work; unrelated missing artifacts remain work |
This mapping is about satisfaction, not reconstruction. A final trimmed transcript can cover earlier stages even though their intermediate files are absent. The manifest records actual imported files and marks covered stages complete without inventing output records for files that do not exist.
Keep independent products independent. A transcript does not prove that extraction, analysis, or rendering completed. Render and extract remain sibling consumers. Bounds are separately available only when their actual product is present. Prepared campaign references and previous-session inputs also need their actual documents; transcript coverage does not supply them.
The baseline is durable across invocations. Its representation must be accepted by manifest loading, resolution, planning, and execution without fabricating historical fingerprints or satisfying irrelevant per-speaker records. Use only the local bookkeeping needed to express coverage and actual product availability. The manifest representation is an implementation choice.
Import does not authorize publish or cleanup by synthesizing their successful execution metadata. Those actions retain their own lifecycle and authorization.
Resume respects the supplied baseline
A normal full run and a bounded downstream run honor restored completion. Absent audio, missing superseded intermediate transcripts, changed original model settings, and unavailable historical fingerprints do not by themselves regenerate covered work.
Preparing references for new downstream work must likewise preserve the supplied transcript baseline rather than invalidate it for lacking the new preparation's generation history. Locally generated dependents still follow their ordinary input-change and invalidation rules.
Existing checks on actual required inputs still apply. If a consumer requests an intermediate product that was not restored, completion coverage does not make that file available. Report the missing input through the normal command path; the operator can supply it, select different downstream work, or regenerate its producer with the needed inputs.
Force retains its existing stage/range and artifact-target meaning. Explicit regeneration requires the inputs actually consumed by that operation; restoring a final transcript does not supply audio for forced transcription. Newly executed work receives ordinary local checkpoints and semantic reuse evidence. The relaxed import rules do not disable normal local retry or freshness behavior for that work.
Partial analysis imports must remain usable individually. Additions to the current artifact selection can schedule missing work without requiring all published artifacts to have historical analyze fingerprints. Existing explicit-target versus prerequisite force behavior remains unchanged.
Preparation and readiness support artifact-only execution
Make the stable references needed by remaining work available without requiring audio acquisition or execution of covered transcript producers. Relax unconditional audio-source requirements where necessary for this workflow, while validating audio configuration and availability when audio processing is actually needed.
Use ConfigKit's completed configuration and existing Narratio domain projections. Separate the needed preparation responsibilities narrowly; this is not a second configuration system or a general input scheduler.
Planning, automatic downstream readiness, and adapter composition must agree with the restored coverage. A covered producer is not projected to rerun merely to recover historical evidence. Standalone preflight retains its own documented capability checks; it must accommodate the artifact-only input context without rebuilding covered transcript work.
Render selection is explicit
Configuration selects which transcript variants render produces: normalized (untrimmed) Markdown, trimmed Markdown, or both. Preserve the current both-variant behavior when the new selection is omitted. Existing render enablement remains available.
Render resolves the JSON inputs and produces the Markdown outputs for the selected variants. Selecting only trimmed Markdown requires only the final trimmed JSON; absence of the unselected normalized JSON does not block rendering. A selected variant's missing or invalid input remains an error rather than causing an automatic switch to whichever variants happen to be available.
Apply this selection consistently to generation, restore-derived completion, resume evidence, planning, and readiness. Restored Markdown products satisfy render according to the configured selection; selecting an additional missing output leaves that render work to perform. Semantic evidence covers the selected variants and their inputs rather than requiring an unselected JSON variant.
An operator restoring only the final trimmed JSON can select trimmed-only render and run the remaining pipeline. A downstream artifact or publication rule that requires an unselected Markdown product still needs that actual product. This does not add per-output checkpointing or a general partial-stage framework.
Existing restore controls remain useful
Retain dry-run reporting, ordinary file conflicts, explicit forced replacement, workspace path handling, transfer verification, and retry after partial restore. Dry run reports planned imports and resulting stage coverage without installing files or a manifest. Existing optional published-audio handling can remain an input import; it is not execution-checkpoint recovery.
Install or update the local baseline after the corresponding imports have been accepted. Preserve the existing partial-restore recovery mechanism rather than adding whole-workspace rollback or stronger crash/power-loss guarantees.
Restore preserves existing local progress
Restore can import into a fresh workspace or a workspace with local execution progress. Merge imported product records and derived completion into the local manifest, preserving unrelated local progress and speaker/artifact checkpoints. This combines local progress with supplied products, not two historical execution ledgers.
Retain ordinary file conflicts: download missing products, retain identical files,
and require restore --force for eligible conflicting replacements. That flag
authorizes file replacement, not forced pipeline regeneration.
If an imported replacement changes an input of locally generated work, apply the existing local dependent-invalidation rules. Products imported in the same restore form the selected supplied baseline; their historical generation consistency is not examined. Do not copy remote execution history or discard unrelated local completions as a shortcut to constructing the baseline.
Required Changes
Decouple remote discovery from execution snapshots
Change the shared current-state reader to expose publication identity and declared products without requiring, decoding, or validating a historical session manifest. Update restore, remote status, artifact inspection, configuration fallback consumers, and previous-session acquisition accordingly.
Stop emitting execution-ledger snapshots solely for the deferred checkpoint purpose. Remove execution-snapshot rebasing and recovery code that no longer serves the chosen workflow. Preserve the authored or standalone prepared session configuration used for remote configuration acquisition: that document is distinct from the session progress manifest. Keep required reference/input material under its existing purpose rather than preserving a backup feature implicitly.
Reuse the current publication inventory and storage primitives where they fit. Existing inventories can contain historical execution-snapshot declarations; product import should not interpret those declarations as execution authority. This scope does not require a new remote checkpoint protocol or historical generation reconstruction.
Primary areas: internal/artifacts/current_state*.go,
internal/artifacts/remote_commit.go, internal/previouscache,
internal/stage/publish*.go, and application remote/configuration consumers.
Build and consume restore-defined completion
Replace downloaded-ledger installation with local baseline construction from the product mapping, merging it with existing local progress where present. Reconcile affected local completion records after eligible replacements while preserving unrelated records. Extend manifest handling and artifact availability so built-ins, extraction lanes, and configured artifacts can be supplied by restore without historical producer evidence.
Apply the same coverage interpretation to full-run decisions, bounded prerequisites, stage resume validators, and analysis reconciliation. Merely writing existing success statuses while leaving current validators unchanged would not implement the feature. Source resolution must continue distinguishing actual products from earlier stages satisfied only by an ultimate output.
Update publication's local-source resolution as well: an imported product should not become unusable merely because the operator later selects publication. Existing remote publication locks remain authoritative.
Primary areas: internal/app/restore*.go, bounded prerequisites and runner
decisions, internal/manifest, internal/artifacts resolution/catalog/evidence,
and stage-owned resume/checkpoint handling.
Adapt preparation and operator reporting
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 irrelevant generation checks.
Status, plan, restore reports, and command help should explain which work is satisfied by restored products and which actual inputs or products are missing. Reporting local restored completion is administrative state, not a requirement to recover generation provenance.
Primary areas: internal/config/validate_core.go, internal/stage/prepare*,
internal/app/plan.go, runner/readiness composition, and report projections.
Make transcript rendering variant-selectable
Add a narrow variant selection to render configuration using native configuration defaults and validation. Keep the existing both-variant default. Configuration field spelling and representation can be settled in the implementation plan.
Update render invocation, source requirements, output declarations, semantic evidence, and restore coverage to use the selected variants. Use the same rules for ordinary and restored sessions. Retain existing content validation and failure handling for selected inputs and attempted conversions.
Primary areas: internal/config, internal/stage/render.go,
internal/stage/semantic_contracts_refinement.go, restore's product mapping,
and related planning/readiness tests.
Align policies and canonical documentation
Update architecture policy provisions that currently equate stage completion and product availability exclusively with recorded local generation, require remote manifest installation, or imply historical resume evidence for every restored product. Define restore-created completion positively as satisfaction by supplied products, alongside ordinary executed completion.
Update CLI, operations, troubleshooting, and the focused restore, artifact, manifest, prepare, publication, and affected stage documents when implementation lands. Include the three operator workflows and explain that remote execution-checkpoint recovery is deferred. Keep upstream library behavior linked to its canonical documentation.
Audit records remain evidence of the baseline; they are not policy constraints requiring the old restore semantics. Other audit remediations, including the workspace-wide locking redesign, remain separate work rather than prerequisites for a publication-import framework.
Validation Outcomes
Use focused offline behavioral tests and representative assembled workflows:
- Publish A, lock it, generate B locally, republish, and restore into a fresh workspace. A resolves and supports downstream work without importing B's fingerprints or requiring the execution snapshot's contents to be readable. Cover a transcript and a configured artifact.
- Restore an ultimate transcript with no audio and no superseded intermediate transcript files. Persist and reload the synthesized manifest, then compare planning and actual downstream execution. Covered producers make no adapter calls; required references are prepared or supplied normally.
- Re-run the full pipeline after restore and demonstrate coverage reuse plus execution of genuinely remaining work with the configured render selection. No restored publish/cleanup success is fabricated.
- Restore into a workspace with local progress. Exercise identical files, ordinary conflicts, and forced replacement; preserve unrelated checkpoints and apply local invalidation to affected locally generated work without inspecting the generation history of imported products.
- Render trimmed-only with no untrimmed JSON, render untrimmed-only, and retain both-variant behavior when selection is omitted. Confirm missing selected inputs fail, unselected inputs are unnecessary, and selection changes affect render completion and reuse consistently.
- Import extraction and partial analysis products, consume them through normal source IDs, and generate additional selected artifacts without reconstructing historical tool settings. Preserve meaningful force behavior.
- Continue a locally failed transcription or analysis invocation and retain its previously checkpointed completions. This remains independent of restore.
- Read previous-session products and remote status from publication inventory alone. Preserve configuration acquisition from the distinct session document.
- Retain representative dry-run, conflicting-target, invalid-transfer, failed baseline-save, and partial-restore retry coverage. Choose tests for observable risks, not exact helper structure or incidental wording.
The implementation plan should select checks proportionately under the testing policy. This planning pass implements no behavior.
Scope Boundaries
Keep the fixed pipeline and existing command name. New command families, arbitrary workflow graphs, continuous remote backup, checkpoint upload timing/failure machinery, and historical generation reconciliation are outside this scope. Local resume remains a supported feature.
Preserve selected transfer, path, conflict, and publication behavior without turning incidental implementation choices into additional guarantees. This roadmap introduces no publication-wide same-generation requirement, new data-size cap, requirement to publish every intermediate file, or compatibility/migration framework. New restrictions or stronger guarantees need an explicit decision.