Files
narratio/docs/roadmap/implementation.md

712 lines
40 KiB
Markdown

# Audita v4.2 and shared glossary implementation plan
## Scope and execution
Implement [the feature roadmap](audita.md) in the numbered order below. The
audience is a Luna coding agent handling one stage per implementation prompt.
Every stage starts pending. Record completed work and its verification when a
stage is finished; distinguish implemented work from checks awaiting a later
stage. Follow `AGENTS.md`, [development guidance](../development.md), and its
applicable policy-reading guide for every stage.
This is one end-to-end sprint. Intermediate changes may temporarily fail to
compile or leave dependent tests awaiting the cutover. Make the direct changes
needed for the final design; temporary compatibility readers, dual source IDs,
module translators, and provisional configuration formats are unnecessary.
Commit focused completed units under the agent policy. Report deferred checks
truthfully, and make the final repository-wide checks pass before completion.
Planning baseline: Narratio `4f68fb2`. Audita v4.2.0 is
`973b24e46618dc785751fa7c803e7c16c900353f`; the reviewed D&D recipes are
`6d5e66dcfca4bb5971a8423332a19ce884b846c0`. Canonical upstream links and the
full intent belong in the feature roadmap. Inspect current sources before
editing: the file names below identify owners, not immutable private APIs.
Prefer the codebase graph for code discovery.
The sprint covers Narratio and the new local `../narratio-reference-catalog`
data repository. That sibling directory was absent at planning time. Stage 1
establishes its schema and minimal bundle. Commit each repository independently;
record the catalog commit used by Narratio. Creating a remote repository,
pushing, tagging, releasing, updating Audita code, and adopting Notarius v0.9.0
are separate actions requiring authorization. Default tests must work without
any sibling checkout, installed downstream executable, real credentials, or
external provider.
The catalog's original vocabulary, schema, examples, and documentation use
CC0-1.0, as selected by the author. Preserve applicable third-party terms and
attribution for incorporated material. Narratio's application license remains
unchanged. The roadmap's design and licensing decisions are settled.
## Implementation boundaries
- ConfigKit owns source composition, imports, inheritance, presence, and native
inspection. Use its supported definitions, resolution, and layered inputs.
Narratio consumes completed results and derives separate glossary objects;
it does not replace effective configuration with those objects.
- Use a small `internal/glossary` owner for the shared glossary model, native
vocabulary acquisition, schema validation, deterministic projections, and
serialization. Keep selection/defaulting and source-context adaptation in
`internal/config`; keep subprocess flags in the Audita adapter. No general
projection framework or second composition implementation is needed.
- Preserve native entry extensions and collection instructions. Party projection
uses stable character IDs, character names, aliases, and category `person`;
order entries by stable character ID. Player/class enrichment is not required.
Preserve supported field-presence distinctions during projection/serialization;
do not erase an explicitly empty instruction through an `omitempty` shortcut.
- Prepare the four named documents and identities in the roadmap. Use distinct
manifest input kinds `glossary_party`, `glossary_campaign`, `glossary_setting`,
and `glossary_spells`, through the existing prepared-input descriptor mechanism.
Their content digests and existing input records establish authority.
- All four collections are supplied to Audita, even when empty. Thus Narratio
owns those four runtime entry lists: an empty list replaces a same-named
Audita-configured list. Other collections and omitted instruction fields
retain native downstream composition. Do not silently omit an empty role to
preserve privately configured entries.
- Preserve richer party/player inputs and the existing Notarius spell-overlay
input. Retire only the monolithic glossary source and its old prepared path.
Update authored bindings explicitly; never redirect an old source ID.
- Preflight follows completed/reused preparation and precedes selected
processing. It remains an invocation check. Retain Audita's provider checks,
use a synthetic transcript, and report that scope accurately. Scriptorium
keeps its current target-selection and error/warning policy at the new boundary.
- Preserve canonical stage order, output validation/promotion, ordinary force
and invalidation, credential forwarding/redaction, publication commitment,
workspace modes, and restore guards. Apply the pending workspace roadmap only
to its stated coordination points; this sprint does not implement that entire
independent feature.
## Stage 1. Establish the catalog format and minimal data bundle
Status: Complete
Catalog revision: `ecad94a5a53f87847b1fd81fd042eee9c8d3ea08`. Validated
the schema and valid/invalid examples with JSON Schema Draft 2020-12; checked
catalog and fragment paths and reviewed the resolved shapes against Audita
v4.2.0. Executable consumer compatibility remains for Stage 17.
Read roadmap sections “Canonical glossary format” and “Reference Catalog
Distribution and Development,” and the OSS/documentation policies.
In the local catalog repository, create the format contract, `catalog.yml`,
`schemas/glossary-v1.schema.json`, small valid/invalid examples, and one setting
and system entry demonstrating native relative imports. Use a deliberately small
representative vocabulary, not an encyclopedia or an unreviewed third-party dump.
Describe content sources and attribution. Add the catalog's CC0-1.0 license
documentation with its original-material scope clearly identified.
Define a JSON Schema with reusable entry, partial-authoring collection, complete
collection, and named-document definitions. Base the fields on Audita v4.2's
native glossary model. Keep extension fields on entries; allow general collection
names. Complete collections require an `entries` list, including `[]`.
Partial authoring definitions allow instruction-only contributions. Do not add
nonempty-collection, global entry-ID uniqueness, or Narratio-role restrictions.
Keep format identity in the schema and contract, outside the glossary root.
The catalog fragment maps IDs to source-relative entry files under
`reference_catalog.settings` and `.systems`. Document local installation and
native imports, independently selected vocabulary revisions, and compatibility
targets. Give minimal entries truthful names/IDs; do not label synthetic content
as a complete Forgotten Realms or 5e reference.
Check examples against the schema and Audita's documented shape. Commit this
unit locally and record its full revision for Stage 2. Executable consumer
compatibility checking is completed in Stage 17.
## Stage 2. Add the shared glossary model and pinned schema validation
Status: Complete
Embedded the verbatim schema from catalog revision
`ecad94a5a53f87847b1fd81fd042eee9c8d3ea08`, added offline JSON Schema
validation and collection-scoped ID checks, and recorded dependency notices.
Verified with `go test ./internal/glossary ./internal/doccheck` and a bytewise
schema comparison. Integration with acquisition and preparation follows in
later stages.
Read roadmap “Canonical glossary format” and Audita's native input contract.
Create `internal/glossary` with native collection/entry representations retaining
extensions, and an embedded, verbatim copy of the catalog's versioned schema.
Record the catalog revision and maintain schema ownership upstream. Use
`github.com/santhosh-tekuri/jsonschema/v6` v6.0.3, the engine already used by
Audita, for JSON Schema evaluation; ConfigKit remains the YAML/configuration
loader. Add the dependency and OSS notices using the selected module's actual
license and commit. Review notices for the incorporated schema as well.
Compile the pinned schema locally; runtime validation must not fetch a schema.
Validate resolved decoded data and complete prepared documents, preserving the
native types supported by the loader. Keep partial and complete validation
entry points distinct. Preserve useful collection/field context in errors.
Apply semantic validation for within-collection ID uniqueness where
schema evaluation alone cannot express it. Avoid unrelated spelling restrictions.
Test empty complete collections, missing required structure, instruction-only
partial input, ordinary optional fields, retained entry extensions, and duplicate
IDs within one collection. Identical IDs in different collections remain valid.
Add synthetic local fixtures so tests do not read the catalog checkout.
## Stage 3. Add catalog selections to native pipeline acquisition
Status: Complete
Pipeline acquisition preserves reference-catalog mappings, resolves imported
paths from their field origins, and provides selection with unknown-ID errors.
Verified with `go test ./internal/config ./internal/doccheck`, including an
imported catalog and an operator extension. Campaign/session selection fields
and their use of these lookups are introduced in Stage 4.
Read `docs/internal/configuration.md` and the roadmap's authoring field table.
Update `internal/config/config.go`, pipeline definitions/defaults/validation,
resource-base adaptation, and projections/rendering as applicable.
Add `reference_catalog.settings` and `.systems` mappings to the pipeline model.
Resolve each selected catalog path from its effective field's native origin and
source context, including paths contributed by an imported catalog fragment.
Reuse `resource_base.go` and ConfigKit metadata. Keep catalog data and selections
visible in actual native inspection rather than substituting a derived view.
Catalog absence is valid. Validate selected IDs against the effective catalog;
an explicitly selected unknown ID is an error. Do not require unused catalog
entries to be installed/readable or inspect unselected vocabulary files.
Use a real ConfigKit imported-fragment fixture to test source-relative paths,
operator catalog extensions through ordinary native configuration, missing IDs,
and native inspection/digest behavior. Equivalent layouts should not gain an
extra all-configuration cache invalidation key.
## Stage 4. Implement campaign/session glossary authoring and field selection
Status: Complete
Campaign and session acquisition now retain independent glossary selections,
inline contributions, nullable/empty overrides, source-relative file paths,
and authored snapshot values. Unknown selected catalog IDs fail during combined
acquisition. Verified focused configuration, stage, application and documentation
tests, including imported defaults, replacement, nulls, and rendering. Vocabulary
composition and the preparation cutover remain in subsequent stages.
Start with `document_configkit.go`, `config.go`, `document_render.go`,
`resource_base.go`, and their session-default/presence tests. Implement the
roadmap's `inputs.setting`, `.system`, `.glossary_file`, and inline `.glossary`.
The file becomes optional and uses the new named-collection format. Keep the
canonical party roster required; retain existing spell-overlay fields.
Use ConfigKit presence/default callbacks to inherit each omitted campaign field
independently. A supplied session inline collection replaces the campaign's
inline selection as a whole; its file selection changes only that field.
Perform later file-plus-inline composition separately in Stage 5. Record truthful
default provenance. Resolve selected file paths from their defining sources.
For optional setting/system/file selectors, null or empty effective selections
mean no selected source, without falling back to campaign values. For inline
data, explicit null removes that contribution; an empty collection mapping is
an explicit contribution. Validate incompatible value types normally. Preserve
native list/control behavior inside the glossary load rather than interpreting
`entries: []` as a custom clear operation.
Render authored/effective campaign and session snapshots with their selections
and inline values intact. Do not replace inline authoring data with composed
vocabulary in native results. Test the roadmap's two independent session override
examples, omitted versus supplied selections, partial inline data, and imported
source bases. Update current tests that require a monolithic glossary file.
## Stage 5. Resolve native vocabulary and derive the four domain collections
Status: Complete
Added a shared native ConfigKit resolution path and deterministic, validated
party, campaign, setting and spells documents. Focused glossary and configuration
tests cover imports, inheritance, whole-record upsert, native replacement,
independent session overrides, missing sources, and unchanged native values.
`go test ./internal/glossary ./internal/config ./internal/doccheck` passed.
Preparation and resume integration are performed in Stages 7 and 8.
Read roadmap “Glossary authoring and precedence” in full. Implement one production
resolution path shared by preparation and prepare-resume comparison. Configuration
acquisition supplies finalized selections/contexts; vocabulary resolution returns
separate domain values and serialized standalone named-collection documents.
Use native ConfigKit layered loading for the selected campaign file below the
selected inline contribution mounted at `campaign`. Enable imports and register
entry identity by `id` using the supported sequence API, matching Audita. Resolve
complete external files before selecting the requested collection, so sibling
inheritance works. The setting/system files supply `setting`/`spells` respectively.
Do not reduce the file to a hand-parsed YAML subtree before native resolution.
Preserve whole-record upsert, native lower-tier explicit replacement policy,
instructions, extensions, and errors. Validate the completed selected collection
after the file/inline contributions compose; incomplete individual contributions
are valid inputs to that composition. Do not normalize a native composition
error into an empty collection. Missing selected files or required named roles
fail with selection/source context. Omitted sources produce complete empty roles.
Derive `party` from the resolved canonical roster and serialize all four documents
deterministically. Reuse these functions rather than independently composing
vocabulary for preflight, validation, and stage execution. Basic acquisition
selects resources; validation against prepared inputs must not resolve live
files into candidate glossary projections.
Test the roadmap's Silver Watch/Old Watch and native `replace` clearing examples
through the actual pipeline/campaign/session acquisition path, including imported
catalog paths. Also cover retained instructions/extensions, sibling inheritance,
omitted roles, invalid selected sources, and nonmutation of native configuration.
## Stage 6. Register shared glossary identities and canonical paths
Status: Complete
Registered the four nested prepared-input descriptors and retired the old
source, with migration guidance for both consumer bindings. Focused artifact
policy, prepared-input, and configuration tests cover all four identities,
checksums, sizes, tampering and missing files. Existing preparation still uses
the retired source until Stage 7, and maintained consumer fixtures are updated
in Stage 16; related end-to-end tests are deferred until those cutovers.
Read roadmap “Shared input identities and cutover,” `artifactpolicy/policy.go`,
`artifacts/prepared_input.go`, and the existing prepared-input tests.
Add the four exact source IDs and paths from the roadmap to the shared prepared
descriptor and path owners. Extend descriptor handling to support nested
`inputs/glossaries/` destinations without assuming every filename is a basename.
Use those same descriptors for resolution, artifact classification, supported
source validation, and configured Scriptorium/Notarius bindings.
Remove the old `narratio.input.glossary` registration and resolution paths. Do not
alias it to `campaign`, infer new roles from old bytes, or change `party`,
`players`, and `spell_catalog` identities. A stale old file can remain incidental
under existing lifecycle behavior; its presence is never new input authority.
Test all four descriptors and resolution against manifest checksums/sizes,
missing/tampered files, and nested path handling under existing guards. Verify
old configured source references fail with actionable migration guidance.
## Stage 7. Materialize shared collections in prepare
Status: Complete
Preparation resolves vocabulary before audio work and writes all four named
collections with manifest checksums, sizes, and provenance. Focused prepare,
artifact, and manifest tests verify nested workspace modes, empty roles, sorted
records, failure without manifest replacement, and existing audio/party inputs.
Resume comparison and downstream consumer cutover remain in later stages.
Start with `stage/prepare.go`, `prepare_party.go`, and configuration rendering.
Call Stage 5's resolver as part of ordinary preparation and fail on invalid
selected vocabulary before downstream processing. Materialize four standalone
documents using shared paths and ordinary workspace file operations/modes.
Write all four, including empty collections, and record their distinct manifest
inputs with digest, size, and non-secret provenance. Use the existing manifest
input model; this feature does not need another progress manifest.
Remove the monolithic glossary copy/manifest input from the current preparation
set. Preserve party/player generation, speakers/autocorrect, optional structured
spell overlay, previous-session inputs, and audio behavior. Resolve vocabulary
before expensive preparation work where practical without moving native
downstream preflight ahead of completed preparation.
Verify deterministic prepared bytes and manifest ordering, nested workspace
modes, empty roles, failure without false preparation success, and retention of
unrelated stable input contracts. Leave stage transitions with the existing
runner, not the glossary helper.
## Stage 8. Make preparation reuse and invalidation glossary-aware
Status: Complete
Versioned prepare semantic evidence and compare the same resolved glossary
bytes used by preparation, requiring verified canonical records for all four
roles. Focused resume tests pass for imported changes, equivalent relocation,
selection changes, empty roles, tampering, missing files, and old evidence.
Existing bounded consumer resolution already reports prepare guidance. Tests
using retired synthetic glossary fixtures await the Stage 16 fixture cutover.
Read `prepare_resume.go`, `semantic_contracts_initial.go`, and their focused
tests. Extend the prepare semantic contract and durable-input checks for the
new selection/projection contract. Compare current resolved vocabulary using
the same resolver and serializer as Stage 7; include imported effective content,
inline overrides, catalog selections, and the party projection.
Changes to effective prepared vocabulary invalidate through existing prepare
rules. Equivalent source relocation/formatting with equivalent effective bytes
does not gain a new path-only invalidation requirement. Unchanged prepared
inputs remain reusable. An installed catalog update during processing never
reopens or replaces the invocation's prepared vocabulary.
Require new input records when prepare is selected or reuse-checked. Prior
monolithic records cannot satisfy them; use normal reprepare behavior and a
versioned semantic contract rather than an old-session converter. A bounded
run excluding prepare verifies the prepared sources it needs and reports
prepare guidance when they are unavailable.
Test an imported vocabulary change, equivalent layout relocation, selected ID
change, empty-role preparation, missing/corrupt prepared files, and old evidence.
Retain existing per-speaker and per-artifact resume behavior.
## Stage 9. Carry the new prepared inputs through publish and restore
Status: Complete
Publish archives verified prepared glossary bytes using shared descriptors;
restore maps committed objects back to their nested canonical paths. Focused
publish and restore tests pass, including all four documents, empty roles,
changed local bytes, restored manifest evidence, and existing restore guards.
Read `stage/publish_sources.go`, prepared publication tests, artifact current
state mapping, and app restore planning/execution tests. Register the four input
kinds and nested paths wherever publication, remote descriptors, status, and
restore enumerate prepared inputs. Prefer the shared descriptors over four
new independent path switches.
Publish the actual verified prepared documents; do not reopen campaign/catalog
sources during upload. Restore the committed documents and manifest evidence
at their canonical nested paths, retaining manifest-last installation and all
current path/conflict/lock checks. New vocabulary inputs are neither run-local
debug evidence nor subprocess cache. Retire the old glossary mapping in current
output generation without introducing a compatibility reader for it.
Test a prepared-input publish/restore round trip containing all four documents,
empty roles, changed local bytes, and unchanged party/player/spell-overlay
behavior. Preserve the existing immutable commit/pointer ordering and force
conflict policy; no new remote protocol is needed.
## Stage 10. Cut the Audita processing adapter over to v4.2
Status: Complete
The adapter now passes ordered native glossary files, independent destinations,
and enable-only debug, with a shared argument builder and updated safe invocation
records. Removed module configuration and plumbing. Focused adapter, configuration,
and semantic tests pass; all packages compile. Polish still supplies its former
input path until Stage 11; examples and wider fixture updates remain scheduled.
Read Audita v4.2 CLI/subprocess/output contracts, then `adapters/audita` and
its current subprocess tests. Replace the single legacy glossary request with
an ordered native glossary-file request. Pass one argument pair per file.
Continue using `process` and explicit output. Keep main/overlay/profile,
description, output-schema, timeout, credential, and cancellation behavior.
Remove `--modules` and its configuration, validation, projection, request, and
composition plumbing. Add optional `pipeline.audita.debug`: true requests debug;
false/omission adds no debug override. Add independent report/work-directory
request destinations. Normal production omits `--debug` and `--reporting=false`.
Selecting the work directory alone must not enable capture.
Use a shared processing-settings argument builder suitable for preflight in
Stage 12. Keep native CLI semantics; no version probe, generated Audita entry
configuration, legacy flag fallback, or module-list translator is needed.
Update the safe generated invocation record to the actual new request contract.
Test exact argument boundaries/order for runtime files, supported selectors,
independent destinations, debug omission/enablement, and removed fields. Retain
shared sensitive credential forwarding/redaction and failure evidence coverage.
## Stage 11. Integrate prepared glossaries and diagnostics into polish
Status: Complete
Polish now resolves the four verified prepared inputs in role order and uses
run-local log and debug destinations via a shared request builder. Versioned
semantic and glossary evidence prevents reuse after input changes. Focused
polish and adapter tests cover missing and changed inputs, diagnostic paths,
nonzero outcomes, output promotion, and resume. Preflight uses the shared
builder in subsequent stages.
Read `stage/polish.go`, `run_local.go`, and
`semantic_contracts_refinement.go`. Resolve all four glossary inputs through
the shared prepared-input resolver. Use a stable role order: party, campaign,
setting, spells. Resolve the base transcript through its existing output evidence.
Stage logic receives domain paths and settings; the adapter owns CLI construction.
Use a shared polish invocation/context builder for both execution and preflight:
execution supplies the real transcript, preflight later substitutes its fixture.
Supply `runs/<run_id>/polish/logs/` for reports, captured streams, and invocation
records, and `runs/<run_id>/polish/debug/` as the debug root. Create required
parents through the shared workspace owner. Do not add latest-attempt links here;
that work remains in the workspace roadmap.
Discover only the existing fixed optional report names in the selected report
directory. Validate reported paths there rather than beside the staged transcript.
Keep bounds and original failure causes. Nonzero exit never promotes transcript
bytes; recoverable model errors on exit zero remain accepted. Early failures may
have no reports. Keep the existing `segments` output validation contract and
explicit output-schema choice where needed.
Version affected polish semantic evidence; remove modules and include actual
prepared input identity through the existing input-evidence mechanism. Debug,
credential rotation, and destination-only changes remain operational. Test
missing/changed vocabulary, nonzero-with-output, optional reports, independent
paths, successful promotion, and force/reuse semantics.
## Stage 12. Add native Audita preflight and the embedded transcript asset
Status: Complete
Added native preflight with the shared processing arguments, provider smoke
checks enabled, an embedded synthetic multi-speaker transcript, and isolated
temporary diagnostics. Focused adapter/subprocess tests cover settings,
credentials, redaction, failure, cancellation, and cleanup; all packages
compile. Checker and runner integration follows in subsequent stages.
Extend the Audita adapter with a narrow preflight operation using the same
processing settings/argument builder as Stage 10. Use `preflight` and retain
native default smoke checks; do not pass `--smoke=false` in production orchestration.
Return native exit outcome and safe diagnostic context without parsing its
human-readable progress or inventing a readiness schema. Reuse supervision,
timeouts, cancellation, and credential redaction. Preflight does not discover
or promote processing outputs or expect ordinary report files.
Keep preflight's own captured streams and invocation diagnostics in its temporary
invocation context, separate from the intended processing/report/debug paths
being probed. Preserve useful bounded diagnostic details in its returned error
before temporary cleanup. Do not clear or overwrite earlier stage diagnostics.
Embed a small representative synthetic transcript in the Narratio-owned
integration boundary, using `go:embed`. Give it multiple valid timed utterances
and speakers, and materialize it in invocation-scoped temporary storage. Remove
temporary material on every outcome. It is not a prepared session input or a
transcript artifact. It need not satisfy every possible chunk/section setting;
native fixture-dependent failures remain errors.
Test shared flags/destinations/vocabulary/credentials between preflight and
processing, absence of any smoke-disabling override, exit/error propagation,
temporary cleanup, and cancellation. Use the subprocess seam, not paid providers.
## Stage 13. Extend the shared preflight checker and target model
Status: Complete
Added a narrow Audita preflight contract, sequential downstream checking,
and polish target selection based on projected execution or validation.
Focused checker and selection tests cover reuse, empty targets, warnings,
Audita failures, and cancellation. Runner and validation wiring follows in
Stages 14 and 15.
Read `internal/preflight`, `app/preflight_targets.go`, and current Scriptorium
finding-policy tests. Add a narrow Audita check contract and a selected polish
target alongside the existing Scriptorium targets. Keep tool-specific invocation
in adapters and tool-specific findings interpretable through their own contracts.
A sequential composition of the existing checks is sufficient; no plugin registry
or generic workflow engine is required.
Use verified prepared vocabulary and Stage 11's invocation/context construction.
Execution selects Audita only when polish is projected to run. Validation selects
it when polish is enabled, independently of completed output reuse. Existing
Scriptorium target closure, required/optional binding treatment, and warning/error
policy remain intact. Empty target sets invoke no tool. Native Audita failure is
an error with its original diagnostic explanation; cancellation stops checks.
Test selected/unselected polish, reusable work, Scriptorium warnings versus errors,
Audita failure, and cancellation at the shared checker/selection boundaries.
Do not duplicate adapter command tests or parse Audita's stderr into findings.
## Stage 14. Move execution preflight after preparation
Status: Complete
Runner preflight now reprojects remaining work after preparation and checks
only selected downstream targets before stage attempts or forced invalidation.
Adapter composition is lazy and reuses invocation-owned runners. Focused
runner tests pass for preparation success/failure/reuse, preparation-induced
invalidation, preflight failure and retry, forced authority preservation,
prepare-only and fully reused invocations; cleanup and bounded checks also pass.
Start with `app/runner.go`, `runner_preflight.go`, `runner_composition.go`,
`runner_stage_execution.go`, `plan.go`, and the current runner/preflight tests.
Remove the old unconditional pre-stage hook. Run ordinary selected `prepare`
through its existing lifecycle, including reuse, durable saves, and invalidation.
Then run downstream preflight once before the first selected post-prepare stage.
For a bounded range omitting prepare, check at that same logical boundary using
existing prepared inputs, without inserting prepare into the range.
Reproject remaining selected work against the post-preparation manifest. Do not
reuse a projection made before preparation could invalidate polish or analysis.
Include force/range/artifact selection exactly as the normal work planner does.
Only relevant downstream targets initialize their adapters, and invocation-owned
instances can be reused by execution. A prepare-only invocation has no remaining
processing target and makes no downstream calls. Fully reused and cleanup-only
invocations also avoid irrelevant preflight and empty run directories.
A failed check stops before subsequent stage attempts or their force invalidation.
Retain completed preparation and any invalidation it already caused. Finalize
the invocation/summary with prepare completed or reused and processing not
attempted; do not mark polish failed or succeeded when it never ran. Reuse the
existing session lock and finalization machinery.
Test preparation success/reuse/failure, preparation-induced invalidation exposing
new targets, bounded runs, prepare-only/full reuse/cleanup-only, force after
failure, and retry reusing completed preparation. `session plan` remains
subprocess-free; neither preflight nor fixture storage advances latest views.
## Stage 15. Use the shared downstream checks in session validation
Status: Complete
Validation checks existing prepared glossary evidence using the shared
request builder and downstream checker, with a dedicated `.validation` probe
namespace and explicit synthetic/provider-side-effect findings. Focused tests
cover missing evidence, valid reuse, unchanged manifest and source independence,
provider and destination failures, cancellation, and Scriptorium findings.
Read `app/session_inspection_command.go`, `operator_inspection.go`, invocation
acquisition, and their validation tests. Retain basic configuration findings.
Resolve the existing local manifest and prepared vocabulary required by enabled
polish through the same resolver/checker used for execution. Missing or invalid
evidence produces actionable prepare guidance. Do not run prepare, fetch audio,
resolve candidate live vocabulary, or manufacture manifest authority.
Use the shared embedded transcript and actual selected Audita settings. Validation
has no execution run: probe intended polish destinations beneath the session's
workspace root in `runs/.validation/polish/`, with the normal transcript filename
under `outputs/`, and separate `logs/` and `debug/` roots. This is a validation
probe namespace, never a run identity, processing attempt, report, or latest view.
Use the workspace path owner and existing directory modes. Remove temporary
probe files through native preflight; empty parent directories may remain. Keep
these probe paths out of publication/restore and stage authority. Real execution
still checks its actual run destinations.
Native preflight performs provider calls and temporary destination probes;
report these side effects and synthetic-transcript scope. Preserve current
validation result/exit presentation and safe errors. No new durable validation
manifest or session lock policy is required merely for this check.
Test missing prepared inputs, valid prepared reuse, unchanged source bytes and
manifest, native destination failure, provider failure, cancellation, and existing
Scriptorium findings. Verify no audio transfer, processing artifact, run ID,
stage transition, or latest-view rotation occurs.
## Stage 16. Cut maintained consumer bindings and examples over explicitly
Status: Complete
Updated maintained bindings, native glossary examples, and offline test
fixtures, including a synthetic catalog with relative imports and campaign
authoring variants. Verified example acquisition and glossary resolution,
extract/analyze/preflight coverage, documentation links, and `go test ./...`.
Real catalog and Audita compatibility checks remain for Stage 17.
Update maintained pipelines, campaign/session examples, and synthetic fixtures
to the new fields and source IDs. Replace the old Notarius text `glossary`
binding with `narratio.input.glossary.campaign`. Keep its binding name and current
Notarius v0.8.1 reference mechanism; preserve party/player/spell-overlay bindings.
Change Scriptorium source IDs explicitly while preserving prompt binding names.
Update prompt input-shape examples where the old glossary format was assumed.
Remove `pipeline.audita.modules`; show pipeline ordering in Audita-owned
configuration or link to the independently selected external recipes. Include
one minimal checked-in synthetic reference catalog, an import-relative example,
inline-only/file-only/combined campaign authoring, and omitted optional roles.
Production installation examples point to an operator-installed catalog location,
not a developer sibling directory. Do not bundle a full production vocabulary.
Retarget tests that protected retired glossary behavior to the deliberate new
contract. Remove obsolete expectations rather than keeping old code for fixtures.
Run example loading/validation and targeted extract/analyze/preflight tests.
## Stage 17. Check the real catalog and Audita boundaries offline
Status: Complete
Added opt-in checks using explicit catalog and Audita paths, and corrected
native source contexts for sibling vocabulary imports. The real catalog
bundle and pinned schema at `ecad94a5a53f87847b1fd81fd042eee9c8d3ea08`
passed alongside Audita `973b24e46618dc785751fa7c803e7c16c900353f`
using controlled loopback provider responses, including a negative result.
The catalog's offline check script is committed at
`ff26b24172ff5efddbcf666c5179268ea1372b01`; the checks also pass there.
Focused glossary and configuration tests passed with the external variables
unset. No paid provider calls were used.
Add opt-in Narratio compatibility tests accepting absolute paths through
`NARRATIO_TEST_REFERENCE_CATALOG_DIR` and `NARRATIO_TEST_AUDITA_BINARY`. Unset
variables skip those external checks; do not search PATH or sibling directories.
The ordinary suite continues to use local synthetic fixtures and doubles.
The catalog test loads its actual fragment through Narratio's normal pipeline,
campaign, and session acquisition, then the production glossary resolver and
preparation path. Validate the four prepared documents against the pinned schema.
Check the imported paths and combined file/inline fixture, not just isolated
ConfigKit layering primitives. Compare the schema copy with its recorded catalog
revision when the checkout is that revision; format-compatible newer vocabulary
need not share the same vocabulary release number.
With a supplied Audita v4.2 executable, exercise native inspection and a full
preflight using controlled local provider responses, synthetic inputs, and
temporary destinations. Keep smoke enabled to test production behavior while
avoiding real credentials/services. Include one fixture-dependent failure.
Check that the prepared named collections and instructions reach the native
configuration, and preserve exit classifications.
Add a short catalog-owned offline check script accepting explicit Narratio
checkout and Audita binary paths, invoking these compatibility tests with its
own bundle. No Go workspace/submodule, remote downloads, or new public Narratio
debug command is needed. Document exact local commands and tested revisions in
the catalog README. Do not make real paid smoke calls a routine test gate.
## Stage 18. Update canonical documentation and migration guidance
Status: Pending
Update `docs/config.md`, `cli.md`, `operations.md`, `troubleshooting.md`,
`integrations/audita.md`, `integrations/notarius.md`, applicable Scriptorium/input
contracts, and focused internal documents for configuration, prepare, polish,
preflight, adapters, manifests, publish, restore, and workspace paths. Update the
overview inventory for the new glossary owner. Update architecture statements
about preflight timing/validation side effects where affected; preserve ADR 0003.
Explain the explicit source/format cutover, four prepared identities, independent
session fields, shared roster/spell-overlay retention, preparation/reuse and force
workflow, catalog installation, downstream configuration/overlay selection, and
diagnostic destinations. State that empty prepared roles replace same-named
Audita entry lists. Document automatic provider checks and validation's probe
namespace and side effects; distinguish synthetic readiness from real-transcript
feasibility and editorial quality. Native library/Audita behavior stays linked
upstream rather than becoming another local manual.
The catalog owns schema/format details, vocabulary organization, attribution,
and release history. Update it and its notices when incorporated content changes.
Record an upstream D&D README compatibility follow-up if it still calls the
feature unreleased; changing that separate repository is not this sprint's gate.
Keep the independent workspace roadmap pending, updating its upstream-capability
references as needed without implementing its latest-view/retention work.
Run documentation and example checks. Review prose for accidental extra invariants,
legacy conversion promises, duplicated upstream reference material, or an implied
guarantee that successful preflight ensures later processing succeeds.
## Stage 19. Verify the complete sprint and remove retired machinery
Status: Pending
Run focused checks during earlier stages as they become buildable. At this final
stage use the maintained Go 1.27.4 toolchain and run:
```sh
go test ./...
go test -race ./...
go vet ./...
go build ./...
```
Run Stage 17's controlled external compatibility checks against the actual
catalog and Audita v4.2. Keep live-provider experiments separately authorized
and reported; offline controlled-provider coverage satisfies this sprint's
verification requirement. Review a representative full workflow using subprocess
doubles: preparation, full native-style preflight, polishing, and downstream
binding resolution; then failure/retry and publish/restore of the same inputs.
Audit the cutover: no live legacy glossary/module request fields, aliases,
automatic format detection/conversion, generated Audita pipeline, custom native
merge engine, runtime schema/catalog download, or paid-call default test remains.
Retired source/flag names can remain in migration documentation, rejection tests,
planning records, and Git history; they must not retain live compatibility behavior.
Confirm snapshots, extensions, native presence semantics, publication guards,
diagnostic-only debug behavior, and latest-view separation against the roadmap.
Keep successful per-speaker and per-artifact work reusable under existing rules.
Ensure no preflight success is cached as a stage, and no check failure advertises
unattempted processing as complete. Resolve genuine regressions; remove redundant
or retired-behavior tests rather than preserving obsolete implementation.
Commit final focused units in each affected repository, report tested revisions
and any outstanding checks, and leave a clean workspace. Do not push, tag, release,
or delete planning documents as part of this implementation plan.