Files
ansible-workspace-dnd/docs/roadmap/features/0027-narratio-v4-adoption.md

379 lines
22 KiB
Markdown

# Feature 0027: Adopt Narratio v4.0.0 in the Standalone Role
Status: done
Approved: 2026-12-03, including the discovery-compatible configuration filename.
## Summary
Update the standalone Narratio role from v3.1.0 to v4.0.0, with its native
configuration interface, explicit secrets-bootstrap selection, and current
source-build requirements. Preserve generic inventory composition and the
existing application-account/workspace boundary. This follows reviewed
Scriptorium, Audita, and Notarius adoption in the
[agreed upgrade sequence](../application-upgrade-sequence.md).
## Problem or Opportunity
The current role selects Go 1.26 and an application-private version symbol,
renders retired spool/audio-cache and downstream fields, and uses the old
`configkit.imports` control. Narratio v4 rejects those settings and replaces
several invocation and state contracts. Updating only the version would leave
the role incompatible with the released application.
The new release also stops discovering `pipeline.yml` implicitly and stops
probing a conventional secrets directory. A useful standalone installation
needs clear configuration selection and a way to declare native bootstrap,
without making the generic role own credentials or D&D processing policy.
## Scope
- Adopt v4.0.0, Go 1.27, the `/v4` source module, and ReleaseKit version identity.
- Replace retired role variables and expose the supported native configuration
additions through ordinary nullable, field-specific inputs.
- Retain account, configuration metadata, workspace, and campaign-root
management; stop managing obsolete Narratio spool/cache roots.
- Update migration and invocation guidance and adapt the existing focused
offline behavioral tests. Record the reviewed standalone role revision.
## Non-goals
- Changing upstream applications, downstream roles, assets, pipeline defaults,
collection snapshots, consumer pins, or operational deployments.
- Authoring production/testing overlays, D&D artifacts/families, campaign or
party documents, reference catalogs, model selections, or downstream pipelines.
- Provisioning secret values, importing arbitrary companion files, installing
downstream applications or WhisperX, or adding a scheduler/service.
- Converting old configuration, manifests, publication inventories, or caches;
deleting old directories; compatibility aliases or dual-version rendering.
- Live processing, S3 transfers, provider preflight, an end-to-end D&D run, or
new tagged release publication.
## Target End State
### Source installation and managed filesystem
`narratio_version` defaults to `v4.0.0` and `narratio_go_snap_channel` to
`1.27/stable`. The application minimum is Go 1.27.0; callers disabling build
dependency management supply a compatible toolchain. Preserve the configurable
repository URL, source/binary paths, dependency switch, and Go executable.
Continue building `./cmd/narratio` from the selected checkout with the existing
trimpath and build environment. Embed the selected version through ReleaseKit
v0.10.0's `go.maximumdirect.net/releasekit/internal/runtimeinfo.injectedVersion`
contract, following the reviewed standalone roles. The relative package path
respects Narratio's `/v4` module without an obsolete module-qualified command.
Rebuild only when the checkout changes or the binary is absent.
Retain the `narratio` service user/group, configurable configuration owner,
group and modes, workspace root, and campaign registry root. Standalone
configuration metadata remains `root:narratio`, directory `0750`, file `0640`;
the workspace remains `narratio:narratio` with mode `2775`, and the campaign
root remains `root:narratio` with mode `0755`. Composing roles can continue to
override the existing public inputs. No new permissions or account framework
is introduced by this adoption.
Keep `/var/lib/narratio` and `/usr/local/share/narratio/campaigns` as concrete
managed root defaults, rendered into the application configuration. Remove the
obsolete spool and audio-cache roots from active role management. Leave any
existing directories and session state untouched; operator migration is separate.
### Configuration selection
The default for `narratio_config_path` becomes
`/usr/local/etc/narratio/narratio.yml`, a native discovery filename. Callers can
retain `/usr/local/etc/narratio/pipeline.yml` or any custom path by setting the
variable and using `--config PATH`.
Manage one selected root document. Do not install an alias, symlink, duplicate
configuration, or automatic old-file migration. Explain that old custom paths
are no longer discovered and that pre-existing files remain caller-owned after
a path change. Configuration examples and tests must select their intended
document explicitly rather than accidentally loading a different installation.
Narratio has no new role-managed schema marker. A minimal rendered document
contains the two managed roots and the caller-supplied
`narratio_whisperx_transcribe_url`, which remains required. It validates offline
without a campaign/session document, downstream executable, or provider.
### Native public variables
Introduce these optional variables, all defaulting to null:
| Variable | Type | Native field |
| --- | --- | --- |
| `narratio_config_imports` | list of dictionaries | `config.imports` |
| `narratio_config_secrets_dir` | string | `config.secrets_dir` |
| `narratio_config_secrets_overwrite` | boolean | `config.secrets_overwrite` |
| `narratio_reference_catalog_settings` | dictionary | `reference_catalog.settings` |
| `narratio_reference_catalog_systems` | dictionary | `reference_catalog.systems` |
| `narratio_campaigns_session_template_file` | string | `campaigns.session_template_file` |
| `narratio_audita_debug` | boolean | `audita.debug` |
| `narratio_notarius_cache` | string | `notarius.cache` |
| `narratio_notarius_debug` | boolean | `notarius.debug` |
| `narratio_render_variants` | list of strings | `render.variants` |
Retain the other supported configuration variables and their existing types
and null defaults. In particular, downstream credential-name lists, independent
overlay/profile selectors, S3 reference names, publish outputs, Notarius
references/outputs, and Scriptorium artifacts/families remain caller inputs.
Use one ordinary template and native serialization. Root null values omit their
fields; emit an optional parent only for a non-null descendant. Preserve
supported falsey values, explicit empty collections, and nested nulls inside
caller-supplied records. For `render.variants`, root null delegates to the
application; `[]` deliberately selects no transcript variants. No role-side
merge engine, field translation, or duplicate raw-document interface is needed.
### Retired interface
Remove these from active defaults, argument specs, templates, tests, and examples;
retain only migration guidance, without compatibility aliases:
| Retired variables | Replacement or intent |
| --- | --- |
| `narratio_configkit_imports` | `narratio_config_imports`, rendered under native `config` |
| `narratio_spool_root`, `narratio_spool_delete_audio_after_publish` | retired; prepared audio belongs to the workspace |
| `narratio_cache_root`, `narratio_cache_s3_audio` | retired Narratio audio-cache configuration; downstream caches remain independently configured |
| `narratio_audita_modules` | ordered stages belong in Audita's configuration |
| `narratio_notarius_resume`, `narratio_notarius_chunk_cache` | optional native `narratio_notarius_cache`; no automatic semantic conversion |
Do not substitute a hard-coded cache mode for the retired switches. Ordinary
Narratio completed-stage reuse and Notarius accepted-result reuse are different
controls; cache/debug selection alone does not invalidate completed Narratio
products, and forced extraction requests native refresh.
### Credentials and caller-owned composition
Bootstrap controls are emitted at the root `config` mapping in the selected
main file. `narratio_config_secrets_dir` is a native nonempty relative host path,
for example `secrets`, interpreted relative to that file's canonical directory.
It is not an absolute directory selection. Null omits bootstrap and leaves
process-environment delivery available. Null overwrite selection inherits
ConfigKit's behavior; an explicit boolean is passed through unchanged.
Narratio/ConfigKit own loading, environment precedence, validation, and safe
inspection. The role does not create/read a secrets directory or enforce a
credential-delivery policy. Supplied downstream lists and S3 fields contain
reference names, never secret values. Provisioning remains caller/suite work.
Remove guidance relying on `--secrets-dir` or automatic conventional discovery.
Imports remain complete native records. Callers may compose imports, catalog
maps, outputs, artifacts, and families in inventory and manage their referenced
files independently. Native declaration-relative resolution remains intact;
reference catalogs are maps to caller-provided vocabulary files, not an asset
installation feature. The optional session-template path likewise selects a
caller-owned file rather than deploying one.
Preserve complete Notarius output records with their v4 contract: each entry
selects a `lane_id` and optional flat JSON `filename`. Do not retain or translate
legacy descriptors. References use current prepared party/players and named
glossary source IDs. Scriptorium artifacts and families retain caller-authored
declarations, dependencies, inputs, variables, and native nested selections.
### Operator migration guidance
README examples use the v4 role interface and native commands, with flags after
the complete command path. Link the tagged configuration, CLI, operations and
integration guides rather than reproducing their full contracts. Cover:
- Explicit configuration selection, native `config` imports/bootstrap, and
source-relative resources. Explain optional omission versus valid explicit
falsey values and caller-owned overlays/companions.
- Current `config validate` and path-selected `config show` inspection;
`run SESSION --stage STAGE`, `artifacts list`/`regenerate`, `--session-file`,
and `session clean` replace the retired command spellings. ConfigKit overlays
remain distinct from downstream PromptKit profiles.
- Separate installation/configuration of compatible Audita v4.3.0, Notarius
v0.10.0, and Scriptorium v0.16.0. The role does not install or version-probe them.
- Shared campaign, party and glossary documents replace the old input shapes.
New local state accepts only `narratio.session-manifest.v2`: preserve old
work separately, then regenerate or import compatible published products into
a new baseline. Remove obsolete guidance to edit old manifests in place.
- Publication/restore transfers products, not the former execution ledger.
`workspace.cleanup_after_publish` now removes the entire session run history,
including logs/debug captures; keep its standalone null default and do not
enable cleanup or run it during installation.
- Native preflight may contact providers, download inputs, and write workspace
state. It is an operator workflow, not offline configuration validation or
an Ansible convergence/test prerequisite.
## Repository Ownership
- `ansible-role-narratio`: generic source installation, managed root document
and filesystem, public variables, migration guidance, and role-local tests.
- Workspace: roadmap, later staged plan, tracking, and review evidence.
- Narratio v4.0.0 and its selected framework sources: read-only contracts.
- Other roles, campaign/prompt assets, suite, collection and deployment consumer:
unchanged by this feature.
## Constraints and Settled Decisions
Follow the [Ansible](../../ansible.md), [testing](../../testing.md), and
[planning](../../planning.md) policies, the [MVP architecture](../mvp.md), and
[shared filesystem decision](../../decisions/0002-shared-readable-pipeline-filesystem-policy.md).
This approved v4 roadmap supersedes historical v3-specific spool/cache,
control-key, filename, and manifest guidance where necessary; generic ownership
and the separation of application and suite policy remain intact.
The public v4.0.0 tag resolves to
`831665c9137877e250e667c06d1a383a95a14eef`, verified through the repository URL
used by the role. Use that release contract, not an unreviewed moving branch.
The current standalone role is `758aed7a74c9a64ad02e13ff551b4f7aea16b3af`.
The existing suite compatibility set stays pinned until coordinated integration.
This feature does not pair the new Narratio interface with the old suite-owned
configuration or claim an operational D&D deployment.
## Simplest Viable Implementation
Adjust the selected version/toolchain and the existing build command. Replace
retired defaults/spec/template entries, add native conditional fields to the
single root template, and stop creating obsolete spool/cache directories. Keep
the ordinary account, file, Git, binary stat/build, metadata and template flow.
Update README and existing fixtures/harness in place. No new production probe,
validation command, state assembly, persisted bookkeeping, or migration task
is needed. The binary stat remains justified by missing-output build recovery.
## Acceptance Criteria
- An explicitly selected v4.0.0 build reports that version through native
`narratio version`. Replace the old v2.1.0 selection/recovery case rather
than adding a build-identity compatibility branch. Do not freeze defaults.
- The minimal managed document validates through the installed application as
its service account, selecting the intended file and app scope. Omission
checks explicitly supply null optional inputs rather than snapshotting the
current default document. No campaign/session or downstream tool is required.
- Representative supplied native fields survive rendering and offline
inspection: include imports, bootstrap selection, reference catalogs/template
path, cache/debug selection, render variants, and current collection records.
Preserve meaningful falsey values and caller-composed artifacts/outputs/maps
without testing a matrix of upstream validation or framework rules.
- One small caller-owned import and synthetic credential-file fixture exercise
the role's main-file controls through native loading. Credential-name lists
and independent downstream selectors retain representative named and empty
coverage; no provider calls or actual credentials are needed. Fixtures own
their files and cleanup; the production role does not gain those tasks.
- Supplied Notarius lane/reference records and Scriptorium family declarations
validate/inspect offline without extraction, family expansion, party bytes,
reference-catalog contents, or a processing workspace. Use app inspection,
not `artifacts list` or preflight, for this standalone boundary.
- Caller-selected Go/missing-binary recovery with dependency management disabled
remains covered. Each role case has an immediate identical convergence
reporting no changes. Tests protect supplied outcomes, not module metadata,
task traces, default catalogs, secret-loader internals, or upstream algorithms.
- Shell syntax, Ansible syntax, production-profile lint, relevant offline
integration checks, and whitespace checks pass. Local tooling setup follows
the workspace workflow; no controller deployment, provider smoke test, or
full upstream release suite is an additional gate.
- Defaults/spec/template/README agree, retired fields are absent, and migration
guidance is current. Record the reviewed role revision; suite, collection,
consumer, other role, and asset pins remain unchanged.
## Implementation Evidence
Standalone role commit `2a4e82c734a256a02281dbb6e63b348a7171f808` implements the
v4 source build and native configuration interface. Workspace handoff `5a476d3`
records the implementation results.
From the role repository, `bash -n tests/integration`, `git diff --check`, and
`tests/integration` passed. The integration harness installed the pinned
`community.general` collection, syntax-checked its playbooks, and passed
`ansible-lint --profile production --offline` (nine files, zero failures or
warnings). Minimal, explicitly selected v4/custom-Go binary recovery,
representative, and explicit-empty role applications each had an immediate
repeat reporting `changed=0` and `failed=0`. The installed application's text
and JSON version reports confirmed v4.0.0, and the logging Go wrapper confirmed
the caller-selected executable was used with dependency management disabled.
Offline validation and app inspection ran as the Narratio account against
explicit temporary configuration paths. The representative case covered a
required relative import, synthetic secrets bootstrap with overwrite false,
catalog maps and session template path, Audita and Notarius debug controls,
Notarius cache, references and lane output, render variants, credential names,
independent selectors, composed artifacts and family declarations, and nested
nulls. The explicit-empty case covered empty maps, lists and selectors. No
actual credentials, provider calls, processing or domain expansion were used.
A restricted-directory wildcard in the initial fixture setup was corrected;
the final complete suite passed after that correction and an explicit-null
minimal fixture adjustment. No production-flow complexity was added beyond
the planned native fields and existing missing-binary build check.
The authorized local test host's `/usr/local/src/narratio` checkout and
`/usr/local/bin/narratio` were updated to v4.0.0; the role also converged the
application account, managed workspace and campaign roots, and Go Snap state.
Temporary configurations, imports and synthetic secret fixtures were removed.
Existing system configuration and old spool/cache/session data were not
migrated or deleted. This is not an operational deployment or a suite
compatibility claim.
## Independent Review and Closeout
Closed on 2026-12-03 after independent review of role `2a4e82c` against the
approved roadmap and executed plan. No required code-quality fixes,
implementation gaps, or unnecessarily strengthened requirements were found.
`docs/roadmap/remediation.md` was left unchanged.
The reviewer independently reran `bash -n tests/integration`, changed-commit
whitespace checks, and the full `tests/integration` harness. Syntax checking,
production-profile lint, native app validation/inspection, imports, synthetic
secrets bootstrap, explicit version selection, and custom-Go missing-binary
recovery passed. All four immediate repeats reported `changed=0` and `failed=0`.
Changed documentation's local links passed as well.
The role retains its direct declarative task flow, original build condition,
and nullable native configuration interface. Test fixtures were removed; no
existing system configuration, old directories or session data were migrated.
No live provider, operational deployment, or coordinated suite compatibility
was validated. Suite, collection, consumer and asset selections remain unchanged.
The reviewed role commit was pushed to upstream `main` during closeout. This
publishes the standalone update without creating a new tagged release or
advancing the suite compatibility set. Git history preserves the executed plan;
no implementation plan is active.
## Dependencies and Follow-up Work
Features 0024, 0025 and 0026 are complete after independent review and provide
native interface/build examples. Standalone Narratio adoption and independent
review are now complete as well.
Coordinated integration follows Narratio implementation, review and closeout.
It owns shared campaign/party/glossary and prompt assets, reference-catalog
deployment, D&D processing and model defaults, testing overlays, suite secrets
bootstrap, cache/ACL provisioning, cleanup-retention policy, compatible asset
cutover, coordinated dependency pins, and consumer migration guidance. Plan
those choices against the reviewed standalone roles; keep the existing suite
and its asset compatibility intact until then.
## Rationale and Alternatives
### Default configuration filename
Adopt `/usr/local/etc/narratio/narratio.yml` as the standalone
default. It is a native discovery filename, makes a fresh installation usable
without a permanent `--config` flag, and requires no discovery workaround.
Keep the path configurable and leave the previous file untouched. The later
suite integration can deliberately choose its path and update its invocations.
Retaining `/usr/local/etc/narratio/pipeline.yml` was a viable alternative. It preserves
the existing managed filename and reduces path changes for explicit callers;
every invocation relying on that file must supply `--config`. Both are supported
upstream. The discovery-compatible default was approved to preserve convenient
standalone use; explicit callers retain the configurable path.
## Open Questions
None. The discovery-compatible default and configurable custom-path alternative
are approved decisions.
## Upstream References
- [v4.0.0 release](https://gitea.maximumdirect.net/eric/narratio/src/tag/v4.0.0/docs/releases/v4.0.0.md)
- [Configuration and secrets bootstrap](https://gitea.maximumdirect.net/eric/narratio/src/tag/v4.0.0/docs/config.md)
- [CLI and invocation migration](https://gitea.maximumdirect.net/eric/narratio/src/tag/v4.0.0/docs/cli.md)
- [Operations and state migration](https://gitea.maximumdirect.net/eric/narratio/src/tag/v4.0.0/docs/operations.md)
- [Current integration contracts](https://gitea.maximumdirect.net/eric/narratio/src/tag/v4.0.0/docs/integrations/README.md)
- [Production/testing example](https://gitea.maximumdirect.net/eric/narratio/src/tag/v4.0.0/examples/production-testing/pipeline.yml)
- [ReleaseKit source-build identity](https://forge.maximumdirect.net/base-layer/releasekit/src/tag/v0.10.0/docs/consumers/runtime-version.md)