Files
narratio/docs/roadmap/implementation.md

385 lines
22 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# ReleaseKit adoption implementation plan
## Scope and execution
Implement the target in [releasekit.md](releasekit.md). This plan is for a Luna
coding agent completing one end-to-end sprint. Execute Stage 1 through Stage 7
in order. Intermediate stages may leave scripts, callers, tests, or documentation
temporarily inconsistent. Reach the final native workflow directly; temporary
compatibility layers and repeated intermediate full-suite runs are unnecessary.
The baseline is Narratio commit
`0d0596b204ab3a374c522e7e9d8395b8b0b0ce8a`, which added the feature roadmap
without implementing it. This plan replaces the completed ConfigKit/CommandKit
implementation plan; those features remain part of the baseline.
Start each implementation prompt with `docs/development.md` and
`docs/policy/agents.md`. Read the release, architecture, testing, documentation,
and OSS policies where the stage affects their topics. Reuse unchanged policy
context. Follow graph-first code discovery. The file names below identify
current owners; their internal structure is not a preservation requirement.
Read the feature roadmap for scope and selections. Its pinned ReleaseKit v0.10.0
links are the canonical upstream references. A sibling checkout at
`../ReleaseKit` can supply those documents and templates after verifying commit
`82bac1a3ab935beddd4b8789d1e07f52135d4243`; the released module is the dependency.
Mark each stage completed here with a short outcome and relevant verification.
Follow the repository's focused-commit policy. Report intermediate validation
limitations accurately; a stage need not pass tests made obsolete by a later
stage. This sprint does not authorize an upstream push, real release tag,
hosted release, or live delivery.
### Decisions carried into implementation
- Adopt ReleaseKit v0.10.0 as both a registered CLI tool and the runtime
`buildinfo` dependency. Keep the existing Narratio module path, Go 1.27.0
consumer minimum, and selected Go 1.27.4 toolchain.
- Keep the root-module `main`/`origin` release workflow. Maintainers push the
candidate before native `publish`; publication pushes its annotated tag.
- Narratio owns the profile, release note, selected destinations and platforms,
and small invocation/integration wiring. ReleaseKit owns validation execution,
tag mechanics, native diagnostics and recovery, builds, and delivery.
- Keep native race, full vet, formatting, and local-replacement checks. Use the
selected application builds for platform verification. Remove custom release
gates and leave other optional validations unselected.
- Confirmed source-tag publication is completion. CI, hosted content, and
installation remain separate observations. Use native recovery on uncertainty.
- Keep the existing binary names, `SHA256SUMS`, and platform support. Map the
existing CI secret to ReleaseKit's environment variable.
- Keep shared-library documentation upstream. Local documentation owns
Narratio's selections and short, executable maintainer workflow.
- Historical tags and release records remain unchanged. ConfigKit, CommandKit,
application configuration, session behavior, and the Audita/workspace features
are outside this implementation scope.
## Stage 1 — Add ReleaseKit and adopt the native runtime version
Status: completed. ReleaseKit v0.10.0 supplies runtime version information and
the registered tool. Verified `go test ./internal/app` and `go build ./cmd/narratio`
with Go 1.27.4; reviewed module selection and attribution.
Read `go.mod`, `go.sum`, `internal/app/commands.go`,
`internal/app/version_test.go`, `internal/buildinfo/buildinfo.go`, and
`docs/oss/attribution.md`. Consult upstream consumer adoption, runtime-version,
and v0.10.0 release guidance, plus its COPYRIGHT and LICENSE.
1. Register the released tool with
`go get -tool go.maximumdirect.net/releasekit/cmd/releasekit@v0.10.0`.
Keep one module selection shared by the tool and runtime import. Use the
selected official Go toolchain; do not add a local module replacement.
2. In `newApplication`, import
`go.maximumdirect.net/releasekit/buildinfo` and supply `buildinfo.Version()`
to `commandkit.Identity`. Keep existing CommandKit commands and presentation.
3. Remove `internal/buildinfo/buildinfo.go` once its callers are replaced.
Replace the version test's global assignment/restoration with an assertion
that Narratio's structured version output has name `narratio` and the value
returned by the native accessor. Retain the invalid-argument test. Native
builder verification in Stage 7 covers injected release identifiers.
4. Run `go mod tidy` after the imports and tool directive are in place. Retain
dependency changes required by module selection and review any collateral
changes. Do not opportunistically upgrade the other native libraries.
5. Add a ReleaseKit attribution entry for v0.10.0 at the pinned full upstream
commit, preserving its copyright statement and LGPL-3.0-or-later expression.
Reuse the existing LGPL and GPL standard texts. Review relevant transitive
notice changes based on actual incorporation/distribution; membership in a
tool's module graph alone does not require attributing every tool dependency.
Stage 6 finalizes the copied-wiring scope after those files exist.
Validation: inspect the module diff and registered tool declaration. Run
`go test ./internal/app` and `go build ./cmd/narratio`. Existing script tests
and scripts still refer to the old linker variable until Stage 5; do not add a
version compatibility shim to accommodate them.
Completion: the application reads its version from ReleaseKit, and the released
CLI tool is retained by the module metadata.
## Stage 2 — Define the profile and minimal native launcher
Status: completed. Added the selected profile, host-target launcher, and dist
ignore rule. Shell syntax and normal and cross-target launcher invocations
passed; both reported ReleaseKit v0.10.0.
Read the roadmap's release selections, upstream adoption and profile references,
and `.gitignore`.
1. Create root `releasekit.json` with this complete initial selection:
```json
{
"product": "Narratio",
"remote": "origin",
"validation": {
"go": {
"race": true,
"full_vet": true
},
"go_format": true,
"module_distribution": {
"local_replacements": true
}
},
"build": {
"main_package": "./cmd/narratio",
"binary_name": "narratio",
"targets": ["linux/amd64", "linux/arm64", "darwin/arm64"]
},
"delivery": {
"forge": "gitea",
"base_url": "https://forge.maximumdirect.net",
"owner": "eric",
"repository": "narratio",
"token_env": "RELEASEKIT_GITEA_TOKEN"
}
}
```
Omit `module_dir` for the root module. Omit additional `checks`,
`expected_push_url`, `compile_targets`, workspace/file-size/Markdown checks,
token files, and other optional selections. The Git destination documented
by the runbook is the existing `origin` URL, not an extra profile guard.
2. Add an executable root `releasekit` file using the short forwarding launcher
from upstream adoption guidance: POSIX shell, native `GOHOSTOS`/`GOHOSTARCH`
selection, and a direct `exec` of the full registered tool package with
`"$@"`. Maintainers invoke it from the repository root. Preserve the native
exit status and argument forwarding.
3. Keep the launcher confined to tool invocation. Profile interpretation,
dependency preparation, validation, tag logic, records, and recovery use
native commands. Retain upstream environment and toolchain behavior.
4. Add `/dist/` to `.gitignore` for the native builder's default retained output.
Private publication records already live under Git's own directory. No local
delivery-token file or new credential-storage convention is needed.
Validation: run `sh -n ./releasekit` and `./releasekit version` after tool
dependency preparation. Confirm the selected tool reports v0.10.0. Also invoke
the launcher with an ambient cross target, such as
`GOOS=windows GOARCH=amd64 ./releasekit version`, to verify host selection; this
is a tool-launch check, not a change to supported Narratio platforms. Native
profile consumption is exercised by Stage 7.
Completion: profile selections are declarative and maintainers have a direct
entry point for native subcommands.
## Stage 3 — Adopt the upstream Woodpecker delivery workflow
Status: completed. Adopted the v0.10.0 root-module template with the existing
secret mapping and source comment. Compared it directly with the pinned template;
live CI and the obsolete workflow tests were not run at this boundary.
Read `.woodpecker/release.yml`, the v0.10.0 root-module tag-delivery template,
and the upstream delivery guide's Woodpecker section.
1. Replace `.woodpecker/release.yml` with the matching upstream template.
Keep its native matrix/list structure and `golang:1.27.4-bookworm` selection.
Adapt only Narratio-specific wiring and a concise source-version comment.
2. Map `RELEASEKIT_GITEA_TOKEN` from the existing `GITEA_RELEASE_TOKEN`
Woodpecker secret. Retain the template's tag event/filter and native
bootstrap, including Woodpecker's escaped runtime substitutions.
3. Preserve template handling for annotated tag objects, event-commit agreement,
detached tagged source, temporary module metadata, the selected full tool
package, host target, `GOWORK=off`, `GOTOOLCHAIN=local`, and
`ci-deliver --prepared`. Keep the tagged module files unchanged during tool
bootstrap. Use the upstream wiring rather than rewriting its mechanics.
4. Remove the separate validation, custom asset-build, and plugin-release steps.
Native `ci-deliver` prepares dependencies and builds/delivers from the tag;
it does not rerun the candidate suite or publish source refs. Leave
`.woodpecker/verify.yml` and `.woodpecker/shuffle.yml` unchanged.
Validation: compare the result directly with the pinned upstream template;
review the image, secret mapping, runtime escaping, and tag inputs. Existing
doccheck tests are expected to reject the list-shaped workflow or old-step
removal until Stage 4. A live Woodpecker run is not a sprint prerequisite.
Completion: tag CI uses the tagged ReleaseKit selection for asynchronous native
delivery, independently of source publication.
## Stage 4 — Refocus tests on Narratio's selections and integration
Status: completed. Integration tests cover the profile and delivery selections;
workflow decoding accepts and exercises both supported step shapes. Verified
`go test ./internal/doccheck ./internal/app` with Go 1.27.4.
Read `internal/doccheck/doccheck_test.go`, especially the workflow types,
`TestWoodpeckerWorkflowDependencies`,
`TestVerifyWorkflowUsesFullSuiteWithoutFocusedDuplicates`, and
`TestReleaseWorkflowRequiresValidation`. Read the profile and delivery workflow
created in Stages 2–3.
1. Replace the obsolete release-workflow test with small tests of Narratio-owned
integration: product identity, selected checks, package/binary and target
mapping, Gitea destination, token variable, selected CI image, secret mapping,
and native tool/`ci-deliver` entry point. Decode selected JSON fields with
`encoding/json`; ReleaseKit retains ownership of full profile validation.
Avoid a duplicate local profile schema or whole-file golden snapshot.
2. Adapt the test-only workflow loader to accept both existing named mappings
and the template's named-step sequence. A small `UnmarshalYAML` on the steps
collection can normalize both shapes to the existing map for dependency
checks. Add the step name and environment/matrix fields only as needed by
these tests. Do not force the upstream template into the old representation
or build a general Woodpecker interpreter.
3. Preserve meaningful undefined-dependency/cycle checks and the existing
verification-workflow assertions. Add a small fixture for each supported
YAML steps shape so the new decoder's purpose is covered.
4. Verify Narratio's selected wiring, without pinning every bootstrap shell
command, ordering detail, or upstream diagnostic. Native bootstrap,
publication guards, checksums, and Gitea algorithms are tested upstream.
Do not invoke native `check` from the default Go suite: it would recursively
run that same suite. No live network or real credential enters these tests.
Validation: run `go test ./internal/doccheck ./internal/app`. Old
`internal/releasecheck` assertions remain obsolete until Stage 5.
Completion: tests accept the native workflow and protect the small local
integration surface without recreating ReleaseKit's suite.
## Stage 5 — Remove the superseded release implementation
Status: completed. Removed the four release scripts and their dedicated test
package; no active code or workflow callers remain. Verified focused app and
doccheck tests and `go build ./...` with Go 1.27.4. Current maintainer prose is
updated in the next stage.
Read all four scripts and `internal/releasecheck/` to identify references and
fixtures exclusively owned by that implementation. Search code through the
graph and non-code references with the usual text tools.
1. Delete `scripts/release.sh`, `scripts/check-release-candidate.sh`,
`scripts/build-release-assets.sh`, and `scripts/release-lib.sh`.
2. Delete `internal/releasecheck/assets_test.go` and
`internal/releasecheck/publication_test.go`, including their fake tools,
transport fixtures, and helpers. Remove any other discovered fixtures used
only by the deleted implementation. Preserve unrelated tests and files.
3. Remove remaining active callers and imports of the old buildinfo variable,
script paths, and custom linker injection. Retain the native launcher rather
than adding legacy command aliases or a Go release orchestration package.
Validation: run `go test ./internal/app ./internal/doccheck` and
`go build ./...`. Review code/workflow references for the removed symbols and
scripts. Historical release documents and roadmap baseline descriptions may
still mention old tooling; current maintainer prose is addressed next.
Completion: Narratio maintains selections and wiring rather than release
algorithms and their dedicated test harness.
## Stage 6 — Align the policy, runbook, and notices with native adoption
Status: completed. Updated the release runbook, local policy and developer/CLI
guidance, attribution, and superseded roadmap links. Verified doccheck and
reviewed the profile, launcher, upstream workflow, and pinned notices.
Read `docs/release.md`, `docs/policy/release.md`, `docs/development.md`,
`docs/oss/attribution.md`, and the documentation/OSS policies. Use the roadmap's
pinned upstream references for shared semantics.
1. Rewrite `docs/release.md` as the short Narratio maintainer runbook. Identify
the `main` branch, authoritative `origin` at
`ssh://git@forge.maximumdirect.net:22222/eric/narratio.git`, hosted destination,
Git/POSIX shell/native race-toolchain prerequisites, and selected Go 1.27.4.
Preserve the `release-toolchain` heading anchor or repair its incoming links.
2. Provide concise commands for toolchain/module preparation, candidate
commit/push, and `./releasekit publish VERSION`. Prepare modules and the
native tool before offline validation. State that the native tool uses the
module-selected ReleaseKit version. Show native `check` only as optional
diagnosis, never a prerequisite that repeats publication validation.
3. Keep version choice and compatibility defined by the adopted release
policy. Retain version-matched release-note preparation and its immutable
`COPYRIGHT | LICENSE | ATTRIBUTION` footer, using the Narratio paths at
`https://forge.maximumdirect.net/eric/narratio/src/tag/<version>/...` for
future notes. Summarize annotated-tag publication and separate CI delivery.
Identify the existing three binary filenames and `SHA256SUMS` locally.
4. Give short links/entry points for native saved-record reconciliation and
native delivery retries, including older-tag tooling selection. Use upstream
behavior for uncertain pushes, partial delivery, and content conflicts.
Source-release completion stays at confirmed tag publication. No CI polling,
live credential probe, download, installation check, or human confirmation
becomes an added publication gate.
5. Replace only the Narratio-specific candidate-check wording in
`docs/policy/release.md`: native race/full-vet/formatting/local-replacement
checks and selected builds replace the custom checker, tidy, and whitespace
gates. Keep shared upstream wording, compatibility, immutability, and other
established rules. Update local date metadata where appropriate without
inventing a new upstream adoption revision or upgrading the policy suite.
6. In `docs/development.md`, identify ReleaseKit with its version-appropriate
consumer link and replace the statement that tag CI independently repeats
candidate validation with its delivery responsibility. Keep ordinary push/PR
and scheduled test guidance. Inspect other current docs for affected build
version/release statements; repair real stale references without rewriting
historical notes or copying upstream CLI/configuration guides.
7. Finalize the ReleaseKit attribution entry for the runtime import and copied
launcher/workflow, using the full adopted commit and actual upstream notices.
Reuse unchanged local license texts; retain Narratio's license grant.
8. Update roadmap/plan completion status only to the implemented boundary.
Remove obsolete links in the completed ConfigKit roadmap that imply this
now-replaced plan still contains its stages, retaining its completion
summary. Preserve other pending roadmaps. A future release-preparation task
can retire completed documents; this sprint does not require their deletion.
Write concise, factual policy statements and use affirmative phrasing. General
ReleaseKit features remain documented upstream; the runbook owns Narratio's
configuration choices and commands.
Validation: run `go test ./internal/doccheck` and inspect the actual launcher,
profile, and workflow against every affected command/selection in the runbook.
Review attribution links and unchanged grant/license scope. Publication and CI
availability are not documentation checks.
Completion: current documentation describes the implemented native workflow,
with one canonical owner per topic and no obsolete script procedure.
## Stage 7 — Verify the completed native integration and close the sprint
Status: pending.
Read the completed changes and feature-roadmap completion criteria. Use
upstream candidate/build guides for their native preconditions.
1. Make the official Go 1.27.4 installation the active `go` command on PATH and
verify `go version`. Prepare dependencies and the tool separately. Run
`go mod tidy -diff` once as migration/module hygiene, not a new recurring
release gate. Confirm the registered ReleaseKit version and final module
metadata; review that required checks and targets match Stage 2.
2. After the implementation changes are committed, make a disposable clone of
that exact source under a task-specific `mktemp -d` directory outside this
worktree, without copying tags. In that clone only, use branch `main` and
create/commit a synthetic `docs/releases/v0.0.0.md` with title
`# Narratio v0.0.0`, an explicitly synthetic summary, and the footer shape
from the runbook. Confirm that version has no local tag. Keep synthetic
metadata and refs out of Narratio's real checkout and upstream.
3. In that clean disposable candidate, prepare modules/the tool and run
`./releasekit check v0.0.0`. Keep the production profile unchanged. This is
the full native integration verification: one race-enabled offline suite,
selected vet/format/distribution checks, all three release binaries, and
the real executable's injected-version smoke check. Inspect the result and
confirm it leaves the checkout clean and creates no tag. A check requires
neither Gitea credentials nor remote publication, so a live service is not
a fallback for a failing fixture.
4. Reuse that result for unchanged test/vet/build coverage rather than rerunning
the complete suite merely to satisfy another stage. Run `go build ./...` on
the final source if its Stage 5 result is no longer current. The fixture
verifies adoption; it is not evidence that a real future release candidate
has already passed its own publication-time validation.
5. Compare the final delivery YAML with the pinned template and confirm only
the documented consumer adaptations. Inspect executable mode and
`sh -n ./releasekit`. Default tests and direct review cover local wiring;
upstream tests cover generic tag bootstrap and hosted protocols. A live CI
run, live delivery, and a real tag push are not required for sprint closure.
6. Confirm all four scripts, the dedicated script-test package, old buildinfo
package, and active current-doc references are removed. Check that the
remaining release code is the small launcher plus native version integration
and test-only consumer wiring. Preserve historical material and useful
unrelated tests. Avoid an artificial LOC threshold or broad cleanup.
7. Review the final diff for unintended application/platform/Go-minimum changes
and additional gates. Run whitespace checks, update stage outcomes and
roadmap status accurately, and commit the focused remaining work. Report
tests, source revision, removals, and any external delivery not exercised.
Completion: all feature-roadmap criteria are satisfied, native integration has
passed on a committed disposable candidate, and the repository is clean and
ready for a separately authorized release sequence.
## Open Questions
None. The feature roadmap resolves the significant product and policy choices.
Upstream mechanics retain their native semantics; no new local release contract
or external service availability is required to complete this sprint.