diff --git a/docs/roadmap/releasekit.md b/docs/roadmap/releasekit.md new file mode 100644 index 0000000..7366ccc --- /dev/null +++ b/docs/roadmap/releasekit.md @@ -0,0 +1,260 @@ +# Adopt ReleaseKit's native release workflow + +Status: proposed. + +## Goal + +Delegate release validation, source publication, binary construction, and hosted +delivery to ReleaseKit. Minimize Narratio-owned release code and document a +ReleaseKit-native maintainer workflow. + +Narratio owns its release selections: product identity, source remote, build +targets, hosted destination, selected checks, release-note content, and selected +Go toolchain. ReleaseKit owns the release mechanics and their semantics. Local +documentation explains Narratio's selections and links to canonical upstream +guidance for shared behavior. + +This document defines the desired end state and required changes. A staged +implementation plan will be prepared separately. This roadmap does not authorize +publishing a release. + +## Reviewed Baseline + +Narratio was reviewed at commit +`abaa3c78df38c37c8f461a7d218f9fc6d99bf8bd`. Its release tooling consists of: + +- `scripts/release.sh`: candidate and remote guards, validation, lightweight tag + creation, and tag publication. +- `scripts/check-release-candidate.sh`: release-note and module checks, module + hygiene, formatting and whitespace checks, tests, vet, and release builds. +- `scripts/build-release-assets.sh` and `scripts/release-lib.sh`: binary builds, + custom version injection and verification, and shared shell helpers. +- `internal/releasecheck/`: tests and fixtures for those scripts. +- `internal/buildinfo/buildinfo.go`: a mutable version variable populated by + Narratio-specific linker flags and supplied to CommandKit's identity. +- `.woodpecker/release.yml`: candidate validation, asset construction, and Gitea + delivery through the release plugin. +- `internal/doccheck/doccheck_test.go`: documentation and workflow checks, + including assertions requiring the current release workflow's structure. + +The four scripts total 304 lines; their dedicated tests total 741 lines. These +figures identify the removable maintenance surface, rather than a required LOC +reduction target. + +The current consumer minimum is Go 1.27.0 and the selected release toolchain is +Go 1.27.4. The existing [release procedure](../release.md) and +[release policy](../policy/release.md) remain authoritative until implementation. + +## Upstream Selection + +Adopt `go.maximumdirect.net/releasekit` v0.10.0, at commit +`82bac1a3ab935beddd4b8789d1e07f52135d4243`. The upstream tag was confirmed to +identify this source revision. Its Go 1.27.0 minimum fits Narratio's baseline. + +Canonical upstream references for this adoption are: + +- [Consumer adoption](https://forge.maximumdirect.net/base-layer/releasekit/src/tag/v0.10.0/docs/consumers/adoption.md). +- [Profile configuration](https://forge.maximumdirect.net/base-layer/releasekit/src/tag/v0.10.0/docs/config.md) + and [CLI contract](https://forge.maximumdirect.net/base-layer/releasekit/src/tag/v0.10.0/docs/cli.md). +- [Candidate checks](https://forge.maximumdirect.net/base-layer/releasekit/src/tag/v0.10.0/docs/consumers/check.md) + and [source publication](https://forge.maximumdirect.net/base-layer/releasekit/src/tag/v0.10.0/docs/consumers/publish.md). +- [Binary builds](https://forge.maximumdirect.net/base-layer/releasekit/src/tag/v0.10.0/docs/consumers/build.md) + and [runtime version](https://forge.maximumdirect.net/base-layer/releasekit/src/tag/v0.10.0/docs/consumers/runtime-version.md). +- [Tagged-source delivery](https://forge.maximumdirect.net/base-layer/releasekit/src/tag/v0.10.0/docs/consumers/delivery.md) + and the maintained [Woodpecker template](https://forge.maximumdirect.net/base-layer/releasekit/src/tag/v0.10.0/examples/woodpecker/tag-delivery.yml). + +Use the released dependency and matching template together. Subsequent upgrades +review both the selected module and any locally copied upstream wiring. + +## Targeted End State + +### Native dependency and command boundary + +Register `go.maximumdirect.net/releasekit/cmd/releasekit` as a Go tool dependency +and use the same selected module for the runtime `buildinfo` import. Commit the +resolved `go.mod` and `go.sum`. Review dependency selection changes without +coupling this adoption to unrelated upgrades. + +Provide a small repository-root `releasekit` launcher based on the upstream +consumer example. It selects the Go host target and forwards arguments to the +full registered tool package. Maintainers invoke it from the repository root. +Release operations remain native subcommands, such as +`./releasekit publish vMAJOR.MINOR.PATCH`; the launcher contains only invocation +wiring. + +### Declarative release selections + +A root `releasekit.json` is the release profile. Its selections are: + +| Concern | Narratio selection | +| --- | --- | +| Product | `Narratio` | +| Module | Root module; retain the current module path | +| Branch and remote | Native `main` workflow and `origin` | +| Authoritative Git destination | `ssh://git@forge.maximumdirect.net:22222/eric/narratio.git` | +| Main package and binary | `./cmd/narratio`, `narratio` | +| Build targets | `linux/amd64`, `linux/arm64`, `darwin/arm64` | +| Go validation | `validation.go.race: true`, `validation.go.full_vet: true` | +| Formatting | `validation.go_format: true` | +| Module distribution | `validation.module_distribution.local_replacements: true` | +| Hosted delivery | Gitea at `https://forge.maximumdirect.net`, owner `eric`, repository `narratio` | +| Delivery credential | `RELEASEKIT_GITEA_TOKEN` supplied by CI | + +Retain Linux as the primary platform and macOS arm64 as best-effort support. +Cross-compilation continues to establish compilation rather than native runtime +coverage. Keep Go 1.27.0 as the consumer minimum and Go 1.27.4 as the selected +release toolchain. + +The selected binary builds supply target verification, so a second +`validation.go.compile_targets` pass is unnecessary. Existing default-suite +documentation and example tests continue to run through the native full suite; +an additional ReleaseKit Markdown pass is unnecessary for this adoption. + +Use the native remote selection without an additional exact-push-URL gate. +Workspace-file bans, file-size limits, token-file validation, and other optional +checks remain unselected. Existing workspace and vendor acceptance remains +unchanged. + +Retire the custom tidy and whitespace release gates, fixed module-path check, +and exact release-note first-line check. Native readonly validation and +release-note validation provide the adopted behavior. Module preparation and +ordinary source hygiene remain normal development work. The profile initially +needs no product-specific `checks` commands. + +### Source release lifecycle + +Preparation retains version selection, a checked-in +`docs/releases/.md` note with Narratio's licensing footer, ordinary +change review, and retirement of completed roadmap work. The maintainer commits +and pushes the candidate to `origin/main` before invoking native `publish`. + +ReleaseKit validates that candidate, verifies the selected builds, creates an +annotated tag, and publishes the exact tag. Adopt its native release-note, +guard, diagnostic, exit-status, publication-evidence, and recovery behavior. +Annotated tags replace lightweight tags for future releases; historical tags +and published contents remain unchanged. + +Confirmed source-tag publication completes the release command. CI status, +download availability, and consumer installation remain separate from that +completion point. Native bounded reconciliation handles ambiguous push results; +the runbook links to upstream recovery guidance and identifies its entry point. +ReleaseKit's private publication records retain their native location and +handling, without a Narratio-specific record format or retention service. + +Native `check` remains an optional diagnostic command. Routine publication +performs its own validation once. Dependency and toolchain preparation occurs +before offline validation, following the upstream workflow. + +### Runtime version + +Supply `go.maximumdirect.net/releasekit/buildinfo.Version()` directly to +CommandKit's Narratio identity. Remove `internal/buildinfo` and the custom +linker-variable convention. Adopt upstream version discovery, including the +main-module version fallback for ordinary installed binaries and `dev` for +development builds without release metadata. + +Keep Narratio's existing CommandKit version command and presentation. Adapt its +tests to the native accessor and integration boundary instead of mutating a +Narratio-owned global. ReleaseKit's builder supplies release-version injection +and the native binary version smoke check. + +### Asynchronous hosted delivery + +Replace the current release-plugin pipeline with the maintained root-module +Woodpecker tag-delivery template, customized for Narratio's selected Go image, +profile, and credential wiring. Map the existing `GITEA_RELEASE_TOKEN` repository +secret to the native `RELEASEKIT_GITEA_TOKEN` environment variable; this migration +does not require operators to rename that stored secret. + +The tagged module selects the ReleaseKit version used for delivery. Native +`ci-deliver` verifies tagged source, prepares dependencies, builds the selected +targets, and delivers the checked-in note and assets. Tag CI becomes a delivery +workflow; the separate push/PR and scheduled verification workflows retain their +existing responsibilities. + +Preserve the three `narratio---` binary names and +`SHA256SUMS`. Adopt native immutable page/asset comparison, conflict reporting, +and retry behavior. Hosted delivery has its own status and can be retried from +the same tagged source. Older releases retain their original tooling and +workflow; this cutover does not retrofit them. + +## Required Changes + +### Implementation and removal + +- Add the tool registration, runtime dependency, root profile, and forwarding + launcher; update the CommandKit identity to use the native version accessor. +- Replace `.woodpecker/release.yml` with the matching native delivery wiring. + Keep the selected CI toolchain aligned with the maintainer runbook. +- Delete all four superseded release scripts and `internal/releasecheck/`. + Remove obsolete fixtures, helpers, and assertions that only exercised those + scripts. Remove `internal/buildinfo` after replacing its callers. +- Replace `TestReleaseWorkflowRequiresValidation` with proportionate checks of + Narratio's actual profile and delivery wiring. Adapt shared workflow parsing + where needed to accept the upstream template's native YAML shape. Retain + useful general documentation and workflow-dependency checks. +- Keep local tests focused on Narratio-owned selections and version integration. + Generic Git publication, checksum, recovery, and Gitea delivery algorithms + retain their upstream test owner. + +### Policy and documentation + +Rewrite `docs/release.md` as a concise ReleaseKit-native runbook. Keep Narratio's +versioning rules, product selections, preparation commands, canonical source and +hosted destinations, licensing-footer URLs, selected toolchain, native +publication command, and separately identified delivery workflow locally. +Provide short navigation to native checks, delivery retries, and publication +recovery. Link upstream for their full behavior and configuration contracts. + +Revise the Narratio-specific candidate-check section in `docs/policy/release.md` +to reflect the selected native checks and removal of custom gates. Preserve the +adopted compatibility, immutability, and successful-publication completion +policy. Keep the upstream policy language unchanged except for necessary local +adaptations. This work does not include a general policy-set upgrade. + +Update `docs/development.md` to identify ReleaseKit, link its version-appropriate +consumer documentation, and describe tag CI as delivery. Update any affected +current version/build or release guidance and repair references to deleted +scripts. Historical release notes remain historical records. + +Add ReleaseKit's commit-pinned LGPL-3.0-or-later attribution for incorporated +runtime code and copied wiring under the [OSS policy](../policy/oss.md). +Review applicable transitive and copied-material notices, reuse the existing +standard license texts where appropriate, and keep Narratio's grant unchanged. + +### Verification and migration boundaries + +Verify native tool registration, profile loading, the existing target/name +mapping, and CommandKit version output. Exercise the native builder against +Narratio to establish that injected release versions reach the real executable. +Use a disposable local Git fixture when publication wiring needs verification; +real publication and live Gitea delivery are outside the default offline suite. + +Run the relevant tests and builds, then use a prepared clean candidate or +disposable committed checkout to verify native candidate checks. Prepare +dependencies separately. Avoid introducing a second permanent release suite or +testing upstream implementation details locally. Any live delivery smoke check +is explicitly optional and separate from source-release completion. + +Keep application pipeline configuration, session data, stage execution, and the +pending Audita/workspace roadmaps outside this scope. The migration is a direct +cutover for future releases; legacy script aliases and compatibility shims add +no value to the selected target. + +## Completion Criteria + +- ReleaseKit's registered tool, declarative profile, and native runtime accessor + replace Narratio's release algorithms and custom version injection. +- Native publication validates once and finishes at confirmed tag publication, + independently of CI or hosted delivery availability. +- Native tag delivery produces the existing binary and checksum set using the + ReleaseKit version selected by the tagged module. +- Superseded scripts, dedicated script tests, and old-workflow assertions are + removed. Remaining tests cover Narratio's integration and selections. +- Policy, runbook, contributor guidance, and attribution agree with the + implemented native workflow and link upstream for shared semantics. +- Existing releases, application behavior, platform support, and consumer Go + minimum retain their established scope. + +The agreed native-adoption direction resolves the significant choices for this +roadmap. No additional operator decision or upstream feature is required.