Files
ansible-workspace-dnd/docs/roadmap/implementation.md

321 lines
16 KiB
Markdown
Raw Normal View History

# Implementation Plan 0024: Adopt Scriptorium v0.16.0
Status: ready
Target executor: GPT-5.6-Terra
Feature roadmap: [Feature 0024](features/0024-scriptorium-v0-16-adoption.md)
Active plan location: `docs/roadmap/implementation.md`
## Objective
Deliver the approved standalone Scriptorium v0.16.0 role update with native
configuration, Go 1.27, correct version identity, and focused offline behavioral
coverage. The feature roadmap owns scope and rationale. Its public-interface
migration is small and coupled enough to implement and validate in one role
stage, followed by a separate workspace handoff stage. Do not commit an
intermediate role whose configuration or tests still use the retired interface.
## Execution Rules
- Execute Stage 1, then Stage 2. Reread each stage's required policies immediately
before beginning it; confirm its preconditions and owning repository.
- Preserve pre-existing changes. Commit each completed stage in its owning
repository with the stated plain English message after validation. No push,
release, consumer refresh, or operational deployment is part of this plan.
- Keep the current module-driven task flow. The binary stat is necessary for
the imperative build; rebuilding remains conditional on checkout change or
binary absence. Trust file, Git, Snap, APT, and template module postconditions.
- Add no production validation, version interrogation, sidecar state,
configuration-assembly facts, compatibility loader, or custom Ansible module.
- Tests exercise supplied values and observable outcomes. Do not add default
identity snapshots, module-postcondition assertions, task trace checks,
upstream framework test matrices, or provider calls.
- Missing local tools are setup work. Use the existing workspace tooling and
local test host; do not invent requirements for another controller,
`pipeline-dnd`, `ansible-doc`, live credentials, or upstream release checks.
- If an actual contract conflict or unavailable prerequisite remains after
ordinary setup, report the concrete failure and preserve work. Do not change
the approved scope or silently weaken a required role outcome to bypass it.
## Starting State and Preconditions
- The feature roadmap and this implementation plan are approved. No application
implementation has been performed by the planning pass.
- The standalone role starts at `b174c8c2990bb79f8149d8f288c5e06ccb42bd73`
on `main`, with Scriptorium v0.15.0 and Go `1.26/stable` selected. Confirm the
actual tree before editing; preserve later unrelated changes if present.
- The application source is `../scriptorium`. Public v0.16.0 resolves to
`0fa538c336fd64be51bc355fd53d3ca19f104d68`. Use the tag's configuration and
CLI contracts, not later branch changes.
- The workspace `.venv/bin/ansible-playbook` is already available at planning
time. If absent in the execution environment, follow `README.md`'s Development
Tooling section using `requirements-dev.txt`; do not change pinned tooling
merely to set up the environment.
- The existing local test host is Ubuntu 26.04 and is the approved test proxy.
Its role harness uses sudo, `/usr/local/src/scriptorium`,
`/usr/local/bin/scriptorium`, and `/usr/local/etc/scriptorium/config.yml`.
Local test convergence may change those paths and provision Go through Snap;
it is distinct from deploying to an operational controller or host.
- Source builds use the role-selected Go executable, not whichever `go` first
appears on PATH. The updated role provisions `1.27/stable`; dependency opt-out
tests run after a compatible Go executable is available. Keep
`GOTOOLCHAIN=local` rather than relying on implicit toolchain downloads.
- The existing collection requirement is `community.general` 13.3.0. Reuse it
and the harness's temporary collection path. Other dependency pins stay put.
## Repository Scope
- `ansible-role-scriptorium`: production defaults/spec/template/build, README,
and repository-local test fixtures/harness.
- Workspace: implementation tracking and review evidence for Feature 0024.
- `../scriptorium` and its selected framework sources are read-only references.
If their instructions require policy reading for investigation, follow the
upstream `AGENTS.md` reading guide; do not modify those repositories.
- Pipeline, collection, consumer, other roles, and both asset repositories
remain unchanged. Do not run their integration suites: they still select the
earlier compatibility set and are outside this standalone feature.
## Stage 1: Deliver the Native Scriptorium Role and Its Offline Tests
### Objective
Leave one coherent, documented, tested standalone role that installs and
configures the released Scriptorium v0.16.0 interface.
### Required Policy Review
Before beginning this stage, read these workspace-relative files:
- `AGENTS.md`
- `docs/orientation.md`
- `docs/conventions.md`
- `docs/ansible.md`
- `docs/testing.md`
Then read the approved feature roadmap and the tagged upstream configuration,
CLI migration, and PromptKit migration documents linked there. Inspect any
repository-local agent instructions before changing the role.
### Preconditions
The starting-state checks above are satisfied and this plan is approved.
Inspect `defaults/main.yml`, `meta/argument_specs.yml`, `templates/config.yml.j2`,
`tasks/main.yml`, `README.md`, `tests/integration`, `tests/converge.yml`, and
`tests/verify-config.yml` in the owning repository before editing.
### Owning Repository
`ansible-role-scriptorium`
### Required Changes
1. Set `scriptorium_version: v0.16.0` and
`scriptorium_go_snap_channel: 1.27/stable`. Keep the repository URL, paths,
metadata defaults, dependency-management switch, and Go executable interface.
Continue building `./cmd/scriptorium` using the existing command task and
build environment. Replace the ldflags argument with:
```yaml
"-s -w -X go.maximumdirect.net/releasekit/internal/runtimeinfo.injectedVersion={{ scriptorium_version }}"
```
This is the injection symbol used by the selected ReleaseKit v0.10.0 build
implementation, surfaced through public `buildinfo.Version()`. No ReleaseKit
launcher, build receipt, new public flag variable, or release tooling is needed.
2. Replace the old configuration interface with the six nullable variables
specified in the feature roadmap. In the argument spec use optional
`list`/`elements: dict` for imports and the three resource lists, `dict` for
collections, and `path` for schema root. Remove the six retired variables
listed in the roadmap from defaults, spec, template, tests, and active examples;
mention them only in migration documentation. Keep the supported server and
transient-retry variables unchanged.
3. Use the existing single configuration template. Render imports beneath
`config` and native resource fields beneath `promptkit`, with a parent
predicate covering every supported descendant. Serialize collections and
strings appropriately and select fields with `is not none`. Preserve `[]`,
`{}`, zero, and false inside supplied structures. Render `{}` when all
application settings are null. Do not merge or translate resource definitions.
4. Update README defaults, inventory examples, validation description, and
migration guidance together. Explain the variable replacements, caller-owned
fragments and source-relative resources, qualified IDs, whole-record same-ID
replacement, native overlay versus LLM profile selection, and the new CLI
boundary. Link upstream for discovery, secrets bootstrap, structural-repair
budgets, and removed profile IDs. The role supplies native fields and imports;
it does not deploy arbitrary referenced assets or secret files.
5. Migrate the existing harness and verifier in place. Keep its temporary paths,
local inventory, dependency installation, cleanup, and clean-repeat checks.
Delete the obsolete profile-directory fixtures and retired inspection flags.
Use these existing behavioral cases rather than adding parallel test tooling:
- **Minimal configuration:** explicitly supply null for the supported optional
application fields, validate the managed document with native `config
validate`, and verify it parses as `{}`. This proves supplied null omission,
not current default identity. Immediately repeat identical convergence.
- **Recovery and executable selection:** retain removal of the test binary
and the existing caller-supplied Go wrapper with dependency management
disabled. Explicitly request `scriptorium_version: v0.16.0` in this case
and its repeat. Require wrapper use and native `scriptorium version` output
`scriptorium v0.16.0`. Do not inspect linker arguments as a test assertion.
- **Representative native configuration:** supply a synthetic backend list,
profile list, prompt list, collection mapping containing a namespaced
profile/prompt, and a schema-root path under the temporary fixture root.
Use explicit IDs such as `fixture-backend`, `fixture-profile`,
`fixture-prompt`, and `fixture/offline`/`fixture/note`. Give profiles a
synthetic model and localhost endpoint/backend, without a credential
reference. Prompts use inline messages and a native text output contract
with validation disabled, so inspection needs no provider or real assets.
Include server address, request limit zero, retry zero, queue capacity
zero, and a nested false parameter. Verify supplied fields through the
deployed document and native offline inspection; leave selected nullable
server fields unset and assert their omission. Repeat identical convergence.
- **Caller-owned import and empty containers:** retain a small temporary
`fragments/server.yml`, selected with
`scriptorium_config_imports: [{path: fragments/server.yml, required: true}]`.
Select the temporary main config path and caller ownership as before.
Also supply empty resource lists and an empty collections mapping in this
case. Check their literal deployment and null schema-root omission, then
use native configuration inspection to verify the imported server address.
Repeat identical convergence. Keep import behavior and empty-container
rendering in this existing case instead of adding a combinatorial matrix.
Synthetic names and values above are test inputs, never production defaults.
Use native commands with flags after the full command path, for example:
```sh
/usr/local/bin/scriptorium config validate --config "$config_path"
/usr/local/bin/scriptorium promptkit show profile fixture-profile --config "$config_path" --format json
/usr/local/bin/scriptorium promptkit show prompt fixture/note --config "$config_path" --format json
/usr/local/bin/scriptorium config show --config "$import_config_path" --path /server/addr --format json
```
Path-selected native config show returns the selected effective value; parse
that JSON scalar rather than assuming the retired full-document report shape.
Successful inspection of explicitly supplied resource IDs plus assertions of
caller fields is sufficient. Do not test the bundled catalog, run generation,
call smoke/preflight, or test framework inheritance internals.
### Validation
From `ansible-role-scriptorium`, run:
```sh
bash -n tests/integration
git diff --check
tests/integration
```
The harness must run native offline validation/inspection, the revised supplied
configuration assertions, version selection and missing-binary/custom-executable
recovery, and immediate clean repeats. Its existing syntax and lint invocations
must pass with the updated fixtures. Retain production-profile lint; do not
silence real failures. An unrelated dependency-download attempt by lint can be
avoided using its offline mode after installing the pinned dependencies.
Tool setup follows workspace README instructions. If the harness needs sudo
authentication, use the available local privilege mechanism and report an actual
access failure accurately. No remote-controller login or API keys are needed.
Do not run the full upstream application/release suites as an additional gate.
### Completion Criteria
The installed application reports the explicitly requested version, all selected
native configuration behaviors work offline, and identical repeats report
`changed=0` with no failures. Defaults/spec/template/README agree. No production
task or rebuild trigger was added. Record the commands and results for handoff;
only role-owned changes belong in this stage's commit.
### Commit
Commit intent: `Update Scriptorium to its native configuration interface`.
## Stage 2: Record the Implementation Handoff
### Objective
Record the tested standalone role revision and leave the feature ready for
independent review, with the existing suite compatibility set intact.
### Required Policy Review
Before beginning this stage, reread these workspace-relative files:
- `AGENTS.md`
- `docs/orientation.md`
- `docs/conventions.md`
- `docs/planning.md`
- `docs/testing.md` before recording validation claims
### Preconditions
Stage 1 is committed and its required validation passed. Inspect the role's
actual commit and working-tree state and the workspace's outstanding changes.
### Owning Repository
Workspace root.
### Required Changes
1. Add concise implementation evidence to Feature 0024: role commit, native
configuration/version outcomes, exact commands run, clean-repeat evidence,
limitations, and any deviations. Leave independent review explicitly pending.
2. Update `docs/status.md` and the current section of
`docs/roadmap/application-upgrade-sequence.md` to identify the implemented
role and pending review. Use `in_progress`, not `done`; do not advance to
Audita implementation before review and closeout.
3. Keep concise progress notes in this plan. Do not retire it, write speculative
remediation findings, update suite/collection/consumer pins, or start the next
feature as part of handoff. Preserve other repositories' pre-existing work.
### Validation
From the workspace root, run:
```sh
git diff --check
git -C ansible-role-scriptorium status --short
scripts/status
```
Check edited Markdown's local links. Compare the final role diff and recorded
evidence with every feature acceptance criterion. Reuse Stage 1's successful
checks for unchanged code; rerun only checks affected by subsequent changes.
Confirm the unrelated repository trees and dependency selections were not changed
by this feature. Do not interpret existing ahead-of-origin commits as a failure.
### Completion Criteria
Documentation accurately identifies the tested role revision, evidence, and
pending review. The role and workspace have no uncommitted feature work after
the handoff commit; report unrelated changes separately. No suite deployment,
publication, or credential validation is claimed.
### Commit
Commit intent: `Record the Scriptorium update for review`.
## Final Validation and Handoff
Report both commit identifiers, actual validation results, any deviations or
remaining failures, and any complexity added beyond the planned task flow with
the requirement that justified it. Report whether optional local tooling setup
changed the shared test host. Feature completion requires independent review;
do not mark Feature 0024 done. The next selected application in the agreed
sequence is Audita, after this feature's review and closeout.
## Progress Notes
Feature roadmap and staged plan approved. Ready for the implementation sprint;
no implementation stages have begun.
## Open Questions
None. Scope, native variable mapping, version injection, toolchain selection,
offline validation, and repository boundaries are settled for this feature.