diff --git a/docs/roadmap/session-restore.md b/docs/roadmap/session-restore.md index 381092d..6b9d386 100644 --- a/docs/roadmap/session-restore.md +++ b/docs/roadmap/session-restore.md @@ -1,6 +1,6 @@ # Session Restore from Published Artifacts -Status: Proposed; core behavior agreed, open decisions listed below +Status: Agreed scope; implementation pending ## Goal @@ -78,8 +78,8 @@ 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. A partial publication's interaction with render is an -open decision below. +other required inputs. Configure render for the transcript variants to produce; +a trimmed-only selection needs no untrimmed JSON transcript. ### Continue local work @@ -119,7 +119,7 @@ Illustrative coverage: | 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 render output work; they do not substitute for JSON inputs | +| 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 | @@ -189,6 +189,30 @@ 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, @@ -200,7 +224,24 @@ 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. -Behavior in a workspace with existing local progress is an open decision below. + +### 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 @@ -231,9 +272,11 @@ Primary areas: `internal/artifacts/current_state*.go`, ### Build and consume restore-defined completion Replace downloaded-ledger installation with local baseline construction from -the product mapping. Extend manifest handling and artifact availability so -built-ins, extraction lanes, and configured artifacts can be supplied by restore -without historical producer evidence. +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 @@ -264,6 +307,21 @@ 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](../policy/architecture.md) provisions that currently @@ -296,8 +354,16 @@ Use focused offline behavioral tests and representative assembled workflows: 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, under the missing-input choice below. + 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. @@ -324,45 +390,3 @@ 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. - -## Open Decisions - -### Restore into a workspace that already has local progress - -**Recommendation:** Merge restored product records and derived completion into -the existing local manifest, preserving unrelated local progress. Retain ordinary -file conflict handling; `--force` permits the existing eligible replacements. -When an imported replacement changes an input of locally generated work, apply -the existing local dependent-invalidation rules. Do not copy remote stage history -or discard unrelated speaker/artifact checkpoints. - -This fits the existing conflict-oriented restore workflow and preserves the -agreed local-resume feature, but needs careful affected-record reconciliation. - -**Alternative:** Restrict restore to a fresh workspace and construct a replacement -baseline there. This is simpler and avoids merging local progress, but adds an -operator restriction not yet requested. Operators would need a separate workspace -or an explicit cleanup before importing published products. Adopt that narrower -workflow only with approval. - -### Remaining render work when only the final trimmed JSON is published - -Current render produces both untrimmed and trimmed Markdown and requires both -JSON inputs. The agreed ultimate-output mapping can satisfy normalize through -the trimmed transcript while leaving the untrimmed JSON absent. A full run can -therefore reach render with only one of its two inputs. - -**Recommendation:** Allow render to produce the independently available transcript -variants in this restored-input workflow and leave the unavailable variant -explicitly unavailable. This lets a full run continue from the ultimate transcript -without regenerating its unneeded ancestors or requiring extra publication. -It is an additional render behavior change requiring approval, not an implicit -consequence of marking earlier stages complete. It does not require incremental -Notarius lane execution or a general partial-stage framework. - -**Alternative:** Preserve render's current two-input contract. A full run reports -the missing input; the operator can restore/publish both JSON variants, disable -render, or choose an extract/analyze-only range. This minimizes implementation -scope and avoids partial render semantics, but makes the final-transcript-only -workflow less convenient for ordinary full runs. Neither choice should pretend -the absent untrimmed JSON exists or automatically regenerate the covered chain.