From c53c764c4dfe2c0ddcea95cc4ebd00e1743ce8ab Mon Sep 17 00:00:00 2001 From: Eric Rakestraw Date: Sun, 29 Nov 2026 23:43:39 +0000 Subject: [PATCH] Plan the shared pipeline and workspace cutover --- docs/roadmap/implementation.md | 719 +++++++++++++++++++++++++++++++++ docs/roadmap/pipeline.md | 32 +- 2 files changed, 732 insertions(+), 19 deletions(-) create mode 100644 docs/roadmap/implementation.md diff --git a/docs/roadmap/implementation.md b/docs/roadmap/implementation.md new file mode 100644 index 0000000..8c9125c --- /dev/null +++ b/docs/roadmap/implementation.md @@ -0,0 +1,719 @@ +# Shared pipeline cutover implementation plan + +## Purpose and execution instructions + +Implement the final state in [pipeline.md](pipeline.md). That roadmap owns product +intent, operator choices, upstream baselines, and compatibility scope. This plan +owns the ordered implementation steps. All stages below are initially pending. +Each stage is a bounded prompt for a Luna coding agent. Execute them in order. + +This is one end-to-end sprint across Narratio and `../narratio-reference-catalog`. +Intermediate stages may leave build errors or transitional test failures; record +the unresolved integration work and continue through the specified later stages. +Do not add temporary compatibility machinery to make an intermediate checkpoint +usable. A stage's completion means its assigned outcome is implemented and +reviewed; the sprint completes only after the final verification stage. + +Start with [Development](../development.md) and [Agent Policy](../policy/agents.md). +Read the architecture, testing, documentation, and OSS policies for their +applicable work. Read each owning repository's agent instructions before changing +it. Follow its scoped commit policy; record the commit and verification outcome +for each completed stage here. Preserve unrelated changes. Publication, release +tags, pushes, and changes to other upstream applications are outside this plan. + +Coverage map for the roadmap's verification outcomes: + +| Outcome | Primary stages | +| --- | --- | +| Campaign contract and initialization | 4–6, 8, 22 | +| Shared contracts and catalog | 1, 4, 5, 7 | +| Prepared inputs, glossaries, references | 8–9 | +| Flat destinations and collision checks | 3, 10, 12, 16 | +| Audita and Notarius execution | 11–13 | +| Readiness | 14 | +| Latest views and diagnostic routing | 15–16 | +| Audio simplification | 17 | +| New-state boundary, publication, restore, cleanup | 2, 18–20 | +| Reuse, force, and integration evidence | 21–22 | +| Canonical documentation and final verification | 23 | + +Read the complete feature roadmap once at sprint entry. Subsequent prompts can +read the named sections and owner documents for their stage. Inspect existing +tests and use codebase-memory-mcp for code discovery; the entry points below +identify owners rather than authorize indiscriminate rewrites. Prefer native +library APIs and the existing implementation boundaries. + +## Baseline and fixed implementation choices + +- Narratio baseline: `f2829f31e800551bce4a28ca73059d82357e61f7`. + It has native ConfigKit/CommandKit acquisition, four wrapperless glossaries, + Audita v4.2, Notarius v0.8.1 receipt/index handling, and the old workspace. +- Catalog baseline: `974b0403b610056f3477abb5dfa22d210cd3c2a9` at + `../narratio-reference-catalog`. Its catalog index and synthetic vocabulary + already exist; migration does not create real-world vocabulary. +- Use the exact released schema, ConfigKit, Audita, and Notarius revisions in + [Released baselines](pipeline.md#released-baselines-and-ownership). Obtain + contracts from those revisions, not an arbitrary later checkout. No schema SDK + import or subprocess Go-package dependency is required. +- Use `narratio.session-manifest.v2` as the new supported session-state marker. + Change the existing marker/validator, not a parallel migration framework. + Retain current remote commit/pointer formats unless a field actually changes. + Their referenced session manifest must be supported before local installation. +- Keep schema resources in a small `internal/domaininput` owner, with exact + versioned resource paths, adjacent semantics, and source provenance. It owns + shared structural/semantic validation, not configuration resolution or task + execution. Reuse the existing JSON Schema engine and register resources offline. +- Shared extensibility must survive typed binding. Use native dynamic mappings + and/or supported inline maps at extensible boundaries, retaining the actual + ConfigKit result and its presence/source evidence. Typed operational settings + remain strict. Do not round-trip YAML through a second loader to manufacture a + typed view; ordinary field interpretation yields separate domain views. +- Keep all campaign/session fields and omission rules exactly as specified in + [Campaign and session field layout](pipeline.md#campaign-and-session-field-layout). + Shared optional null rules and Narratio session clearing rules are distinct. +- Preserve the four individual glossary IDs and add exactly + `narratio.input.glossary.combined`, prepared as + `inputs/glossaries/combined.yml`. Bind it to both Notarius glossary roles. + The complete roster remains `narratio.input.party`. +- Keep existing absolute/relative output-path syntax where it can identify a + valid product destination. Analysis/bounds outputs must resolve directly under + `artifacts/`; combined transcripts directly under `transcripts/`. Extraction + output configuration gains optional `filename`, defaulting to `.json`. + It names one flat file, not a remote publish destination. +- Use reported Notarius bundle roots below the run-local staging output root. + Retain original bundle evidence under its producing run, with its prior + session-durable lifetime. Canonical extraction availability depends on promoted + files and Narratio evidence, not on an index or diagnostic bundle surviving. +- Keep current byte limits, credential handling, workspace sharing modes, + cancellation, and file confinement. Add neither new caps nor exact-error-text + contracts. Managed latest-attempt links are a specifically supported navigation + feature, not general permission to follow arbitrary symlinks. + +## Stage 1 — Bundle shared contracts and add offline domain validation + +**Read:** roadmap “Shared acquisition and prepared inputs”; schema release +validation and each selected semantic document; OSS policy. Entry points: +`internal/glossary/glossary.go`, existing schema resources, and `go.mod`. + +**Implement:** + +1. Vendor the unmodified glossary, RPG party, and RPG campaign `0.2.0` schema + resources and their actual dependency closure from `2026.11.1`. Retain IDs, + semantics, exact source commit, and applicable licensing/attribution. +2. Add `internal/domaininput` using the existing JSON Schema dependency. Decode + schema-resource numbers exactly; register all required resources locally and + refuse missing-resource network retrieval through the compiler's loader. +3. Accept completed native domain values. Add only shared semantic checks not + expressed by JSON Schema, notably exact entry-ID uniqueness per collection. + Schema-valid extensions and omitted/null/empty distinctions remain data. +4. Replace the private glossary validator as callers migrate; leave acquisition + and composition with ConfigKit. Do not copy the schemas repository's harness. + +**Verify:** structural and semantic boundaries for all three contracts, valid +extensions, aliases null/empty, duplicate glossary IDs, and the class-level bound. +Use local synthetic fixtures; no sibling checkout is needed by default tests. + +## Stage 2 — Establish the supported-state boundary + +**Read:** roadmap “One cutover and durable-state boundary”; +[Manifest Internals](../internal/manifest.md) and +[Restore Internals](../internal/command-restore.md). Entry points: +`internal/manifest/{manifest,store}.go`, `internal/artifacts/current_state.go`, +runner acquisition, and restore discovery. + +**Implement:** + +1. Change creation, loading, saving, and validation to the selected v2 marker. + Keep current transcribe/analyze subcollections and their versioned contracts. +2. Reject unsupported local session state before changing historical session + files, creating execution workspaces, normalizing records, or attempting reuse. + Absence permits new-session creation; unsupported state is not absence. +3. Validate the session manifest in remote current-state discovery before restore + planning/installation and previous-session preparation. Do not migrate old + snapshots or change remote history. Disposable download staging is not a + conversion of historical state. +4. Preserve ordinary explicit whole-session deletion and lock behavior. Force + execution/restore does not reinterpret unsupported state as new-format data. + Explain regeneration or deliberate manual relocation using existing diagnostics. + +**Verify:** current/new state succeeds; old, absent-version, and unsupported local +and remote manifests fail without rewriting existing session files. Test through +runner and restore entry points, not just the version comparison function. + +## Stage 3 — Define the canonical workspace paths + +**Read:** roadmap “Final layout and ownership”; [Workspace Internals](../internal/workspace.md). +Entry points: `internal/artifacts/paths.go`, layout creation in its local store, +`internal/config` path constants, and `internal/stage/run_local.go`. + +**Implement:** + +1. Model flat products, raw/combined transcripts, inputs, audio, run-local + logs/debug, and latest-view paths through the existing path owner. +2. Move previous-session preparation to `inputs/previous/` and verified reference + snapshots to `inputs/references//`. Keep their existing + content identity and confinement rather than inventing another cache. +3. Remove unused root-level reports/config/current/cache scaffolding where it + has no remaining content role, plus `transcripts/trimmed/`. Route remaining + consumers to their selected category in later stages; add no legacy aliases. +4. Retain root, campaign/session identity, manifest, lock, and restore-marker + placement. Do not eagerly create run directories or latest links for reuse. + +**Verify:** path-model tests cover the complete target layout and preserved +configurable root. This stage defines paths; producer routing follows later. + +## Stage 4 — Adopt the shared roster with Narratio-wide validation + +**Read:** roadmap “Narratio-wide roster requirements”; shared party semantics; +[Party Contract](../integrations/party.md). Entry points: `internal/config/party.go`, +party acquisition/rendering, `artifact_families.go`, and native party inspection. + +**Implement:** + +1. Acquire shared party envelopes through ConfigKit; validate the completed + mapping with Stage 1 and apply Narratio's existing nonempty roster, ID, + player/name/class, ambiguity, and positive-level requirements consistently. +2. Replace the marker and singular `alias` with shared `aliases`. Preserve + supported extensions and explicit shared null/empty states in retained data; + derive family/member and players views separately. Preserve deterministic + consumer ordering without claiming YAML map order is shared identity. +3. Update file/bytes loading, explicit `--party-file` selection, native inspection, + and canonical rendering together. An override selects the roster for the + invocation without rewriting the campaign's authored reference. +4. Keep stable character-based artifact IDs and the existing players projection + identity. Its local projection format need not become another shared schema. + +**Verify:** imports, overrides, whole-document extension forwarding, shared marker +and alias spelling, and consistent Narratio rejection even without class-related +artifacts. Family keys, dependencies, and repeated player names still work. + +## Stage 5 — Replace campaign and session configuration shapes + +**Read:** roadmap “Campaign and session field layout” and “Shared acquisition”; +[Configuration Internals](../internal/configuration.md). Entry points: +`config.go`, `document_configkit.go`, validation, resource resolution, and renderers. + +**Implement:** + +1. Replace campaign `campaign_id` with shared `id`; use `references.party`, root + setting/system selectors, and the specified `narratio.inputs` extension. + Validate the shared envelope and strict typed Narratio settings through the + native lifecycle. Preserve shared extensions outside those typed settings. +2. Add inline autocorrection rules with the existing Seriatim rule fields + `target` and `match`; keep explicit replacement behavior separate from glossary + data. Remove campaign/session `autocorrect_file` and `spell_catalog_file`. +3. Apply each session default independently. Absent inherits; supplied values + replace; `[]`/null clears autocorrection; supplied inline glossary replaces + that whole contribution. Clearing inline vocabulary does not clear its file. + Retain existing optional-selector clears and reject null/empty required paths. +4. Resolve resource origins at their new native paths, including inherited/imported + references. Keep identity agreement, CLI-relative invocation context, safe + snapshots, and captured provenance. Shared root optional-field nulls remain + invalid where upstream says so; do not impose that rule on session clears. +5. Add optional `pipeline.campaigns.session_template_file`, resolving its source + origin. Keep the explicit campaign template override under `narratio`. + +**Verify:** table-driven absent/null/empty/replacement cases, invalid retired keys, +wrong campaign identity, native imported origins, shared extensions, and strict +unknown operational fields. Exercise file and contextless session snapshots. + +## Stage 6 — Complete native acquisition, inspection, and session initialization + +**Read:** roadmap “Author once” and “Worked campaign bundle”; native acquisition +and inspection sections of Configuration Internals. Entry points: +`configuration_acquisition.go`, `configuration_commands.go`, campaign selection, +`session_init_command.go`, and session-template helpers. + +**Implement:** + +1. Thread the new campaign identity/roster/settings through lazy campaign/session + acquisition, derived catalogs, identity assertions, and local/remote session + loading. Preserve actual ConfigKit results for all inspection scopes. +2. Select templates in campaign → pipeline installation → built-in order. Use + existing narrow placeholders and explicit session/audio options; add a small + built-in template rather than a new templating engine or required installed file. +3. Keep independent comparison acquisition, source/history evidence, redaction, + and inspection-only override behavior. Native inspection must not present a + prepared document or derived catalog as the effective configuration. +4. Render valid local and remote session documents with the new defaults and + original authoring-context behavior. No new CLI route is needed. + +**Verify:** three-file setup initializes a session with no extra template; both +template overrides work and invalid selected templates do not fall back silently. +Cover party override, independent inspection, remote authored-session preference, +and source-relative template resources through existing application tests. + +## Stage 7 — Migrate the shared reference catalog and its local checks + +**Read:** roadmap “Reference catalog adoption”; catalog README, FORMAT, license, +agent instructions if present, and compatibility script. Work only in +`../narratio-reference-catalog` for its migration, then record its resulting commit. + +**Implement:** + +1. Convert the indexed setting/spell entry points to shared envelopes, retaining + selectors, paths, entries, and partial import fragments. Remove consumer + instruction fields from maintained examples. Keep provenance factual and CC0. +2. Replace its private schema with the exact shared glossary resources, semantics, + dependency closure, and notices. FORMAT becomes the catalog authoring/selection + guide; upstream remains the field-level owner. No resolved export copies. +3. Add a small Go development validator under `cmd/validate` and a minimal module + using ConfigKit v1.4.0 and the maintained JSON Schema engine. Validate every + indexed source after native imports, its expected setting/spells role, and + exact final entry-ID uniqueness. Partial examples validate after composition + with a complete fixture; no new private partial schema is necessary. +4. Add focused valid/invalid tests and a local CI invocation of the same checker. + Keep dependencies pinned, source paths relative to their native definitions, + and default checks offline after dependency preparation. Read-only checking + must not generate canonical vocabulary. Update notices for actual dependencies. +5. Update README/FORMAT and retain the opt-in compatibility script; final consumer + execution is Stage 22. Commit this repository's unit locally and record its + full new commit for Narratio examples/verification. No catalog tag is required. + +**Verify:** every indexed source and maintained example, imports, null aliases, +extensions, wrong marker/known shape, wrong collection role, and duplicate IDs. +Record `go test ./...` and validator results in the catalog checkout. Do not +require Narratio or Audita binaries for catalog validity. + +## Stage 8 — Prepare campaign, session, speaker, and autocorrection inputs + +**Read:** roadmap “Shared acquisition and prepared inputs”; +[Prepare Internals](../internal/stage-prepare.md). Entry points: `prepare.go`, +`prepare_resume.go`, prepared-input identities, config renderers, and semantic contracts. + +**Implement:** + +1. Materialize effective standalone new-format campaign/session/party documents, + unchanged speaker-mapping input, and the players projection in canonical + `inputs/` locations. Derive from completed results, not a second resolution pass. +2. Serialize selected autocorrection rules to the Seriatim input envelope + `autocorrect: [...]`, including an empty list when no replacements apply. + The campaign/session authored field is the rule list, not a file wrapper. + Reuse existing replacement semantics and adapter validation boundaries. +3. Keep manifest-backed checksum/size/provenance records for the generated input. + Resume compares effective rule bytes and source meaning, not obsolete authored + filenames. Preserve independent session replacement/clearing behavior. +4. Remove private spell-overlay copies, cleanup, and prepared records. Update + input-source registration to reject its retired source rather than alias it. + +**Verify:** imports and standalone snapshots, empty/nonempty autocorrection with +Seriatim-shaped files, checksum/provenance records, and changed rules triggering +ordinary preparation invalidation. Source relocation with equivalent effective +values must not gain a new blanket invalidator. + +## Stage 9 — Prepare shared glossary envelopes, combined input, and references + +**Read:** roadmap “Glossary composition and bindings”. Entry points: +`internal/glossary/{glossary,resolve}.go`, glossary configuration adaptation, +prepared source registration, and `extract_references.go`. + +**Implement:** + +1. Resolve only selected catalog files and the optional campaign file/inline + contribution. Compose campaign under inline through native ConfigKit inputs + and sequence identities, then validate the completed shared mapping. +2. Derive party vocabulary from the selected canonical roster. Write four + individual shared envelopes and the combined envelope, each with the shared + marker and collections mapping. Always include all four roles in the combined + file, even when empty. Preserve applicable collection metadata/extensions. +3. Register the combined logical identity and explicit input dependencies. + Preserve complete source data where task projections omit it; do not turn + collection extraction into an upstream schema rewrite or custom merge engine. +4. Use the Stage 3 reference snapshot paths and existing streamed checksum/size + verification before/after execution. Share verified paths between generation + and readiness. These files are managed inputs, not subprocess cache. +5. Update prepare reuse comparison and safe publication input enumeration for + the fifth file; later lifecycle stages complete transport/install behavior. + +**Verify:** selected-only reads, native composition, empty and extended collections, +both Notarius roles resolving the same prepared source, four individual Audita +inputs, corrupted/missing snapshot handling, and whole-file invalidation when any +combined collection changes. Tests use a copied synthetic catalog, not a live repo. + +## Stage 10 — Configure flat outputs and native Notarius controls + +**Read:** roadmap “Output placement and collision checks” and Notarius invocation +and cache sections. Entry points: output config/validation, artifact-family +derivation, artifact catalogs, and bounded planning. + +**Implement:** + +1. Replace Notarius resume/chunk-cache settings with optional native `cache` + modes; add enable-only `debug`. Remove output descriptor constraint fields, + retaining required output keys/lane IDs and optional flat `filename` overrides. +2. Apply the fixed output naming choices above. Reconcile analysis/family/bounds + configuration with flat local products and combined-transcript categories. + Reject collisions across built-ins, extraction, explicit artifacts, and all + expanded families, naming both producers before execution. +3. Perform session/roster-dependent checks after domain derivation but before + an execution attempt; app-only inspection need not acquire a roster. Planning + and execution consume the same validated derived destinations. +4. Preserve explicit remote publish destinations and semantic source IDs. + Do not sanitize or silently rename colliding products, filter lanes implicitly, + or require descriptor fields the producer no longer supplies. + +**Verify:** native control omission/selection, retired-field rejection, default and +explicit extraction filenames, family/built-in cross-collisions, valid absolute +and relative canonical output forms, and unchanged remote destination semantics. + +## Stage 11 — Replace the Notarius generation adapter protocol + +**Read:** roadmap Notarius invocation/completion sections and pinned upstream +subprocess, output, and CLI contracts. Entry points: +`internal/adapters/notarius/{runner,subprocess,fake}.go` and supervision tests. + +**Implement:** + +1. Build native args: `--input-file`, `--overlay`, `--format json`, references, + staging output, native cache, and debug controls. Preserve omitted versus + explicit overlay selectors, exact credentials, timeouts, and cancellation. +2. Decode completion only after successful process exit. Preserve expected + pipeline, reported absolute directory, counts, optional debug location, and + positive fallback count. Require a confined reported root under supplied + staging; never discover outputs by scanning or parsing run names. +3. Replace receipt/index/sidecar structs and parsing with the native report. + Keep stdout separate from bounded redacted diagnostics. Handle nonzero, + malformed, partial, or capture-failed outcomes without recovering success + from incidental files. Add no independent domain-quality assessment. +4. Update fakes to represent the native result and actual published directory; + remove old receipt-driven fixture machinery as its callers migrate. + +**Verify:** argument vectors and environment, overlay omission/empty forwarding, +success/failure report delivery, unsafe directories, cancellation, and permissive +successful fallback. Do not compare artifact count with required lane count. + +## Stage 12 — Promote extraction products and replace extraction evidence + +**Read:** roadmap “Notarius completion, products, and cache”; artifact and extract +internals. Entry points: `extract.go`, `extract_resume.go`, extraction evidence, +catalog hydration/resolution, and source/publication metadata. + +**Implement:** + +1. Resolve required lanes using the upstream lane-ID filename mapping. Validate + bounded regular JSON files and stage every required result before promotion + to its Stage 10 flat destination. Keep existing promotion/failure semantics; + do not invent a multi-file transaction or rollback guarantee. +2. Record canonical output checksum/size, configured lane identity, factual + native completion metadata, and result-affecting reference/input evidence. + Remove `notarius_index` and descriptor/receipt acceptance dependencies. +3. Retain the original bundle under its producing run, including optional + chunk-map/evidence-context auxiliaries. Mark its retention role explicitly so + cleanup does not shorten the old bundle's session-durable lifetime. It is not + a required runtime index, wholesale publish payload, or diagnostic API. +4. Update runtime artifact resolution, status/catalog views, analysis inputs, + and resume to use canonical products and Narratio evidence. Display qualified + fallback counts for fresh and reused results without inferring lane quality. +5. Forced extract passes cache refresh; ordinary executed extract respects the + selected native mode. Cache/debug-only changes do not stale completed products. + Preserve transitive invalidation and old completed-file availability rules. + +**Verify:** all ten maintained lanes, custom filename mapping, missing/unsafe lane, +partial failure, durable promotion, independent canonical resolution, ordinary +reuse, changed references, forced refresh, and visible fallback on reuse. + +## Stage 13 — Adopt Audita shared inputs and workspace destinations + +**Read:** roadmap Audita section and pinned runtime-input/migration contracts; +[Polish Internals](../internal/stage-polish.md). Entry points: Audita adapter, +polish stage, production composition, and adapter boundary tests. + +**Implement:** + +1. Supply the four verified individual shared envelopes through existing repeated + `--glossary-file` args, including empty collections. Keep identical saved + inputs in process/preflight; retain config/overlay/profile and credential flow. +2. Keep collection selection, instruction handling, and empty-task readiness + downstream. No local nonempty-glossary rule or generated Audita config. +3. Select staged transcript output, actual polish logs/report destination, and + run-local diagnostic/debug destination through supported Audita controls. + Retain default ordinary reporting and enable-only debug behavior. +4. Keep existing transcript/report acceptance and failure evidence behavior. + Change semantic evidence for new prepared bytes without version-only reruns. + +**Verify:** repeated envelopes, explicit empty replacement, inert shared instruction +extensions, process/preflight parity, default reporting, failed-run reports, +debug on/off destinations, and unchanged transcript validation and cancellation. + +## Stage 14 — Integrate native Notarius readiness with shared preflight + +**Read:** roadmap “Readiness and invocation lifecycle”; pinned Notarius preflight +and pipeline inspection contracts; [Preflight Internals](../internal/preflight.md). +Entry points: Notarius adapter, `internal/preflight`, `runner_preflight.go`, lazy +dependencies, and session validation. + +**Implement:** + +1. Add native Notarius pipeline preflight and pipeline inspection through the + adapter. Inspect required lane definitions because upstream readiness cannot + know Narratio's required-output map. Preserve incomplete inspection as such. +2. Select extraction readiness only when projected selected work requires it; + retain full Audita readiness and existing Scriptorium requirements discovery. + Run after selected prepare/reuse and before remaining selected processing. +3. Share execution config/overlay, refs, credentials, cache choice, and native + debug settings, but use diagnostic probe destinations outside actual attempt + views. Use a verified real execution transcript when available, otherwise the + known-good synthetic input; report the input actually checked. +4. Accept only successful process status plus a complete expected-pipeline + assessment with ready true. Preserve warnings, including nonfatal cache + warnings. Keep native failures, partial delivery, and optional debug locations. +5. Explicit session validation uses existing prepared inputs and its established + probe namespace. Planning remains subprocess-free; no preflight stage record, + cached readiness guarantee, second mandatory paid probe, profile list, or + additional automatic offline validation subprocess is introduced. + +**Verify:** target selection for bounded/reused/forced runs, preparation ordering, +missing lane/reference/provider, cache warnings, failed/incomplete reports, +synthetic limitations, lazy unrelated adapters, and probes leaving latest views +and ordinary stage records unchanged. Use controlled providers/subprocesses. + +## Stage 15 — Add latest-attempt log/debug views to the runner + +**Read:** roadmap “Latest attempts, debug, and retention”; workspace and runner +lifecycle docs. Entry points: run-local path owner, `runner_runtime.go`, execution +attempt transitions, and shared file operations. + +**Implement:** + +1. Add one narrow operation creating actual run-local stage log/debug directories + and advancing the two relative session symlinks at an actual attempt boundary. + Use existing confined operations; do not weaken general symlink rejection. +2. Advance both views on attempts that fail, with an empty debug directory when + capture is absent. Leave skipped/reused stage views untouched. Keep physical + run creation lazy; preserve cleanup-only behavior when no diagnostics need it. +3. Keep actual paths in manifest/publication references. Probes do not advance + actual stage views. Restore's independent diagnostic group is wired in Stage 19. +4. Handle managed-link replacement and unexpected path conflicts with existing + error/confinement semantics; do not delete arbitrary conflicting content. + +**Verify:** first/repeated attempt, failure, no capture, skip/reuse, different +producing runs per stage, safe relative targets, unexpected conflicts, and +directory-write failure. Check that a reused invocation creates no empty run. + +## Stage 16 — Route all producer diagnostics and remaining flat products + +**Read:** roadmap workspace and diagnostics sections; focused merge, normalize, +trim, render, and analyze internals. Entry points: `run_local.go`, those stages, +Seriatim/Scriptorium adapters, and render-debug helpers. + +**Implement:** + +1. Send process streams, invocation descriptions, Seriatim execution reports, and + ordinary failures to actual stage log directories. Remove reports from + canonical artifacts and unused root-level diagnostic destinations. +2. Route Scriptorium prepared render-debug products to trim/analyze run-local + debug paths, keeping per-artifact selection and distinguishable invocation + names. Preserve declared publication eligibility for existing render-debug + products; full Audita/Notarius capture remains local. +3. Finish flat analysis/family/session-bounds promotion and direct combined/raw + transcript placement. Generated files consumed later retain their product + location. Update paths in invocation metadata and per-artifact evidence. +4. Keep debug enablement from invalidating products and preserve result stdout + versus redacted diagnostic separation. Do not add a Seriatim debug mode. + +**Verify:** representative successful/failed stages, multiple artifact invocations, +flat bounds/analysis/family outputs, log/debug categorization, preserved captured +result bytes, and correct latest views. Reuse existing stage tests rather than +creating a parallel orchestration harness. + +## Stage 17 — Simplify audio acquisition to one retained session copy + +**Read:** roadmap “Audio acquisition”; current audio and restore contracts. +Entry points: `internal/audio`, prepare audio handling, artifact spool/cache +helpers, configuration, and manifest local-path bookkeeping. + +**Implement:** + +1. Refactor S3 materialization to validate/reuse canonical session audio or + download into a temporary destination and install verified bytes there. + Preserve current source-object identity/content checks and cancellation. +2. Remove persistent audio-cache identities/sidecars, retained spool copies, + cache/spool configuration and cleanup controls, and obsolete manifest fields. + Retain narrowly necessary download staging; no separate retained copy remains. +3. Keep local audio collision handling, membership, checksums, and per-speaker + continuation evidence. Restore uses the same materializer in Stage 19. +4. Do not delete recordings, historical old-session caches, or prepared audio + automatically as a side effect of removing the old configuration feature. + +**Verify:** current prepared reuse, changed/missing/corrupt content, interrupted +download/retry, local/S3 selection, and no retained cache/spool duplicates. Missing +prepared audio is fetched again; separate subprocess caches are never targeted. + +## Stage 18 — Publish new-format products and prepared inputs + +**Read:** roadmap durable lifecycle sections; [Publish Internals](../internal/stage-publish.md). +Entry points: publish source/output planning, transfer and commit code, +runtime catalog/evidence, and archive enumeration. + +**Implement:** + +1. Publish the supported manifest, standalone prepared inputs including five + glossaries and generated autocorrection, selected flat products, and declared + diagnostics using actual run paths. Relocate previous-session enumeration to + the new input subtree without changing immutable remote output destinations. +2. Remove distinguished index/receipt assumptions. Do not scan/upload Notarius + bundles wholesale, follow latest symlinks, upload reference snapshot duplicates, + or add full debug archives because capture was enabled. +3. Keep the existing five publish outcomes, remote locks, carried source identity, + confined regular-file streaming, immutable commit declaration, and pointer-last + commit boundary. Current canonical availability still requires manifest evidence. +4. Update metadata consumed by restore and cleanup; preserve exact successful + publication authorization rather than inferring it from directory contents. + +**Verify:** prepared-input and extraction declarations, actual diagnostic paths, +local flat/remote nested mapping, absent index, debug exclusion, carried locks, +optional/required missing products, upload failure, and unchanged pointer safety. + +## Stage 19 — Restore new-format sessions and previous-session inputs + +**Read:** roadmap state boundary and workspace; Restore Internals. Entry points: +restore discovery/plan/execute/report, shared current-state acquisition, +`internal/previouscache`, and prepared-input mapping. + +**Implement:** + +1. Finish v2 remote/local checks before destination mutation. Map selected commit + declarations to new canonical input/product/audio paths, installing the + verified manifest last. Preserve generation/checksum/size and conflict rules. +2. Restore all prepared input records including combined vocabulary and generated + rules. Keep producer-local resource paths from becoming destination authority; + rebase through existing confined mapping. Reference snapshots can be recreated + from verified prepared inputs rather than archived twice. +3. Use the simplified audio materializer. Map previous-session data beneath + `inputs/previous/` while preserving source-to-published-object resolution and + restore/prepare/status/validation agreement. +4. Write restore diagnostics under a run-local restore group and update + `logs/restore` for actual execution, including useful failure reports. Dry-run + planning creates no execution view. Preserve incomplete-restore markers, + shared session locking, retries, and current non-rollback behavior. + +**Verify:** publish/restore round trips into a new root, forced regular conflicts, +non-regular conflicts, unsupported old snapshots, partial-install retry, single +pointer-selected authority, audio restore without cache/spool, and previous-session +requirements. Restore never executes pipeline stages. + +## Stage 20 — Reconcile cleanup with diagnostic and bundle retention + +**Read:** roadmap retention and durable lifecycle; [Cleanup Internals](../internal/stage-cleanup.md). +Entry points: `cleanup_plan.go`, `cleanup.go`, app cleanup targets, and confined +file operations. + +**Implement:** + +1. Remove spool/audio-cache deletion policies and targets. Keep explicit prepared + audio/session deletion under existing manual authorization, not a replacement + automatic cleanup behavior. +2. Replace whole-run deletion where needed with role-aware run cleanup preserving + latest log/debug targets and original Notarius bundle evidence for its prior + session-durable lifetime. Older diagnostics remain eligible under existing run + cleanup once no protected view refers to them. Add no age/count retention policy. +3. Derive protections through the canonical managed-link/evidence owner, not + arbitrary filesystem traversal. Do not delete subprocess working State/Cache. +4. Preserve publish-evidence prerequisites, selected published-run identity, + idempotence, and cleanup failure/retry semantics. Resume treats retained + protected material as intentional, not as recreated work requiring endless + cleanup. Explicit entire-session deletion removes that session's views/evidence. + +**Verify:** latest targets from multiple runs, old eligible diagnostics, bundle +retention independent of latest views, no external cache deletion, disabled policy, +partial delete retry, cleanup-only invocation, and publication authorization. + +## Stage 21 — Reconcile reuse, planning, and inspection across the cutover + +**Read:** roadmap verification and existing semantic/invalidation contracts. +Entry points: prepare/extract/analyze resume, artifact hydration, session planning, +status/validation, configuration persistence, and command result reporting. + +**Implement:** + +1. Close remaining source-ID/path/evidence references left by earlier stages. + Remove retired private spell, receipt/index, wrapperless, and persistent + audio-cache branches and fixtures; add no old-format fallback. +2. Verify that supported sessions preserve per-speaker/per-artifact checkpoints, + aggregate decisions, explicit forced refresh, and fixed transitive invalidation. + Config source layout, credential rotation, debug/cache selection, or executable + version alone must not become blanket reasons to repeat work. +3. Check bounded plan/run parity, prerequisite guards, source availability, and + non-mutating planning. Keep old completed-file/failed-replacement availability + consistent with the owning stage's current behavior; do not normalize all + stages to a newly invented availability policy. +4. Keep user-visible fallback/readiness qualifications and native failure causes + available through fresh and reused command reports, without a new error taxonomy. + +**Verify:** assembled interrupted/retried transcript and artifact workflows, +force-extract versus analyze-only force, changed/unchanged vocabulary, bounded +runs with unrelated adapters absent, restored reuse, and no unexpected workspace +creation on fully reused or plan-only invocations. + +## Stage 22 — Prove the three-file workflow and real consumer boundaries + +**Read:** roadmap verification table and compatibility guidance. Entry points: +`internal/app/compatibility_test.go`, assembled workflow fixtures, existing +Notarius integration tests, and the catalog compatibility script. + +**Implement:** + +1. Copy the planning bundle into maintained examples, adjust remaining full and + production/testing examples, and use synthetic shared catalog data pinned to + the Stage 7 commit. Keep planning fixtures clearly labeled until replacement. +2. Extend existing offline assembled workflows to onboard with only the three + campaign documents, initialize a session, prepare selected vocabularies and + rules, execute controlled consumers, and exercise reuse/failure recovery. + Cover omitted/supplied inline sections and installation/campaign templates. +3. Refresh opt-in real Audita v4.3.0 checks and Notarius v0.10.0 checks using a + controlled local provider. Cover shared inputs, processing/preflight parity, + the complete ten-lane Notarius pipeline, cache reuse/refresh, and flat promotion. + Record executable revisions, catalog commit, commands, and results here. +4. Retarget the catalog's existing compatibility script to those checks. Keep + explicit binary/repository selection and opt-in gates. Default tests must + skip those external requirements and use repository-local fixtures. + +**Verify:** run the offline workflow tests and available controlled real-binary +checks. If an executable cannot be obtained, record the precise missing evidence; +do not replace it with a paid-provider dependency or claim tested interoperability +from schema/unit results. Complete that evidence before claiming the sprint's +tested consumer baselines. No source release is needed to exercise local binaries. + +## Stage 23 — Finish canonical documentation and end-to-end verification + +**Read:** roadmap “Delivery, documentation, and verification”; documentation, +architecture, testing, and OSS policies; Development validation commands. + +**Implement:** + +1. Publish the operator setup/campaign/session responsibilities and complete + three-file onboarding workflow in Operations, linking field definitions in + Configuration and shared contracts upstream. Document required/optional + fields, defaults, clearing/override semantics, and source-relative references. +2. Update CLI examples, party/shared integration references, adapter and + preparation/preflight/workspace/artifact/manifest internals, troubleshooting, + and maintained example navigation. Document flat products, latest views, + diagnostic retention, separately configured subprocess caches, and the state + cutover/regeneration procedure. Remove obsolete cache/spool/index assumptions. +3. Align architecture policy with the accepted ADR ownership/layout and the + distinction between extensible shared documents and strict operational + settings. Preserve API-key protection and ordinary group sharing. Current + upstream APIs remain linked, not re-documented or translated locally. +4. Complete exact schema/catalog/dependency provenance and applicable attribution. + Keep catalog CC0 and Narratio's existing licensing scopes. Release migration + guidance can be written without creating a release note/tag or running publish. +5. Audit the roadmap verification table against the actual implementation and + Stage 22 evidence. Record final results and any genuinely unfinished work + here. Do not mark the sprint complete with unresolved required outcomes. + +**Verify:** prepare dependencies separately, then use the maintained Go 1.27.4 +toolchain for `go test ./...`, `go test -race ./...`, `go vet ./...`, and +`go build ./...`. Run declared Linux amd64/arm64 and best-effort darwin arm64 +cross-builds using the repository's existing target selections; native macOS is +not required. Catalog checks run independently in its module. Validate local +documentation links, maintained examples, formatting/diffs, recorded real-binary +evidence, and a clean scoped Git status in each changed repository. Reuse passing +checks for unchanged final content rather than duplicating release validation. + +## Open Questions + +None requiring a product decision. The roadmap settles campaign/session fields, +roster policy, glossary bindings, state compatibility, and workspace behavior. +This plan selects the state marker, source/file identities, owner boundaries, and +work ordering. Record stage-local implementation details and evidence without +reopening those decisions or introducing additional policy. diff --git a/docs/roadmap/pipeline.md b/docs/roadmap/pipeline.md index 05885a2..5773269 100644 --- a/docs/roadmap/pipeline.md +++ b/docs/roadmap/pipeline.md @@ -5,14 +5,14 @@ This is the consolidated feature roadmap for one end-to-end Narratio cutover. It includes shared domain inputs, the campaign operator contract, reference catalog adoption, Audita v4.3.0, Notarius v0.10.0, and workspace reorganization. -It defines the final behavior; a subsequent implementation plan will assign -code changes and verification to stages. The campaign/session interface is -settled, and the roadmap is ready for implementation planning. +It defines the final behavior and settled campaign/session interface. The +[implementation plan](implementation.md) assigns code changes and verification +to ordered stages. -Implement the final state in one sprint. Intermediate commits need not compile -or support mixed old/new formats. Do not introduce compatibility aliases, -legacy readers, automatic conversions, version-negotiated adapters, or duplicate -operator-authored vocabulary. Publication remains a separately authorized action. +The scope is one coordinated final-state cutover. Do not introduce compatibility +aliases, legacy readers, automatic conversions, version-negotiated adapters, or +duplicate operator-authored vocabulary. Publication remains a separately +authorized action. This document supersedes Narratio's separate schema, Audita, Notarius, and workspace roadmaps, the completed schema-repository implementation plan, and @@ -553,18 +553,12 @@ cleanup targets. ## Delivery, documentation, and verification -The implementation plan should sequence these outcomes within the single sprint: - -1. Define the supported-state boundary and establish canonical - shared acquisition and workspace paths. -2. Migrate the catalog and maintained campaign examples; prepare the roster, - autocorrection input, four glossaries, combined projection, and references. -3. Cut both subprocess adapters and shared readiness over to their released - interfaces; remove private spell/receipt/index machinery. -4. Complete flat promotion, latest diagnostics, audio simplification, and all - evidence/reuse/publication/restore/cleanup consumers of the new paths. -5. Verify the complete operator workflow, document migration, and finish the - supported final state. No intermediate release or compatibility layer is needed. +The final state includes shared acquisition, the migrated catalog and campaign +examples, native consumer execution/readiness, and consistent workspace lifecycle +behavior. Prepared inputs, product promotion, reuse, publication, restore, and +cleanup must agree with that state. Implementation sequencing and stage-specific +verification belong in [implementation.md](implementation.md). No intermediate +release or compatibility layer is part of the feature. Keep existing application/adapter boundaries and reuse production checking paths. Replace obsolete tests and fixtures rather than preserving retired protocols.