# Implementation Plan 0027: Adopt Narratio v4.0.0 Status: ready Approved: 2026-12-03 Target executor: GPT-5.6-Terra Feature roadmap: [Feature 0027](features/0027-narratio-v4-adoption.md), approved 2026-12-03, including the native discovery filename. Active plan location: `docs/roadmap/implementation.md` ## Objective Deliver the approved standalone Narratio v4.0.0 source installation and native configuration interface, current operator guidance and focused offline tests. The feature roadmap owns scope, policy and acceptance criteria. Keep the coupled interface and its tests coherent in one role commit, followed by a workspace handoff for independent review. ## Execution Rules - This plan is approved for implementation. Execute Stage 1 then Stage 2. Immediately before each stage, reread its Required Policy Review documents and confirm its preconditions and repository state. - Preserve unrelated work. Commit each validated stage in its owning repository and mark completion here. Do not push, publish, deploy to an operational host, or advance suite/collection/consumer/asset selections. - Trust state-management modules. Retain the binary stat solely to decide missing-output build recovery; rebuild on checkout change or binary absence. Preserve task-level escalation and imperative build change semantics. Add no production probes, state assembly, fingerprints or compatibility/migration machinery. Do not test module postconditions or default identities. - Native preflight, processing, family expansion, provider calls, storage I/O, actual credentials and the full upstream release suite are outside validation. - Missing tools on PATH do not imply a missing controller. Use workspace `.venv` executables; follow README setup with `requirements-dev.txt` if necessary. Local preparation is ordinary work, not an operational deployment requirement. Report genuine remaining prerequisites or contract conflicts with evidence; do not replace required behavior or add unrelated acceptance gates. ## Starting State and Preconditions - The feature roadmap and this implementation plan are approved. - `ansible-role-narratio` is clean on `main` at `758aed7a74c9a64ad02e13ff551b4f7aea16b3af`. It selects v3.1.0, Go `1.26/stable`, and `/usr/local/etc/narratio/pipeline.yml`. Recheck before work. - Read-only `../narratio` tag v4.0.0 resolves to `831665c9137877e250e667c06d1a383a95a14eef`. Use this tag's contracts even if the checkout later advances. Its module requires Go 1.27.0 or newer. - Planning checks found Ansible Core 2.21.3 in `.venv`, Go 1.27.4 at `/snap/bin/go`, and working `sudo -n true`. The local Ubuntu 26.04 host is the authorized role test host; recheck prerequisites when executing. - The harness may update `/usr/local/src/narratio`, `/usr/local/bin/narratio`, the application account and managed roots, and the Go Snap. Use temporary caller-owned configuration fixtures. Do not open/migrate existing sessions or delete old configuration/spool/cache directories. - Retain `collections/requirements.yml` selecting `community.general` 13.3.0 and its temporary collection installation. Other pins stay unchanged. ## Repository Scope - `ansible-role-narratio`: defaults, argument specs, production tasks, one template, README and role-local tests. - Workspace: plan progress, feature evidence, status and upgrade sequence. - Narratio and selected framework sources, and reviewed standalone roles: read-only references. Follow their repository-local agent reading guides. - Other roles, assets, collection and consumer: unchanged; their integration suites are not prerequisites for this standalone feature. ## Stage 1: Deliver the Native Role and Offline Behavioral Coverage ### Objective Leave one coherent role that builds v4.0.0, renders supported native settings, and documents and verifies the caller boundary without obsolete inputs. ### Required Policy Review Immediately read workspace `AGENTS.md`, `docs/orientation.md`, `docs/conventions.md`, `docs/ansible.md`, `docs/testing.md` and the approved feature roadmap. Check role-local instructions. Before upstream inspection, read `../narratio/AGENTS.md`, `docs/development.md` and `docs/policy/agents.md` in that repository. Use the tagged release, config, CLI, operations and integration references linked by the roadmap for the consumer contract. ### Preconditions Plan approval and starting-state/tool checks are confirmed. Inspect defaults, argument specs, tasks, `templates/pipeline.yml.j2`, README, `tests/integration`, `tests/converge.yml`, `tests/representative.yml`, both verification playbooks, inventory and collection requirements before editing. ### Owning Repository `ansible-role-narratio` ### Required Changes 1. Select `narratio_version: v4.0.0`, `narratio_go_snap_channel: 1.27/stable` and `narratio_config_path: /usr/local/etc/narratio/narratio.yml`. Preserve other installation inputs and account/configuration metadata from the roadmap. Keep `./cmd/narratio`, `-trimpath`, `CGO_ENABLED=0`, `GOWORK=off` and `GOTOOLCHAIN=local`. Replace the retired linker override with: ```yaml "-s -w -X go.maximumdirect.net/releasekit/internal/runtimeinfo.injectedVersion={{ narratio_version }}" ``` 2. Remove the eight retired variables enumerated by the roadmap from active defaults, specs, template and fixtures. Replace the mutable-root loop with an ordinary file task for `narratio_workspace_root`, retaining its ownership and `2775` mode. Preserve campaign-root and account management. Do not remove legacy files/directories or change the binary build trigger. 3. Add all ten nullable variables in the roadmap's Native public variables table with its exact names, destinations and types. Imports use dictionary elements; render variants use string elements. Keep catalog dictionaries and existing open-ended records unrestricted by role-authored child schemas. Other supported variables retain their types and null defaults; the WhisperX URL remains required. 4. Extend the single template with conditional native fields. Put imports and bootstrap controls together under root `config`, catalog maps under `reference_catalog`, and other fields under their mapped parents. Render only non-null leaves/parents using serialization and `is not none`. Keep workspace/campaign roots and WhisperX URL concrete; add no schema marker. Preserve supported empty/false/zero values and nested nulls in caller records. Root null render variants omits the field; `[]` selects none. Bootstrap is a relative string, not an absolute-path transformation or role-managed directory. Do not translate retired cache/module settings. 5. Update README defaults, inventory examples, validation and migration guide together. Cover every Operator migration guidance item in the roadmap: discovery/custom paths, main-file bootstrap, native imports, independently owned downstream configuration, native cache/lane records, shared inputs, unsupported older manifests, product-only restore and run-history cleanup. Remove old instructions to edit manifests in place. Link tagged contracts. Explain that old files become unmanaged and companions/credentials are caller responsibilities. Add no provider/model/D&D policy or release machinery. 6. Adapt the existing harness/verification playbooks in place. Retain temporary collection setup, local inventory, service-account inspection, cleanup, syntax and production-profile lint. Use a unique temporary fixture root traversable by `narratio`; it contains the explicitly selected managed file, one imported fragment and a restricted synthetic secrets directory. Fixture setup owns companions and cleanup, outside the production role. Update all hard-coded configuration reads/commands to the supplied test path; leave existing system configurations untouched. Retain four representative cases, each followed immediately by an identical role application requiring `changed=0` and `failed=0`: - **Minimal:** explicitly null optional application inputs, select roots and a synthetic HTTP WhisperX URL, and validate the selected main as `narratio`. Verify selected omissions in authored YAML rather than comparing a complete default document. No campaign/session/downstream file is needed. - **Version/recovery:** replace v2.1.0 with explicitly requested v4.0.0. Remove the test host's installed binary, disable dependency management and supply the existing logging Go wrapper. Confirm wrapper use and native selected version identity (use structured version fields rather than requiring an exact text line with no revision), then repeat identically. Fold the old standalone version-switch run into this case rather than retaining a redundant legacy case. Explicitly select a custom `pipeline.yml` fixture path here to retain useful configurable-path coverage. - **Representative:** migrate the current fixture to v4.0.0, retaining meaningful zero/false/string/composition assertions. Add a required relative import, e.g. `fragments/imported.yml` supplying a non-default WhisperX language while its root role input is null. Supply `config.secrets_dir: secrets` and explicit overwrite false; fixture files provide the synthetic names already used by credential tests. Validate without setting empty environment values that would shadow those files. Supply both catalog maps and a session-template path; app inspection only resolves these paths and needs no vocabulary/template contents. Supply native Notarius `cache: bypass`, debug false, config/pipeline selection, party/combined-glossary bindings and an output with `lane_id` and flat JSON filename. Enable its section for native field validation without invoking Notarius. Retain named overlay/profile selectors and credential lists. Compose Scriptorium artifacts and families in inventory; use a small family shaped from the tagged example with `for_each: party.characters` and an `artifacts/{character_id}-notes.md` output pattern. Inspect the declaration without a party or expansion. Include a supported nested null such as a family's `render_debug: null` and verify authored pass-through. Supply Audita debug false and `render.variants: [normalized]`. Keep cleanup/publish disabled in the fixture. - **Explicit empty:** reuse the representative fixture with credential lists `[]`, empty downstream selectors, render variants `[]`, catalog maps `{}`, Notarius references `{}`, and null bootstrap/import controls. Keep the enabled Notarius section's required config/pipeline/lane declarations. Preserve the useful credential-only Scriptorium parent case by nulling its other fields, including families. Verify supplied empty values and validate offline. Do not create a matrix of every upstream clearing rule. Use native commands with flags after the full command path: ```sh narratio version --format text narratio version --format json narratio config validate --config "$fixture_config" --scope app narratio config show --config "$fixture_config" --scope app --format json ``` Run config commands as `narratio`, with a fixture path readable by that account. Inspect selected paths when practical; assert only supplied outcomes. Native views may omit bootstrap controls or redact credentials: inspect authored YAML for control/reference spelling and use native loading for composition. Do not assert resolved secrets or bootstrap precedence internals. Retain useful synthetic-value log checks without expanding a redaction matrix. Omit preflight, domain planning, artifact expansion and processing commands. ### Validation From `ansible-role-narratio` run: ```sh bash -n tests/integration git diff --check tests/integration ``` The harness installs the pinned collection, syntax-checks its playbooks and runs `ansible-lint --profile production --offline` on role test entry points and fixture/verification playbooks after dependency setup. Adapt the current lint invocation accordingly; do not suppress real failures. Native app validation, inspection, explicit version/custom-Go recovery, supplied configuration and four clean repeats must pass. Check README local links. ### Completion Criteria Defaults, specs, tasks, template, documentation and tests agree with every roadmap criterion. Record exact checks/results, clean repeats, test-host changes and fixture adjustments. The role is valid before committing; resolve failures before Stage 2. No production probes or extra runtime policy have been added. No operational deployment or suite compatibility is claimed. ### Commit Commit intent: `Update Narratio to its native version 4 interface`. ## Stage 2: Record the Implementation Handoff ### Objective Identify the tested standalone role revision and leave Feature 0027 ready for independent review while retaining the current suite compatibility set. ### Required Policy Review Immediately reread workspace `AGENTS.md`, `docs/orientation.md`, `docs/conventions.md`, `docs/planning.md` and `docs/testing.md`, plus the approved roadmap and this plan, before recording claims and progress. ### Preconditions Stage 1 is committed and all checks passed. Inspect actual role/workspace changes and aggregate repository state; preserve unrelated work. ### Owning Repository Workspace root. ### Required Changes 1. Add implementation evidence to Feature 0027: role commit, exact checks/results, four clean repeats, supplied native-field/import/bootstrap outcomes, version/custom-Go recovery, test-host effects, deviations and limits. State that independent review is pending; do not mark the feature complete. 2. Update `docs/status.md`, the Feature 0027 upgrade-sequence entry and plan progress. Use feature state `in_progress`; mark both execution stages complete. Leave the plan available for review. Do not retire it, write speculative remediation or start coordinated integration. 3. Confirm other repositories and compatibility pins remain unchanged. Record unrelated dirt separately; ahead-of-origin commits alone are not failures. ### Validation From the workspace root run: ```sh git diff --check git -C ansible-role-narratio status --short scripts/status ``` Check edited Markdown links and compare the actual role diff and validation evidence with each acceptance criterion. Reuse Stage 1 results for unchanged role code; do not rerun other suites. Review and commit the workspace handoff. ### Completion Criteria The handoff identifies the tested revision, results and pending review. Both owning repositories have no uncommitted feature work after their commits; compatibility selections remain intact. No provider, operational deployment, older-state migration or end-to-end suite validation is claimed. ### Commit Commit intent: `Record the Narratio version 4 update for review`. ## Final Validation and Handoff Report both commits, validation outcomes, four clean repeats, deviations, remaining failures, test-host changes and deferred integration work. Identify complexity added beyond the planned flow and the requirement it serves. Feature 0027 remains in progress until independent review and closeout. ## Progress Notes No implementation stage has started. The feature roadmap and staged plan are approved; Stage 1 is ready to begin. ## Open Questions None. The roadmap resolves filename, interface and ownership; this plan assigns concrete implementation and validation boundaries.