diff --git a/docs/roadmap/implementation.md b/docs/roadmap/implementation.md deleted file mode 100644 index b7a8126..0000000 --- a/docs/roadmap/implementation.md +++ /dev/null @@ -1,842 +0,0 @@ -# Next release implementation plan - -## Purpose and execution - -Implement the settled target in [the feature roadmap](next-release.md), including -explicit local/CI credentials, readiness validation, the actual Woodpecker -delivery rehearsal, and general source releases with calendar versions. -[ADR 0007](../adr/0007-general-source-release-identity.md) and -[ADR 0008](../adr/0008-woodpecker-rehearsal-lifecycle.md) record the architectural -decisions. The implementation baseline is v0.10.0; the subsequent commits contain -planning documents. The next release number remains unassigned. - -Follow Stage 1 through Stage 15 in order. Each stage is a bounded implementation -unit for a Luna agent. Record completion and useful verification evidence in -this document. Follow the repository's normal commit discipline. Stages belong -to one sprint and may leave temporary compilation failures while interfaces -are being changed. Complete the integrated implementation before assessing -release readiness. These stages introduce no pilot releases, external actions, -or intermediate human-review gates. - -Implementation and regression verification use the current source and local -fixtures. No stage depends on an already-published ReleaseKit version containing -these features. Example pins follow Stage 8's pre-release convention; selecting -and publishing the next ReleaseKit release remains subsequent release work. - -Read [development guidance](../development.md) and the applicable policies. -Preserve the root orchestration facade, the lightweight `buildinfo` facade, -neutral forge contracts, and CLI ownership of credential loading. Public types -belong to the root facade; implementation types and external service clients -remain internal. Use existing Git, process, artifact, delivery, and Go-tool -boundaries. Package and private-helper names below describe responsibility; -ordinary internal naming can follow the implementation. - -The decisions below finalize interface and encoding details left by the feature -roadmap. They preserve the selected product scope. Automatic version selection, -general non-Go builds, new YAML/JSON validators, secret registration, and CI -cancellation remain separate work. ReleaseKit's own release policy and ordinary -source-publication completion point continue to apply. - -## Stage 1: Normalize source, Go, and publication selection - -**Completed:** Profile and facade selection now preserve legacy module defaults, -normalize explicit selections, resolve physical working or committed directories, -and load Go declarations only when selected. Targeted identity, candidate, profile, -and facade mapping tests pass, as does the compiled API/dependency check. General -source identity and the corresponding operation behavior follow in the next stages. - -**Work:** refactor profile loading in `cmd/releasekit/internal/cli/config.go` and -introduce the shared internal selection model in `internal/releaseidentity`. - -1. Adopt these profile fields: - - | Field | Meaning | - | --- | --- | - | `source.dir` | Repository-relative physical source directory, default `.`. When Go is selected, this is the selected module directory and its resolved location determines source scope. | - | `source.tag_prefix` | Optional product prefix for general source tags. Omission derives it from the source directory; an explicit empty string selects unprefixed tags. | - | `go` | A non-null object selects Go module validation/build capabilities. Its initial shape is `{}`; suite options remain in `validation.go`. Omission or `null` in the explicit model selects no Go capability. | - | `publication.mode` | `source` or `go-module`. Default `source` in the explicit model. `go-module` requires Go capability. | - | `version.format` | `semver`, `date`, or `year-month`; default `semver`. | - | `version.prefix` | `"v"` or `""`; default `"v"` for SemVer and `""` for calendar formats. An explicit empty value is significant. | - -2. Preserve the existing module shorthand: a profile containing no non-null - `source`, `go`, `publication`, or `version` object uses the current - `module_dir` selection, Go capability, Go module publication, and stable - prefixed SemVer. Null selection objects count as omitted; `source: {}` - explicitly selects a source-only root release. - The absence of a root `go.mod` does not silently change that interpretation. - In the explicit model, an omitted `source.dir` can take its directory from - `module_dir`. If both are supplied, they must name the same normalized - directory; conflicting directories produce an actionable selection error. - Consumers need maintain only one directory. -3. Normalize selection once per operation. Separate selection/configuration - checks from reading a working or committed module declaration. A source-only - selection requires a Git source directory but no `go.mod`. A Go selection - reads that directory's declaration and retains its physical location and - declared import path as distinct values. -4. Add a facade-owned `SourceSpec` with `Dir`, `GoEnabled`, `Publication`, - `VersionFormat`, optional `VersionPrefix`, and optional `TagPrefix`. Add an - optional `Source *SourceSpec` to `ReleaseRequest`, `BuildRequest`, and - `DeliveryRequest`. A nil pointer retains the existing `ModuleDir` shorthand; - a non-nil value selects the explicit model. An omitted `Dir` can take the - shorthand directory; matching directories are accepted and conflicting - selections fail. Use facade-owned string enums for publication modes and - version formats. The explicit zero spec means a root source release with - SemVer defaults and no Go capability. -5. Keep strict JSON decoding. Report obsolete flat credential fields specially - in Stage 6. Preserve operation-scoped delivery requirements: a source check - or publication does not need hosted credentials. -6. Update ADR 0007's status to reflect adoption of this plan and mark ADR 0005 - partially superseded as described there. Update current references only as - the corresponding behavior lands. - -**Coverage:** legacy root/nested module profiles; explicit source-only, Go -application, and Go module profiles; omission versus explicit values; consistent -and conflicting directory selections; no implicit module publication from -`go: {}`. Parser tests own configuration mapping and domain tests own selection. - -## Stage 2: Resolve complete production and diagnostic identities - -**Completed:** Production identities retain normalized source and module -selection, exact identifier, tag, note path, and captured commit. Diagnostic -identities use independent random attempts, tags, versions, and notes. Domain -tests cover the selected version grammars, source and module tag rules, and -diagnostic construction; candidate builds receive the captured identity. The -offline `go test ./...` suite and `go run ./internal/apicheck` pass. - -**Work:** refactor `internal/versioncontract` and `internal/releaseidentity`. - -1. Validate caller-supplied production identifiers against these exact grammars - after removing the configured prefix, which must match exactly: - - | Format | Grammar and validation | - | --- | --- | - | `semver` | `MAJOR.MINOR.PATCH`; ASCII decimal components, no leading zeroes except `0`, stable versions only. | - | `date` | `YYYY-MM-DD` or `YYYY-MM-DD.R`; four-digit year `0001`–`9999`, two-digit month/day, valid Gregorian date, positive revision without leading zeroes. The first spelling has no suffix; `.0` is invalid. | - | `year-month` | `YYYY.MM.R`; the same year range, two-digit month `01`–`12`, required nonnegative revision, no revision leading zeroes except `0`. | - - Preserve numeric component strings without imposing machine-integer limits - on revisions. Accept dates independently of today's date. Do not increment, - sort, or canonicalize a caller's identifier into a different spelling. -2. Go module publication selects prefixed stable SemVer and existing import-path - major compatibility and tag rules. General source releases select their - grammar independently of an optional Go module's major version. A valid - selected Go declaration remains required for Go work. -3. General source tags are `/`, omitting the slash when the - prefix is empty. The default prefix is the normalized physical source - directory, with root represented by an empty prefix. Preserve a physical - `/vN` component. Go module publication retains the existing declared-major - directory rule. A source-product prefix override applies to `source` mode; - report an incompatible override in `go-module` mode rather than silently - publishing a non-module tag. Validate complete refs with Git's rules. -4. Production notes use `/docs/releases/.md` and retain the - existing exact product/version title matching. Existing file/path rules - remain in force. The selected grammars produce literal filename components. -5. Introduce one internal resolved identity containing kind, repository root, - source directory/subdirectory, optional Go module identity, publication mode, - version format/prefix, exact identifier, full tag, note path, and captured - commit when available. Preserve working-tree versus committed declaration - semantics. Pass this value through resolved operations instead of deriving - it again in each package. -6. Define diagnostic kind separately: attempt ID is 16 cryptographically random - bytes encoded as 32 lowercase hexadecimal characters; tag is - `releasekit-test//`; injected diagnostic version is - `releasekit-test-`. The selector is one valid Git ref component. - Diagnostic construction retains source and optional Go selection but - supplies its own version and note. It consumes no production version and - makes no Go module publication claim. Production paths continue validating - their own selected grammars. - -**Coverage:** date/leap-year boundaries, padding, revisions, prefixes, unchanged -SemVer behavior, nested and physical-major source tags, product overrides, -unsuffixed Go applications releasing `v2.0.0` or a date, and Go module major -compatibility. Test diagnostic construction through its supported domain seam. - -## Stage 3: Generalize committed candidate and publication checks - -**Completed:** Candidate checking and publication use the captured source -identity, run Go execution checks only when selected, retain source-scoped file -checks, and pass source context to product commands. A temporary source-only -repository was checked and published to a local Git remote with Go unavailable; -targeted tests, the offline `go test ./...` suite, and `go run ./internal/apicheck` -pass. - -**Work:** adapt `internal/candidate`, `internal/validation`, `internal/publish`, -the `Check`/`Publish` facade bridge, and configured child checks. - -1. Capture the committed source identity once and carry it through validation, - callbacks, post-validation checks, exact annotated-tag creation, push, and - publication evidence. Preserve repository-wide branch, cleanliness, - authoritative `main`, exact candidate, unused tag, and uncertain-push guards. -2. Run the standard offline Go suite, selected vet, and package compilation - only when Go capability is selected. An explicitly enabled Go execution - check without that capability is a configuration error. A nonempty build - target selection also requires Go capability. Empty target selections do - no binary work. -3. Retain selected file checks and custom commands for both source kinds. Go - selections retain independent nested-module input boundaries. Source-only - selections inspect committed descendants of their selected source scope; - a `go.mod` encountered as data does not itself create a new release boundary. - Preserve shared-file omission/empty/explicit semantics, reference resolution, - and repository-wide forbidden-file scope. Text/file checks such as formatting - or declaration inspection remain usable when explicitly selected without - executing the Go toolchain. -4. Execute configured product commands from the source directory. Add - `RELEASEKIT_SOURCE_DIR` to their context. Populate existing Go module context - values for Go selections and provide empty module values for source-only - selections. Continue setting version, tag, candidate, and repository values - per child without changing the process environment. -5. Extend facade candidates and results with source and selection evidence; - retain existing version/tag/commit and module fields, populated from the - resolved identity. Empty module fields express source-only releases. - -**Coverage:** a real temporary configuration repository without `go.mod` through -`Check` and `Publish`, scoped Markdown/shared/forbidden-file checks, custom check -working directory/environment, and unchanged exact-object publication/recovery -behavior. Reuse existing publication failure fixtures. - -## Stage 4: Carry general identity through builds and hosted delivery - -**Completed:** Builds and delivery use the selected production identity, -including source-only pages, calendar identifiers, and prebuilt selection -binding. Tagged preparation accepts complete valid tags, and CLI launcher -expectations compare the selected source directory. Focused build, delivery, -tag-preparation, and CI mapping tests pass, as do `go test ./...` and -`go run ./internal/apicheck`. Receipt format migration follows in Stage 5. - -**Work:** adapt `internal/build`, `internal/artifact`, `internal/delivery`, -`internal/preparation`, and facade conversions. - -1. Use the resolved identity for builds, runtime injection, filenames, tagged - checkout verification, page titles/bodies, manifests, and prebuilt binding. - Preserve `Build`'s working-tree semantics and delivery's committed source - semantics. Audit suffix splitting and numeric-triple assumptions. -2. Support Go application source releases whose product version differs from - the module import-path major. Retain static pure-Go builds, host-native - smoke checks, and the lightweight `buildinfo` dependency boundary. -3. Support page-only delivery with no Go declaration or compiler. Select its - committed source note and literal full tag through the same identity model. - Preserve automatic read-only preflight, local verification before hosted - writes, additive retries, immutable production contents, and outcome classes. -4. Make tagged preparation accept a valid full ref and expected commit without - assuming its final component is SemVer. After checkout and profile loading, - resolve the production identity and compare its complete tag. Diagnostic - dispatch performs Stage 9's manifest checks instead. Application dependency - preparation runs only for selected binary targets. -5. Add `--expected-source DIR` to publication/CI invocation mapping. Retain - `--expected-module DIR` for module-backed launchers; apply either comparison - to the normalized selected directory and report conflicting expectations. - Delay production-version validation until the profile's format is known. - -**Coverage:** calendar-version build-and-run injection and asset names, page-only -source delivery, module-specific prebuilt rejection, full source-tag matching, -and existing cancellation, cleanup, partial-upload, and immutable-retry tests. - -## Stage 5: Update identity evidence and publication recovery - -**Completed:** Publication records write format 3 and retain legacy readers; -build receipts carry and bind the complete selected identity. Source-only -recovery works after the publishing process exits. Calendar and diagnostic -receipts, exact evidence bytes, recovery, the offline `go test ./...` suite, -and `go run ./internal/apicheck` pass. The committed-pin bootstrap is implemented -in Stage 8. - -**Work:** update facade evidence, CLI receipts, publication codecs, recovery -handoffs, and their integration references. - -1. Write publication record format 3. Retain the current evidence envelope and - flat fields; add source directory/subdirectory, Go capability, publication - mode, version format/prefix, identity kind, and note path. Module fields may - be absent. Retain optional `evidence_bytes` overrides for exact non-UTF-8 - string bytes using the existing codec's rules. -2. Continue reading formats 1 and 2 for existing publication recovery. Their - legacy evidence remains partial when fields were not captured. Recovery - observes the recorded endpoint/ref/object without applying current profile, - calendar, or module validation. Preserve redaction and typed decoding causes. -3. Write build receipt schema 2 with the full source/production-or-diagnostic - identity and existing compiler/target/artifact evidence. Read schema 2; - identify older receipts with a clear instruction to rebuild. Bind prebuilt - delivery to the captured commit, source selection, kind, identifier, and tag. -4. Existing recovery JSON schema 1 can gain additive source evidence fields; - keep its established state/diagnostic interpretation. New command schemas - defined below start at version 1. Bump a format when interpretation changes, - rather than rejecting harmless unknown additive fields in a supported - evidence version. -5. Preserve module-selected recovery entry points for Go consumers. Source-only - recovery uses the selected installed tool and committed pin from Stage 8, - with a durable handoff after the original launcher exits. Recording or - handoff warnings continue to leave source-publication status unchanged. - -**Coverage:** new source and calendar evidence round trips, exact byte retention, -legacy partial-record reconciliation, stale receipts, and source-only recovery -after the launcher has exited. Use isolated synthetic module caches. - -## Stage 6: Select local and CI credentials explicitly - -**Completed:** Local delivery reads its declared token file and CI delivery -reads its declared environment variable without cross-context fallback. Legacy -flat settings receive migration guidance, and maintained profiles and workflows -use the new declarations. Context selection, missing credentials, tagged CI -workflow fixtures, the offline `go test ./...` suite, and -`go run ./internal/apicheck` pass. - -**Work:** replace flat delivery credential configuration and share CLI loading. - -1. Adopt `delivery.credentials.local.token_file` and - `delivery.credentials.ci.token_environment_variable`. The latter defaults to - `RELEASEKIT_DELIVERY_TOKEN` when the CI credential declaration is present but - its name is omitted. A local declaration requires a nonblank file path. - Require only the selected context's declaration when its operation runs. -2. Ordinary `deliver` uses local context; `ci-deliver` uses CI context. - `validate` selects context explicitly as specified in Stage 7. The rehearsal - coordinator uses local context and its job uses CI context. Ambient values - never switch contexts, override a local file, or provide fallback credentials. -3. Share one CLI resolver returning the token and safe source/context metadata. - Preserve root-relative/absolute paths and trimming. Missing, unreadable, or - blank selected files and unset/blank selected CI variables are errors. - Pass tokens explicitly to library requests and exclude them from diagnostics, - reports, records, and result markers. -4. Detect `delivery.token_file` and `delivery.token_env` with an actionable error - showing their new locations. Do not retain environment-over-file selection. - An explicitly named `RELEASEKIT_GITEA_TOKEN` remains valid in the new CI field. -5. Migrate the repository profile and maintained profiles/templates together. - Keep the existing stored-secret name usable, and comment the distinction - between a Woodpecker stored secret and its injected job variable. Document - ignore rules and the optional `forbidden_files` check together. - -**Coverage:** conflicting workstation variables, unavailable local file with a -valid ambient token, CI delivery with no local file, context-specific errors, -legacy migration errors, retained CI variable names, and secret-safe diagnostics. - -## Stage 7: Implement readiness validation and its CLI - -**Completed:** The facade and `validate` command inspect working selections, -optional inputs, Go/build setup, credential contexts, retained artifacts, and -read-only publication/delivery access. Reports aggregate failures and identify -offline or unexecuted evidence. Focused CLI and facade tests, the offline -`go test ./...` suite, and `go run ./internal/apicheck` pass. Rehearsal profile -loading and Woodpecker observation are connected in the following stages. - -**Work:** add internal readiness orchestration, a root `Validate` operation, -facade-owned request/report types, and `releasekit validate`. - -1. Adopt this CLI shape; options precede positional arguments as elsewhere: - - ```text - releasekit validate [--repo DIR] [--config FILE] [--context local|ci] - [--operation NAME ...] [--offline] [--assets DIR] [--json] - ``` - - There is no version argument. Context defaults to `local`. Operation names - are `publication`, `go`, `build`, `delivery`, and `rehearsal`. Repeated - `--operation` flags replace defaults with their deduplicated selection. - Defaults select publication, Go when enabled, build when targets exist, and - delivery when declared. Rehearsal is explicit. An explicitly selected - capability that the profile does not declare produces a configuration finding. -2. Inspect current working configuration and inputs. Report this source before - results. Check normalized source selection, relevant readable declarations, - build settings/main-package inputs, Go tool availability and declared minimum - when Go work is selected, destination settings, and selected credentials. - Generated build outputs need not exist. `--assets` explicitly selects an - existing receipt/artifact set for identity/size/digest verification and - requires delivery selection. Inspect its captured identity without requiring - a new version-matched note. -3. Support optional `readiness.required_files`, a list of literal root-relative - or absolute input files whose readability the operator deliberately selects, - for example a specifically required SSH key. This is diagnostic input, not - Git authentication configuration. Ordinary Git checks use native Git/SSH, - agents, hardware-backed keys, and custom commands. Do not infer mandatory - private-key files from conventional filenames or optional SSH identities. -4. Online is the default. For publication, resolve and compare any expected - push URL and perform a native read of authoritative `main` at that effective - endpoint. Local readiness also checks the Git identity needed for annotated - tag creation, including in offline mode. Report read-access evidence without - claiming write permission or requiring a final `main` candidate. Delivery uses - `PreflightDelivery`. Rehearsal includes publication/delivery prerequisites - and Stage 10's Woodpecker read access. Offline omits these requests explicitly; - context remains independent of network scope. -5. Validate declarations for the other credential context without reading its - unavailable runtime secrets. In local rehearsal readiness, report actual - job-secret injection as unchecked; the job/rehearsal supplies that evidence. - Delivery readiness alone has no Woodpecker credential requirement. -6. `ValidateRequest` carries resolved product selection, selected operations, - context and safe credential-source descriptions, explicit destination tokens, - Woodpecker observation settings when selected, offline selection, required - files, optional prebuilt inputs, and output. - File/environment token loading stays in the CLI. `Validate` runs neither - candidate checks nor custom product commands, builds, dependency downloads, - checkout changes, or remote writes. Report dependency-cache/build execution - evidence as unchecked rather than promising a future offline build. -7. `ValidationReport` identifies operations, context, working-input source, - destinations, credential-source descriptions, and ordered check results. - Each result has a stable check identifier, operation, status (`passed`, - `failed`, `skipped`, `unchecked`), reason category, safe message, and cause - where applicable. Aggregate independent failures; skip dependent checks when - prerequisites fail. Distinguish excluded/offline checks from selected checks - that could not complete. Return the partial report with typed errors. -8. `--json` emits one `schema_version: 1`, `command: "validate"` document after - valid arguments, including configuration failures. Human output shows scope - and evidence limits. Exit 0 means all selected checks completed successfully - within declared scope; 2 denotes usage/configuration/required-credential - errors; 1 denotes other failures, incomplete selected checks, cancellation, - or output failure. A declared offline omission alone is not failure. - -**Coverage:** profile-driven defaults/narrowing, both contexts online/offline, -aggregated failures and skipped dependencies, malformed profiles, validation -before final notes or generated outputs, explicit prebuilt inputs, optional -SSH-agent authentication without a private-key file, and no remote writes. - -## Stage 8: Supply one tool pin for source-only repositories - -**Completed:** Source-only launchers install and retain a host-specific pinned -tool, and the tagged workflow selects the pin after verifying the event commit. -The documented `v0.10.0` pin remains a syntax placeholder for this sprint. -Isolated local-proxy tests exercise current-source installation, delivery, -failure cleanup, pin changes, and recovery without Go after launcher exit. The -offline `go test ./...` suite and `go run ./internal/apicheck` pass. - -**Work:** add maintained source-only launcher/bootstrap examples and shared -installation guidance; extend recovery tooling where needed. - -1. Adopt repository-root `.releasekit-version`: one stable ReleaseKit Go module - version such as `v0.10.0`, with surrounding whitespace/newline trimmed. - Reject empty or multiple values with an actionable error. This pins the - release tool, independently of the consumer's product-version grammar. - During this sprint, retain `v0.10.0` as the example's syntax placeholder and - explain in its README that this older release predates the demonstrated - interfaces. This placeholder is sufficient to complete the example in this - implementation sprint. Selecting a compatible published adoption pin belongs - to subsequent release preparation and requires no decision in this stage. -2. Provide maintained local and Woodpecker installed-tool launchers that read - this file. Install `go.maximumdirect.net/releasekit/cmd/releasekit@VERSION` - into a private, version/host-specific directory under ignored `.releasekit`. - Use the selected Go toolchain's host target, `GOTOOLCHAIN=local`, and - `GOWORK=off`, preserving supported proxy/checksum/cache settings. Invoke the - resulting absolute executable and preserve its exit status. Installation - may use the network; candidate validation remains offline. -3. Keep this mechanical launcher maintained by ReleaseKit; consumers copy it - and change the pin, profile, and product facts. Use the committed pin from - the verified tag in CI, and keep Go module-backed bootstrap driven by tagged - module files. Source-only consumers require no placeholder module or tool - registration in a fabricated application module. -4. Add a complete small YAML/JSON source-only example, profile, release note, - ignore rules, pin, local launcher, and installed-tool delivery workflow. - The installation mechanism must support both production and diagnostic - invocation and source-publication recovery. A failed install must leave - no apparently usable partial executable; successful installed tools can be - reused. No automatic garbage collector is required. - -**Coverage:** local and tagged CI selection from the same pin, changed pins, -host-target overrides, failed installation, retained executable/exit status, -and a source-only fixture with no module. Use a local synthetic module proxy -and a temporary `GOMODCACHE`; do not install from live services in the suite. - -Exercise the new feature behavior using builds of the current source. Verify -installation/version selection with local synthetic module versions, serving -the current implementation through the fixture proxy where an assembled test -needs it. Fixture versions are test inputs, independent of the eventual release -number; they require no public tag or hosted release. Preserve normal installer -and pin-validation behavior rather than adding a runtime fallback to compensate -for the example's placeholder. - -**Completion rule:** finish the launcher/bootstrap implementation, document the -placeholder pin's compatibility caveat, and pass the offline coverage above. -Then mark Stage 8 complete and continue to Stage 9. There is no pending -example-pin decision: assigning a release number, replacing the placeholder -with a compatible published version, and tagging or publishing ReleaseKit all -belong to subsequent release preparation. - -## Stage 9: Define rehearsal identity transport and durable attempts - -**Completed:** Committed profile capture, diagnostic tag manifests and -verification, separate local Woodpecker credentials, and owner-private attempt -records now preserve exact identity and recovery evidence. Temporary diagnostic -resources are adopted in ADR 0008. The coordinator and CI dispatch that consume -these foundations follow in the later stages. Targeted Git and record tests, -the rehearsal race test, the offline `go test ./...` suite, and the compiled -API/dependency check pass. - -**Work:** add internal rehearsal contracts/storage and diagnostic tag support. - -1. Adopt `rehearsal.selector`, default `root`, and - `rehearsal.woodpecker.{base_url,repository_id,workflow,step,token_file}`. - Repository ID is Woodpecker's numeric ID; workflow and step are their exact - API names. Require these fields only for rehearsal operations. The local - Woodpecker credential file uses the same path/trim/error semantics as the - local forge credential but carries a separate token. -2. Start from `HEAD` by default; `--ref REF` selects another commit. Resolve a - full commit and read the selected profile from that commit. Normalize an - absolute in-checkout profile path to its repository-relative path. Rehearsal - profiles must be committed within the repository so CI can read the same - selection. Report an external/uncommitted profile with that concrete reason. - Resolve local secret-file paths against the checkout root. Branch, index, - and worktree may remain unchanged and need not be a final release candidate. -3. Create an annotated diagnostic tag using Stage 2's name. Its annotation is - `ReleaseKit rehearsal v1`, a newline, and one compact JSON manifest with - `schema_version`, `attempt_id`, `selector`, `commit`, `profile_path`, - `profile_sha256`, `source_dir` (repository-relative), `go_enabled`, optional - `module_path`, `publication_mode`, `version_format`, `version_prefix`, - `diagnostic_version`, and `tag`. Production format/mode fields describe the - captured profile; the diagnostic identifier uses its separate kind. - Bind the manifest to the actual annotated target and committed profile bytes. - Use optional `identity_bytes` overrides, keyed by string field name with - base64 values, for exact non-UTF-8 identity strings. Omit their lossy JSON - string forms, following the publication codec's convention. The manifest - contains no token or workstation file contents. -4. The selector in the ref permits dispatch before tool bootstrap. Single-product - templates recognize `root`; the maintained multi-product selector maps the - diagnostic selector to the existing selector row. After bootstrap, the CLI - verifies the annotation, tag spelling, event commit, profile digest, and - normalized selection together. A namespace match alone grants no deletion - authority and supplies no successful verification evidence. -5. Save an owner-private `format_version: 1` attempt record at - `/releasekit/rehearsals/.json`, with an - optional `--record-dir` override following existing private-store rules. - Reuse exact-byte encoding conventions for private paths/endpoints. Record - immutable identity, profile path/digest, effective Git endpoint/remote, - forge destination, Woodpecker settings, expected page title/body digest, - intended tag object, timestamps, observed resource IDs, and phase outcomes. - Store no resolved token. Retain the record after completion for operator - retention; do not auto-discover and choose a recovery attempt. -6. Persist all planned CI-created resources before the diagnostic tag push, - and persist intent before subsequent coordinator writes. Checkpoint local - observations and in-job results after effects. Unlike optional production - publication recording, failure to save the initial rehearsal record prevents - its first remote write: later cleanup depends on that record. Update records - with standard temporary-file/rename techniques and private permissions. - Preserve recoverable evidence on later - write/recording failure; do not claim application-level crash durability. -7. Update ADR 0008's status to reflect adoption and its explicitly temporary - resources. Diagnostic cleanup does not alter production release immutability. - -**Coverage:** captured versus working profiles, exact commit/digest binding, -selector transport, malformed annotations, collisions, record round trips, -initial recording failure before writes, independent simultaneous attempt IDs, -and partial records after uncertain writes. - -## Stage 10: Add Woodpecker observation and diagnostic forge effects - -**Completed:** Read-only Woodpecker observation follows pipeline pages, -correlates exact tag events and commits, retains workflow and step identities, -and streams job logs. Rehearsal readiness checks repository access with the -separate local credential. Diagnostic forge and Git operations preserve stable -resource identities, conditional tag deletion, and uncertain-write evidence. -Local HTTP and Git fixture tests, the offline `go test ./...` suite, and the -compiled API/dependency check pass. - -**Work:** implement an internal Woodpecker client and extend internal forge/Git -boundaries with the effects needed for recorded diagnostics. - -1. Use a small `net/http` Woodpecker adapter with explicit token input and - request contexts. The documented API supplies repository reads, paginated - pipeline listing, exact pipeline detail with workflows/steps, and step-log - download. Use `GET /api/repos/{id}`, `/api/repos/{id}/pipelines`, - `/api/repos/{id}/pipelines/{number}`, and - `/api/repos/{id}/logs/{number}/{step}/download`. - See the [Woodpecker API reference](https://woodpecker-ci.org/api). -2. Normalize required response fields inside the adapter. Correlate tag events - using exact ref and commit, then retain exact pipeline/workflow/step IDs. - A listing filter is only a search aid, not identity evidence. Follow - pagination; handle unrelated runs, reruns, missing jobs, rejected access, - malformed responses, and unavailable observation without choosing “latest.” -3. Stream step logs for result parsing. Keep protocol status/error translation - and authentication inside the adapter. Reuse credential-redaction and - cross-origin credential-handling patterns already established by Gitea. - Local readiness verifies repository observation access with read-only calls; - it does not inspect or register CI secrets. -4. Add internal forge deletion of an explicitly identified diagnostic release - and its assets, plus exact resource observation for recovery. Keep handles - and Gitea HTTP details inside `internal/gitea`; orchestration depends on the - neutral contract. Persist stable resource IDs, not serialized opaque adapter - handles. Reuse existing page/asset reads and streamed comparison. -5. Add Git diagnostic tag create/push/observe/delete effects with explicit refs - and captured endpoint. Never force-create or move a diagnostic tag over a - conflicting object. Delete only when the recorded object/commit still - matches, using conditional deletion where the transport supports it. Reuse - ordinary ambiguous-write observation rather than equating a request error - with absence. - -**Coverage:** paginated lists, exact correlation, terminal/active/unknown states, -log downloads, canceled requests, authentication errors, lost write/delete -acknowledgments, foreign resource conflicts, and backend dependency boundaries. -Use local HTTP servers and temporary Git remotes throughout. - -## Stage 11: Run and verify the diagnostic delivery inside CI - -**Completed:** `ci-deliver` verifies diagnostic tags and committed profiles, -uses the shared managed delivery and build path, and reads back the exact page -and declared assets before temporary output cleanup. Framed job results retain -identity and partial outcomes, and log parsing detects malformed, foreign, or -conflicting evidence without a scanner line limit. Page-only and real binary -fixtures cover credential failure and failed read-back/retry; the offline -`go test ./...` suite and compiled API/dependency check pass. - -**Work:** extend CI preparation and shared delivery with the diagnostic identity. - -1. `ci-deliver` recognizes a verified diagnostic manifest after normal exact-tag - checkout preparation. It uses CI credential context, the captured profile, - and ordinary destination, target, toolchain, dependency preparation, build, - version injection, manifest, and upload mechanics. Supply a deterministic - temporary note and title identifying product, attempt, commit, and profile. -2. Keep diagnostic delivery in the shared resolved delivery path. Add internal - diagnostic verification before managed build output is removed; do not - create a second build/upload implementation or change public `Deliver`'s - normal ownership of temporary files. -3. Read back the exact hosted page and each declared binary/checksum manifest - inside the job while local expected bytes still exist. Compare the page's - tag/target/title/body and actual uploaded contents using the existing - streamed comparison machinery. Record each artifact's name, size, and - SHA-256. Page-only profiles report no generated artifacts and verify the page. -4. Emit a complete one-line result to job output, prefixed with - `RELEASEKIT_REHEARSAL_RESULT_V1 `. The remainder is JSON containing - `schema_version: 1`, attempt/tag/commit/selector/profile digest, source and - diagnostic identity, scope (`page` or `page-and-assets`), build/delivery/ - verification outcomes, page ID, artifact evidence, and safe diagnostics. - Use the manifest's exact-string encoding for transported path identity. - Emit available failed-stage evidence too. Missing results after bootstrap - failure remain an explicitly incomplete verification outcome. -5. The coordinator obtains this result from the recorded delivery step's log - download after completion. Parse the framed line without assuming one HTTP - chunk equals a line or imposing a scanner's incidental small-line limit. - Accept equivalent retransmitted results once; conflicting matching results, - malformed results, or identity mismatches prevent successful verification. - Ignore ordinary log lines and never echo raw logs as credential diagnostics. - -**Coverage:** real shared builds with injected diagnostic versions; exact -page-only and binary read-back; missing/tampered assets; job credential failure; -chunked logs, absent/foreign/conflicting results; and temporary output lifetime. - -## Stage 12: Coordinate rehearsal start and CI observation - -**Completed:** The root facade starts recorded diagnostic attempts with -explicit credentials, checks readiness against the captured commit, and pushes -only the recorded tag after saving planned resources and intent. Observation -tracks exact matching pipelines, workflows, steps, reruns, and framed evidence; -timeouts and cancellation retain partial records for recovery. Local Git and -HTTP fixtures cover delayed dispatch, missing evidence, failed jobs, active -reruns, unsafe record locations, and dirty working inputs. The offline -`go test ./...` suite, focused race tests, and API/dependency checks pass. -Cleanup and recovery are completed by the following stage. - -**Work:** implement `internal/rehearsal` coordination and the root facade. - -1. Expose `Rehearse(ctx, RehearsalRequest) (RehearsalResult, error)`. The request - supplies repository/ref/profile selection, explicit forge and Woodpecker - credentials, normalized product/build selections from the committed profile, - record location, observation timeout, cleanup timeout, and progress output. - Bind supplied selection to the recorded profile digest through the CLI - adapter; the library accepts explicit selections and never loads ambient - tokens. Facade-owned results/errors preserve partial outcomes and causes. -2. Perform selected rehearsal readiness before the first write, using the same - checks with a committed-input reader for the captured revision. Ordinary - `validate` uses its working-input reader; rehearsal checks must not substitute - files from a different working `HEAD`. Capture the effective publication - endpoint and enforce its configured expectation. Check that the captured - profile declares CI delivery credentials; actual secret injection remains - job evidence. Check the committed profile and temporary tag availability, save - the attempt, then push only that diagnostic annotated tag. The coordinator - performs no local build or hosted-page creation in place of CI. -3. Observe exact tag/commit-correlated pipelines with bounded sequential polling - and cancelable waits. Record discovered IDs and links. The default observation - timeout in the CLI is 30 minutes; API zero or explicit CLI zero permits - observation until context cancellation. A positive override supports longer - jobs. Poll intervals are internal tuning details rather than public timing - guarantees. -4. Require the selected delivery workflow and step to finish successfully and - supply a matching successful content-verification result. Overall pipeline - success alone is insufficient. Report other workflow outcomes separately; - they do not substitute for the selected delivery workflow. Track every - matching run encountered so an active rerun is visible to cleanup. -5. Return separate workflow execution, artifact generation, hosted verification, - and cleanup outcomes, observed IDs/URLs, remaining resources, record path, - and actionable diagnostics. A timeout, missing pipeline/result, unavailable - observation, or cancellation does not certify absence or quiescence. -6. On interruption, stop local observation and preserve the independent job and - record. Do not cancel or restart CI. Trigger Stage 13 cleanup only when its - quiescence requirements can be established. - -**Coverage:** no pipeline yet, delayed dispatch, incorrect commit, unrelated -pipelines, skipped/missing delivery workflow, build failure, successful pipeline -without evidence, successful page-only/binary evidence, reruns, timeout, and -cancellation. Use controlled clocks/waits at the external boundary where useful. - -## Stage 13: Implement cleanup, resume, and uncertain-state recovery - -**Completed:** Explicit resume and cleanup use recorded destinations and -credentials supplied by the caller. Cleanup rechecks matching CI runs, verifies -the diagnostic marker, page and tag identities, records each deletion intent, -and reconciles ambiguous acknowledgments. It uses a bounded context independent -of canceled observation and preserves conflicts and incomplete attempts. -Credential recovery reads the captured profile or explicit file overrides. -Local Git/HTTP tests cover active and missing pipelines, foreign resources, -lost deletes, interruption, and repeated cleanup. The offline `go test ./...` -suite, focused race tests, and API/dependency check pass. - -**Work:** complete rehearsal lifecycle coordination and public recovery calls. - -1. Expose `ResumeRehearsal` and `CleanupRehearsal`, each accepting an explicit - record path, current explicitly supplied credentials, timeout settings, and - output. Resume observes the existing attempt and then coordinates cleanup; - it does not push a new tag or rerun CI. Reuse recorded completed verification - evidence when resources have already been cleaned. Cleanup reports cleanup - independently of an earlier verification failure. -2. When a recorded attempt stopped before remote dispatch and that fact is - established, clean only its local resources. For a dispatched or uncertain - push, establish terminal completion of the matching pipeline and - relevant delivery jobs, including observed reruns. Recheck correlation and - active matching runs immediately before cleanup. Unknown CI state, an active - job, or no evidence that dispatch has completed leaves cleanup pending or - unknown. An observation timeout is not proof that no job will run. -3. Delete the recorded diagnostic page (including its assets), remote tag, and - matching local diagnostic tag, in that order after quiescence. Reobserve - resources before deletion and verify exact identity/ownership against the - record and diagnostic marker. If the create response was lost, locate the - page by the recorded tag and validate its target/title/body before adopting - its handle. Preserve conflicting or unidentifiable resources and report them. -4. Treat already-absent recorded resources as cleaned. After uncertain deletes, - query state and classify confirmed absence, known remaining state, or unknown - outcome. Retain tag/commit/page IDs and unresolved write evidence until - cleanup is confirmed. Do not use production deletion or immutability paths. -5. Use a fresh bounded cleanup context independent of a canceled observation - context, with a two-minute default and a positive configurable timeout. API - zero selects this default; the CLI cleanup timeout must be positive. A - cleanup run can remain pending when CI is still active; avoid indefinite - background goroutines. Persist observations and offer explicit continued - recovery. Serialize updates made through one operation/handle and ensure - simultaneous independent attempts retain separate records and resources. -6. Recovery credentials come from the committed profile selected by the record - in the CLI, resolved against its recorded checkout. Provide explicit file - overrides for credentials that have moved. Recovery targets the captured - destinations, not a changed working profile. The library takes tokens - explicitly. Report a missing checkout/profile as recoverable input failure; - the override path remains available for cleanup with saved evidence. -7. Explain the evidence boundary: cleanup describes recorded resources and - observed CI completion. Later operator-initiated reruns, persistent CI - history, notifications, and webhook effects are outside that result. - -**Coverage:** interruption/resume, active/unknown CI deferring cleanup, lost -create/delete responses, partially created pages/assets, already-absent -resources, changed tag/page identity, failed recording, canceled observation -with bounded cleanup, and preservation of unrelated/production releases. - -## Stage 14: Wire rehearsal CLI and maintained workflows - -**Completed:** `test`, `test-resume`, and `test-cleanup` select explicit inputs, -report separate outcomes in human or JSON form, and support bounded cleanup -and credential-file overrides. Maintained root, self-bootstrap, nested-module, -and source-only workflows dispatch diagnostic selectors through their normal -tagged delivery path. The multi-product map supports installed-tool rows and -retains physical Go module selection. Local workflow tests exercise production -and diagnostic tags, selector/profile binding, source-only tool pins, command -arguments and statuses; the offline `go test ./...` suite, shell syntax, and -compiled API/dependency check pass. - -**Work:** finish CLI presentation and CI examples across root, nested Go, and -source-only products. - -1. Adopt these commands: - - ```text - releasekit test [--repo DIR] [--config FILE] [--ref REF] [--record-dir DIR] - [--timeout DURATION] [--cleanup-timeout DURATION] [--json] - releasekit test-resume --record FILE [--timeout DURATION] - [--cleanup-timeout DURATION] [--json] - releasekit test-cleanup --record FILE [--cleanup-timeout DURATION] [--json] - ``` - - Both recovery commands also accept `--token-file FILE` and - `--woodpecker-token-file FILE` overrides. They require an explicit record; - there is no production version argument or implicit newest-attempt selection. -2. JSON is one `schema_version: 1` document with command, safe attempt identity, - phase outcomes, resource/CI links, record path, remaining resources, and - diagnostics. Human output emphasizes the same separate outcomes and exact - resume/cleanup commands. After valid arguments, preserve structured output - on failures. Exit 0 means verification and cleanup succeeded for `test` and - `test-resume`, or cleanup alone succeeded for `test-cleanup`; 2 denotes - usage/configuration/required-input failure before effects; 1 denotes known - workflow/verification/cleanup failure or reporting failure; 3 denotes - unresolved remote/CI state or pending cleanup. Preserve observed outcomes - when mapping a later error to an exit status. -3. Update maintained tag filters to include the configured production format - and `refs/tags/releasekit-test//*`. Keep exact event/tag commit - verification before tool selection. Route diagnostic refs by selector and - production refs by the existing product tag mapping. Then verify the - manifest/profile after bootstrap before diagnostic delivery. -4. Extend the maintained four-column selector map for source-only products: - selector, production tag pattern, tool-module directory, profile path. - Use `-` in the tool-module column to select installed-tool bootstrap from - `.releasekit-version`; retain `.` and physical module paths for existing Go - bootstrap. Go rows supply an expected module directory. Source-only rows - obtain source scope from the profile/verified manifest, never by treating - `-` as a source path. Apply an expected-source check when the launcher - actually supplies one. -5. Provide complete root-module, nested-module, self-bootstrapped ReleaseKit, - and source-only workflow examples using the same CI credential declaration, - image selection, shared delivery command, and diagnostic verification path - as their production counterpart. Keep secret injection and its explanatory - comment visible. `ci-deliver` itself selects CI context; any explicit - readiness invocation in a workflow supplies `--context ci`. -6. The coordinator observes the actual tag-triggered job. Workflows neither - replace it with a manual/local API exercise nor add rehearsal to normal - publication gates. Live commands remain explicitly invoked diagnostics. - -**Coverage:** CLI argument/exit/JSON mapping, exact recovery record selection, -real maintained shell/YAML fixture execution, production/calendar/diagnostic -dispatch, wrong-selector/profile rejection, tagged tool pin/dependency -selection, and CI secret source selection. - -## Stage 15: Complete documentation and integrated verification - -**Completed:** Canonical guides, integration formats, package inventory, the -maintainer procedure, and an unnumbered migration draft describe the delivered -behavior and the pre-release pin convention. Four assembled offline fixtures -cover legacy Go modules, Go application source releases, calendar-version -binaries, and YAML/JSON-only sources through readiness, candidate checking, -publication, delivery, diagnostic verification, cleanup, and saved recovery. -Compiled facade checks cover the new rehearsal operations. The offline -`go test ./...` suite, `go run ./internal/apicheck`, shell syntax and local-link -checks, and race tests for the facade, CLI, rehearsal, Woodpecker, Git, and -Gitea packages pass. A live consumer rehearsal and the next release remain -subsequent operator work. - -1. Update canonical configuration, CLI, GoDoc, consumer adoption/check/build/ - publication/delivery guides, integration schemas, internal inventory, and - maintainer runbook as their behavior lands. Add focused readiness/rehearsal - guidance and integration-format documentation where substantive content - warrants it. Link to maintained complete examples. Preserve the distinction - between routine publication, optional readiness, and live rehearsal. -2. Supply next-release migration guidance covering context-specific credential - fields, retained CI secret/variable names, legacy module defaults versus - explicit source/Go/publication choices, calendar grammars, source-only pin - setup, workflow/selector changes, receipt regeneration, and existing - publication-record recovery. Explain diagnostic deletion permissions and - persistent CI effects. Use a roadmap-owned draft if the release number is - still unassigned; place the final note in release history once assigned. -3. Run a representative offline assembled workflow for each of: legacy Go module - publication; Go application source release with a different product major; - calendar-version binary release; and a YAML/JSON-only repository. Across - these fixtures exercise candidate validation, publication, delivery, - readiness, rehearsal verification, cleanup, and saved recovery. Compose - local Git remotes, local forge/Woodpecker servers, and existing real build - helpers rather than duplicating algorithms in test mocks. -4. Update compiled API checks for the deliberate facade additions and preserve - their ownership/dependency protections. Run `go test ./...` and - `go run ./internal/apicheck`. Run the race detector on new rehearsal, - observation, cancellation paths, and affected packages where supported. - Keep the default suite deterministic, offline, and credential - independent. Use test-owned module caches for synthetic tool versions. - Broaden checks only where an unresolved risk or new failure warrants them. -5. Review all identity consumers and encoded formats for old unconditional - `go.mod`, stable-version, module-major, final-tag-component, and filename - assumptions. Review request/response body lifetime, polling cancellation, - credential redaction, destructive resource matching, and cleanup quiescence. - Verify local links and prose whitespace, inspect the complete diff, and - record the final implementation/verification status. - -The sprint is complete when the four settled capabilities work through their -supported CLI and facade paths with documentation and offline regression -coverage. Running a live consumer rehearsal, choosing the next release number, -and tagging a release are subsequent operator decisions, not implementation -dependencies. Replacing documented example pins with that release's adoption -version is also release preparation, not a sprint completion requirement. -No product-scope questions remain open in this plan. diff --git a/docs/roadmap/next-release.md b/docs/roadmap/next-release.md deleted file mode 100644 index a9aeb66..0000000 --- a/docs/roadmap/next-release.md +++ /dev/null @@ -1,468 +0,0 @@ -# Next release proposals - -## Status and purpose - -Roadmap for the next release after v0.10.0. The behavior described in items -1–4 is settled; implementation is pending. The -[implementation plan](implementation.md) defines the staged work and finalizes -interface and encoding details. The release number remains -unassigned. This document adds no implementation or release gates. - -The objectives are to make local hosted delivery straightforward, expose useful -readiness diagnostics, rehearse the actual Woodpecker delivery workflow on demand, -and support release identifiers beyond stable Semantic Versioning. Keep routine -consumer configuration small and put reusable work behind ReleaseKit's existing -facades. - -## Current baseline - -- Hosted delivery already accepts `delivery.token_file` and `delivery.token_env`. - A nonblank environment value wins; the file is a fallback. The default - environment variable is `RELEASEKIT_GITEA_TOKEN`. Missing credentials and - unreadable or blank selected files produce errors. See - [configuration](../config.md) and [delivery guidance](../consumers/delivery.md). -- `PreflightDelivery` verifies authenticated repository access through read-only - requests. `Deliver` runs it automatically. It cannot establish that every - subsequent write will succeed. [ADR 0006](../adr/0006-neutral-forge-delivery-and-preflight.md) - records that boundary. -- `check` validates a committed candidate and runs the offline Go suite and - selected checks. The CLI has no `validate` or live workflow-test command. - Source publication uses native Git authentication independently of the hosted - API token. See the [CLI contract](../cli.md). -- `internal/versioncontract`, CLI parsing, and `internal/releaseidentity` require - stable `vMAJOR.MINOR.PATCH` identifiers. Identity derivation also enforces Go - module-path major compatibility and determines full tags and note paths. - Builds, delivery, receipts, recovery records, and CI launchers consume that - identity. The [package inventory](../internal/overview.md) describes ownership. - -## 1. Select local and CI credentials explicitly - -Recent releases completed the Git tag push but failed hosted delivery because -the expected token environment variable was unavailable. Persistent local file -credentials and automatic CI secret injection should make setup routine. - -Adopt separate local and CI credential declarations in one shared profile. -Ordinary local delivery reads the configured local token file directly. -`ci-deliver` reads the configured environment variable inside the CI delivery -job. The invocation selects the context explicitly; ambient environment values -do not choose the context or override local file credentials. Each context -reports problems with its own selected source, without falling back to the other. - -The planned credential structure is: - -```json -{ - "delivery": { - "credentials": { - "local": { - "token_file": ".releasekit/gitea-token" - }, - "ci": { - "token_environment_variable": "RELEASEKIT_DELIVERY_TOKEN" - } - } - } -} -``` - -Local setup consists of saving the token once and configuring its path. -ReleaseKit reads it on each local invocation, including after workstation -reboots. This workflow requires no manually exported workstation variable, -shell startup configuration, or consumer-owned credential-loading script. -Preserve repository-root-relative and absolute file paths and whitespace -trimming. Missing, unreadable, or blank selected files are errors. - -Woodpecker stores the CI token persistently and injects it into each delivery -job. Maintain an explicitly commented mapping such as: - -```yaml -# Woodpecker supplies this variable inside the CI delivery job. -# Workstation environment setup is unnecessary. -environment: - RELEASEKIT_DELIVERY_TOKEN: - from_secret: GITEA_RELEASE_TOKEN -``` - -Here `GITEA_RELEASE_TOKEN` names a Woodpecker stored secret; -`RELEASEKIT_DELIVERY_TOKEN` names the variable available to ReleaseKit inside -that job. An unset or blank selected CI variable is an error. Consumers can -reference an existing suitable secret. The local token file stays on the -workstation; CI uses its stored secret. ReleaseKit owns the -maintained workflow integration. Secret-registration automation is outside -this work. - -Keep loading in the CLI and pass the resolved token explicitly through -`DeliveryDestination`. The library remains independent of ambient credentials. -Errors identify the execution context and selected source without including -secret contents. The existing `forbidden_files` check remains available to -exclude the local token path from committed candidates; explain its use -alongside Git ignore rules. - -Update local examples, CI templates, adoption guidance, and the maintainer -runbook together. Explain the migration from today's `delivery.token_file`, -`delivery.token_env`, and environment-over-file precedence to context-specific -selection. Use the terms “local token file,” “Woodpecker stored secret,” and -“CI delivery job environment variable” consistently. A shared profile carries -both declarations; consumers maintain their paths and secret references. - -Adopt the explicit credential structure in this release. Report legacy flat -credential fields with actionable migration errors and provide coordinated -profile and workflow examples. The new structure supports explicitly naming -the existing CI environment variable, including `RELEASEKIT_GITEA_TOKEN`. -Consumers can retain that name and their stored secret while migrating the -profile. The illustrated `RELEASEKIT_DELIVERY_TOKEN` name does not require a -simultaneous variable rename. - -## 2. Add configuration and input readiness validation - -Provide the optional setup-readiness diagnostic `releasekit validate`. -It loads the selected profile, checks required inputs, -and verifies read-only remote access by default. This gives developers useful -configuration and credential evidence before preparing a final release -candidate. An explicit `--offline` option limits the run to offline checks. - -### Operation and context selection - -Default to source-publication readiness, configured Go/build capabilities, and -hosted delivery when declared in the selected profile. Provide an explicit -operation selector for narrower investigations. Rehearsal readiness is an -explicitly selected operation that includes Woodpecker access. Ordinary -delivery readiness requires its own credentials, independently of Woodpecker -credentials. - -Inspect the current working configuration and inputs so developers can -diagnose changes before committing. Candidate validation and the rehearsal -inspect their captured commits. Reports identify the input source and selected -operations before presenting results. - -Each operation checks its own requirements: source publication uses native Git -authentication, and hosted delivery checks hosted credentials. Page-only -delivery needs no binary-build inputs. - -Default to local execution context and provide explicit CI context selection. -The maintained Woodpecker workflow supplies the CI selection when invoking -validation inside the job. Reuse delivery's context-specific credential -resolver: local delivery reads its token file directly; CI delivery reads the -variable injected into the running job. Keep execution context independent -of network use. Both contexts support online verification and offline checks. - -A workstation invocation can inspect CI declarations and, when rehearsal -readiness is selected, configured Woodpecker access. Verification of actual CI -secret injection takes place inside the job or through the rehearsal. Report -that evidence as unverified when unavailable. - -### Readiness scope - -- Reuse profile parsing and operation-specific validation for source selection, - applicable Go module and build settings, delivery destination, and publication - endpoint expectations. Source-only profiles check their configured operations - without requiring a Go module or generated binaries. -- Check the selected local token file for availability, readability, and - nonblank content, or check the selected CI variable inside the job. Identify - the source and context without exposing secret contents. -- Validate relevant source and build inputs at setup time. Permit outputs that - the configured build will generate to be absent. When callers explicitly - supply existing artifacts for delivery, validate those inputs too. -- Use native Git and SSH configuration for Git authentication. Support - SSH agents, hardware-backed keys, custom commands, and HTTPS credentials. - Check an explicitly selected key file when applicable; describe other - authentication evidence by the operation actually exercised. -- Perform read-only remote verification by default, reusing hosted preflight - and native Git reads. Successful reads establish authentication and access - evidence for those requests. The rehearsal supplies write and workflow - execution evidence. -- Allow validation before a version-matched release note or final candidate - exists. Keep it independent of the candidate test suite and artifact builds. - It performs no publication, remote writes, or candidate checkout changes. - -### Reporting and completion - -Collect independent failures in one run and mark dependent checks as skipped -when their prerequisites fail. Distinguish malformed configuration, unavailable -required inputs, rejected credentials, and remote verification failures. -Identify the selected operations, context, credential source, destinations, -checks completed, and evidence still missing. - -Return an unsuccessful result when a selected check fails or cannot complete. -An explicitly offline run can succeed within its declared scope; mark remote -access as unchecked. Distinguish checks omitted by scope from selected checks -that could not complete, so partial verification remains visible. - -Share validation and credential resolution with execution paths. Actual -operations continue checking their requirements when run. Validation remains -an optional convenience with no required pre-release invocation. The -[implementation plan](implementation.md#stage-7-implement-readiness-validation-and-its-cli) -defines command syntax, operation mapping, reports, and exit statuses. - -## 3. Rehearse the end-to-end Woodpecker delivery workflow - -Provide an explicitly invoked rehearsal that runs the actual tag-triggered -Woodpecker delivery workflow, generates the application's configured artifacts, -verifies hosted delivery, and cleans up temporary release resources. This -addresses failures that appear after a successful production tag push, including -missing CI credentials, failed builds, and missing uploads. The rehearsal uses -real CI and forge services without consuming a production release version. - -ReleaseKit owns the reusable coordination and maintained workflow integration. -Consumers adopt the updated workflow and supply their profile, destinations, -and credential references. One local invocation should start the rehearsal, -observe its outcome, and report verification and cleanup results. The -[implementation plan](implementation.md#stage-14-wire-rehearsal-cli-and-maintained-workflows) -defines commands and flags. - -### Rehearsal flow - -1. Select an exact committed source revision, source scope, and profile, - including the Go module when applicable. Check required local inputs and - record the intended diagnostic resources before the first write. Preserve - the workstation's branch, index, and worktree. -2. Create and push a uniquely named diagnostic tag, such as - `releasekit-test/`, to the configured publication endpoint. - The maintained delivery workflow accepts that namespace alongside production - tags. Verify the tag's commit and correlate the resulting Woodpecker run - with the recorded attempt. -3. Run the ordinary tool bootstrap, checkout verification, dependency - preparation, configured builds, and artifact generation inside Woodpecker. - Use the same profile, build targets, job image, secret mapping, and shared - delivery implementation as production releases. Source-only profiles use - their maintained installed-tool path and page-only delivery; application - dependency preparation and binary builds apply to profiles declaring them. -4. Create a clearly marked temporary hosted page in the configured forge - repository and upload the actual declared artifacts. ReleaseKit supplies a - diagnostic identity and temporary note; consumers need no version bump or - production release note. -5. Verify uploaded contents inside the delivery job, where the generated - artifacts are available for comparison. Emit a structured verification - result associated with the exact rehearsal identity. Page-only profiles - verify the page and report their declared scope. The local coordinator - observes the exact CI run through completion and confirms both successful - execution of the expected delivery workflow and its matching verification - result. A successful pipeline status alone is insufficient evidence. -6. Remove the attempt's temporary hosted page, assets, and tag after - verification or failure. Report workflow execution, artifact generation, - hosted verification, and cleanup outcomes separately, with links to the CI - run and actionable failure details. - -A successful rehearsal establishes evidence for the selected source, profile, -CI environment, diagnostic namespace, and destination at that time. -Production-tag-specific rules and future service availability remain separate -considerations. CI history and any notifications or webhook effects persist -after temporary release resources are removed. - -### Credentials and execution contexts - -Reuse item 1's explicit credential selection and item 2's readiness checks. -The local coordinator uses native Git authentication to push the diagnostic -tag and reads the configured local forge token file for its forge operations. -Woodpecker supplies its stored secret to the actual delivery job, which uses -the CI credential declaration. Successful local authentication does not stand -in for verifying the job's injected credential. - -Observing Woodpecker requires its server/repository identity and authorization -to inspect the relevant pipeline and workflow results. Keep that authorization -distinct from the Gitea delivery token. Local Woodpecker credentials follow -the persistent-file model; ReleaseKit loads them directly. Consumers maintain -no workstation environment exports or credential-loading scripts. - -### Shared implementation and recovery - -Add explicit diagnostic identity support to CI preparation, builds, delivery, -and relevant evidence formats. Today's `ci-deliver` requires a module-derived -stable semantic tag. Diagnostic tags need a supported path through those -operations, including source selection, applicable module selection, and -workflow dispatch. Keep the normal build and delivery mechanics shared; -diagnostic mode supplies the temporary identity, note, and resource lifecycle. - -Record one rehearsal identity containing the attempt identifier, exact commit, -profile/source selection, diagnostic tag, and diagnostic version used by -builds. ReleaseKit derives and transports these values through the maintained -workflow and associates verification results and recovery with that identity. -Use explicit diagnostic identity semantics throughout; the rehearsal consumes -no synthetic production release version. The -[implementation plan](implementation.md#stage-9-define-rehearsal-identity-transport-and-durable-attempts) -defines identity, record, and transport encoding. - -Use unique attempt names and exact tag, commit, pipeline, and hosted-resource -identities to scope verification and deletion. Observe uncertain remote writes -before classifying their outcome. Cleanup follows successful and failed runs, -with bounded attempts independent of an already canceled local invocation. -Coordinate cleanup with CI execution so an active job cannot recreate -resources after cleanup is reported complete. Wait for or establish completion -of the relevant job before deleting resources. When CI or remote state remains -uncertain, retain recovery evidence and report cleanup as pending or unknown. - -Interruption stops local observation and preserves the attempt record; the CI -run continues independently. Provide explicit resume-observation and cleanup -operations. Automatic CI cancellation is outside the selected behavior. -Persist enough attempt information to resume after interruption, process -failure, or service unavailability. Recovery targets only the recorded -diagnostic resources and preserves existing releases. Document the deletion -permissions required for cleanup and report remaining resources with exact -recovery instructions. - -Implement reusable orchestration behind a proportionate facade API, with -Woodpecker integration and diagnostic forge operations behind internal -boundaries. The CLI owns argument parsing, credential loading, reporting, and -exit status. Update maintained workflows and adoption guidance with the -feature. The rehearsal remains opt-in and outside default offline tests and -routine publication gates. Ordinary source publication still completes at the -successful production tag push; the rehearsal waits for CI because verifying -that workflow is its purpose. - -## 4. Support general source-release identity and Go module publication - -Adopt a general source-release identity that supports configuration -repositories, Go applications, and Go modules. A release identifies an exact -committed source revision, selected source scope, version, full tag, and -release note. Go module publication adds module-version and tag-derivation -rules to that common model. Configuration independently expresses selected -source scope, Go validation/build capabilities, and Go module publication. -These choices share the common identity model while retaining their distinct -requirements. - -Include source-only repositories, such as YAML or JSON configuration -repositories, in this release. Support tagging, publication, hosted release -pages, readiness validation, recovery, and the actual Woodpecker delivery -rehearsal through the shared workflow. This lets consumers replace repeated -release scripts with a profile, a release note, and maintained tooling. - -Preserve documented legacy module-publication defaults for existing profiles -that omit the new selection. New examples make the publication choice -explicit. Selecting Go capabilities in the new model alone does not select Go -module publication. General source releases, including application and -configuration releases, can use SemVer or the selected calendar formats. - -### Source selection and validation - -Select source independently of a Go module. Source-only repositories default -to the repository root; file-check inputs and release-note paths follow the -selected source scope. Go applications retain a selected Go module for builds -and validation, deriving their common source scope from that module so -consumers maintain one directory setting. The -[implementation plan](implementation.md#stage-1-normalize-source-go-and-publication-selection) -defines fields and legacy mapping. - -Preserve common Git, committed-candidate, release-note, and publication checks. -Run the standard Go suite for Go modules. Source-only repositories use -applicable shared file checks, such as Markdown links, forbidden files, and -file sizes, together with explicitly configured product checks. Their release -workflow requires no placeholder `go.mod`. - -YAML/JSON syntax or schema validation can use existing custom-check support. -Additional shared configuration validators require separate evaluation. -Arbitrary non-Go build orchestration and packaging remain separate scope -decisions. - -### Release identity and Go distribution - -Apply Go module-path major-version compatibility constraints only when Go -module publication is selected. Selecting Go builds and tests alone does not -enable those constraints. General source releases validate their selected -version format independently of the application's module-path major version. - -For example, an application declaring `module example.com/myapp` can retain -that path while releasing binaries or checked-out source as `v2.0.0`, -`v3.0.0`, or `2026-12-05`. Its release identifier requires no corresponding -`/v2` or `/v3` suffix for those distribution methods. - -Go module publication retains semantic version validation, module-path major -compatibility, and Go-specific tag derivation. Select that publication mode -when distributing published versions through Go's module system, including -executables installed with `go install …@VERSION`. -For example, `v2026.12.3` denotes major version 2026, while `2026-12-05` is -not a canonical Go module release version. See the -[Go versions reference](https://go.dev/ref/mod#versions) and -[major-version suffix rules](https://go.dev/ref/mod#major-version-suffixes). - -A general source-release tag identifies the source product without claiming to -publish a Go module version. One source revision can have separate, explicitly -identified source-product and Go module releases. Coordinated publication of -both identities requires a separate consumer need. - -### Version formats and selection - -Provide named, documented formats with these conventions: - -| Format | First release | Subsequent release in the period | -| --- | --- | --- | -| Full date | `2026-12-05` | `2026-12-05.1` | -| Year/month with revision | `2026.12.0` | `2026.12.1` | - -Define valid dates, padding, and numeric revision rules precisely. Treat an -optional leading `v` as a profile-level convention so spelling stays consistent. -CalVer encompasses multiple conventions; ReleaseKit's documentation owns the -exact supported grammars. See [CalVer's scheme guidance](https://calver.org/#scheme). - -Callers supply the identifier. ReleaseKit validates its format and checks the -intended tag's availability. The selected date follows the consumer's release -convention and need not equal the machine's current date. Preserve the selected -identifier throughout an attempt and its recovery. Automatic date selection, -incrementing, ordering, configurable layouts, and custom public strategy -interfaces require separate justification. - -### Source tags and module scope - -Retain module-scoped builds and validation for Go applications. General source -tag prefixes follow the selected source directory relative to the repository, -with an explicit override for product naming. Go applications use their -selected module directory; source-only repositories default to the root. - -| Selection | Source tag | -| --- | --- | -| Repository-root configuration source or Go application | `2026-12-05` | -| Go application module in `apps/editor` | `apps/editor/2026-12-05` | -| Explicit product prefix `editor` | `editor/2026-12-05` | - -General source tag derivation uses the selected physical directory by default, -including a physical `/vN` directory when present. Go module publication retains -Go's major-version directory and tag-prefix rules. The source-product version -does not determine a selected module's import-path major version. - -Resolve release purpose, version format, selected identifier, source selection, -applicable module identity, and complete tag identity once. Carry that identity -through CLI and API validation, builds, publication, hosted delivery, and -recovery. Preserve the identifier in notes, injected runtime versions, artifact names, receipts, and -saved evidence. Validate complete refs with Git's rules and review consumers -of the identity for filename and numeric-triple assumptions. - -### Tool selection and complete workflow support - -For repositories without `go.mod`, record the selected ReleaseKit version in -one small committed file. The maintained local launcher and Woodpecker -bootstrap both read that file. Build on the documented separately -installed-tool path, with ReleaseKit owning reusable installation and -invocation mechanics. The -[implementation plan](implementation.md#stage-8-supply-one-tool-pin-for-source-only-repositories) -defines the filename and format. Module-backed repositories continue using -their module-selected dependency. - -Source-only profiles publish their committed configuration and release note -under an immutable tag, then deliver the hosted page through the maintained -Woodpecker workflow. Readiness checks cover their profile, source, credentials, -and selected remote operations. The rehearsal exercises the actual tag event, -CI tool invocation, credential injection, hosted-page content verification, -and cleanup. Report that these profiles declare no generated artifacts. -Use the same local-file and CI-secret selection as other consumers. - -### Adoption - -All supported CLI and API operations share identity and source selection, -including candidate checks, publication, hosted delivery, recovery, readiness, -and the Woodpecker rehearsal. CI tag dispatch, tool bootstrap, note matching, -and stored evidence support both module-backed and source-only profiles. -Existing SemVer integrations stay simple, with migration guidance for changed -public or stored contracts. -[ADR 0007](../adr/0007-general-source-release-identity.md) records the general -source-release and Go module identity decision. The implementation plan defines -format grammars and configuration fields. - -ReleaseKit's own release policy continues to select SemVer. Consumer support -for other source-product formats leaves that policy unchanged. - -## Implementation ownership - -The [implementation plan](implementation.md) owns sequencing, concrete -interfaces, transport and evidence formats, migration work, and regression -coverage. [ADR 0007](../adr/0007-general-source-release-identity.md) and -[ADR 0008](../adr/0008-woodpecker-rehearsal-lifecycle.md) record the architectural -rationale. This roadmap owns the settled target behavior and product scope. diff --git a/docs/roadmap/remediation.md b/docs/roadmap/remediation.md deleted file mode 100644 index f2ff3b2..0000000 --- a/docs/roadmap/remediation.md +++ /dev/null @@ -1,643 +0,0 @@ -# Implementation review remediation - -## Scope and evidence - -Reviewed commit `dd9e177` against every stage of -[the implementation plan](implementation.md), the -[feature roadmap](next-release.md), and the adopted facade, source-identity, -delivery, and rehearsal decisions. The architecture is substantially present; -the findings below identify remaining correctness and integration gaps. - -Baseline verification passed with Go 1.27.4: - -- The complete offline `go test ./...` suite. -- `go run ./internal/apicheck`. -- Race tests for `internal/rehearsal`, `internal/readiness`, - `internal/woodpecker`, `internal/git`, and `internal/gitea`. - -Temporary Go test overlays reused existing local Git and HTTP fixtures to -substantiate findings 1–5, 7, and 8. Their expected-behavior assertions fail -against the reviewed implementation. The overlays changed no repository files; -production code and permanent tests remain unchanged by this review. - -A follow-up integration audit reviewed Stages 1–15 in order at `67c8363`. -Production code remains identical to `dd9e177`, so the successful baseline -checks above still apply. Additional temporary-overlay probes reproduced -findings 10 and 11 using candidate checking, tagged CI dispatch, and a real -native build. A separate local selector-map probe also reproduced finding 10. -Existing focused CLI tests for calendar delivery, diagnostic delivery, build -readiness, and selector mapping pass. These probes used no external services; -their expected-behavior assertions fail on the identified integration gaps. - -An algorithmic audit at `fad1567` reviewed Stages 1–15 in order against the -same production baseline. Findings 12–14 identify avoidable membership scans, -package-input enumeration, and log buffering. Their bounds follow from the -implemented loops, Git arguments, and the local Go 1.27.4 standard library; -no workload measurements or benchmarks were needed. Existing offline tests for -release identity, version contracts, readiness, Woodpecker, and rehearsal pass. -The review preserves the selected sequential polling, complete pagination, -record snapshots, and in-job content comparison, together with the resource -work explicitly deferred in [the earlier assessment](deferred-resources.md). - -### Stage coverage - -| Stage | Evidence reviewed | Related findings | -| --- | --- | --- | -| 1 | Profile selection, null/omitted defaults, physical directory resolution, facade-owned source types | 1 | -| 2 | Version grammars, module-major rules, source tag prefixes, diagnostic identity generation | 3, 10 | -| 3 | Committed candidate capture, Go capability selection, scoped file inputs and callbacks, exact source publication | 1 | -| 4 | Working and committed build/delivery identities, managed/prebuilt verification, tagged preparation | 6, 10 | -| 5 | Publication record versions and exact bytes, receipt schema 2, explicit recovery and durable entry points | — | -| 6 | Local file and CI variable selection, migration errors, operation-specific credential loading | 1 | -| 7 | Readiness defaults, narrowing, offline scope, input readers and error aggregation | 1, 2, 3, 11, 13 | -| 8 | Source-only pin, host installer, local/CI selection and recovery fixtures | — | -| 9 | Committed profiles, tag manifests, identity binding, private record lifecycle | 4, 6 | -| 10 | Woodpecker API pagination/correlation and diagnostic Git/forge effects | 4, 5, 6, 8 | -| 11 | Shared builds/uploads, in-job read-back, framed verification evidence | 6, 7, 10, 14 | -| 12 | Start, dispatch reconciliation, observation and partial results | 2, 3, 4, 7, 8, 11, 12, 13, 14 | -| 13 | Quiescence, ownership checks, partial deletion, resume and cleanup | 4, 5, 7, 12 | -| 14 | CLI/configuration mapping, reporting, exit classes and maintained workflow dispatch | 1, 6, 7, 10 | -| 15 | Assembled fixtures, canonical references and migration guidance | 9; regression gaps identified below | - -Pending cleanup while CI remains active or unobservable is selected behavior. -The placeholder example pin and the absence of a newly published ReleaseKit -version are also consistent with the revised plan. Remediation should preserve -these boundaries and ordinary production-release immutability. - -## 1. Readiness accepts configurations that the selected operations reject - -**Completed:** Readiness shares candidate and selector configuration checks -with execution, requires the rehearsal CI declaration, and preserves narrower -delivery and Go-only scope. CLI regression cases, affected internal suites, -the facade's operation-scoping regression, and the compiled API/dependency check -pass. CLI profile parsing retains its existing configuration validation. - -**Priority:** P2. **Stages:** 1, 3, 6, 7, 14. - -**Relevant code:** [CLI readiness mapping](../../cmd/releasekit/readiness.go), -`runValidate`; [facade readiness](../../readiness.go), `Validate`; and -[shared readiness](../../internal/readiness/readiness.go), `Run`. -Execution performs additional checks in -[`Start`](../../internal/rehearsal/coordinator.go), -[`DiagnosticFromAttempt`](../../internal/releaseidentity/diagnostic.go), and -[`validation.Run`](../../internal/validation/validation.go). - -Three locally verifiable configuration failures currently produce a successful -readiness result: - -- `validate --operation rehearsal --offline` accepts a delivery configuration - with only local credentials. `test` requires the committed CI credential - declaration and rejects the same selection before dispatch. -- The same readiness command accepts `rehearsal.selector: "invalid/selector"`; - diagnostic identity construction rejects it. -- Default offline readiness accepts `source: {}` together with - `validation.go.race: true`. Candidate publication rejects that Go execution - selection because Go capability is disabled. Full vet and compile-target - selections have the same missing validation path. - -The CLI does not convey selector or candidate validation selections to the -readiness facade. Its credential metadata also supplies no failed declaration -check when the CI declaration is absent. A CI declaration's existence and shape -are available locally, separately from the job-secret injection that correctly -remains unchecked on a workstation. - -**Recommended remediation:** share the relevant operation-specific configuration -checks with execution and carry the necessary declaration/selector/validation -facts into readiness. Report independent configuration findings with status 2. -Keep narrower operation selection meaningful: ordinary local delivery readiness -continues to work without Woodpecker or CI credentials, and unrelated Go suite -settings need not block a delivery-only investigation. Actual CI secret values -remain job evidence. - -**Regression coverage:** add the three failing cases above, online/offline -rehearsal declaration checks, and a valid local-only delivery case. Update the -existing `TestValidateRehearsalObservesWoodpeckerWithSeparateLocalCredential` -fixture, which currently asserts success with a missing CI declaration, so its -access-observation assertions use a complete rehearsal configuration. - -## 2. Committed readiness turns local required files into committed inputs - -**Completed:** Required local files use filesystem checks in both readers. -Regression coverage verifies ignored relative/absolute keys, missing local -copies despite committed blobs, and captured module/main-package inputs. -Readiness and rehearsal suites pass. - -**Priority:** P2. **Stages:** 7, 12. - -**Relevant code:** [`Run`](../../internal/readiness/readiness.go), required-file -handling at lines 120–158; [`Start`](../../internal/rehearsal/coordinator.go) -passes the captured commit and `RequiredFiles`; and -[`startRehearsal`](../../cmd/releasekit/rehearsal.go) supplies the profile's -`readiness.required_files`. - -When `request.Commit` is set, every repository-relative required file, and every -absolute required file within the checkout, is read from Git instead of the -local filesystem. Consequently an available, readable, ignored file such as -`.releasekit/ssh-key` passes ordinary readiness but fails rehearsal readiness as -missing from the commit. Conversely a committed required file can pass that -check even when its local copy is unavailable to native authentication. - -This inadvertently requires local operator inputs inside the checkout to be -committed. The selected purpose of `readiness.required_files` includes local SSH -keys; capturing source and build inputs does not make those keys source content. -Changing the spelling to an absolute path within the same checkout does not -avoid the restriction. - -**Recommended remediation:** inspect explicitly declared local required files -through the filesystem in both working and rehearsal readiness. Continue -reading source/module/build inputs from the captured commit for rehearsal. -Keep tokens and keys outside the committed input set; no new configuration -mechanism is needed merely to distinguish these existing responsibilities. - -**Regression coverage:** an ignored local required key, in relative and absolute -forms, succeeds during rehearsal readiness; a missing local key fails even if a -same-named committed blob exists. Retain committed Go/module/main-package tests. -Adjust the required-file assertions in -`TestCommittedReadinessUsesCapturedModuleAndMainPackage`, which currently encode -the unintended committed-file requirement. - -## 3. Readiness rejects a module major supported by production identity - -**Completed:** Resolved source policy is validated directly, without inventing -a release version or rereading the declaration. Shared module tag-prefix logic -preserves ordinary, `/vN`, and `gopkg.in` majors, including `-unstable`. -Working/committed regression cases and identity, readiness, rehearsal, and CLI -readiness suites pass. - -**Priority:** P2. **Stages:** 2, 7, 12. - -**Relevant code:** `inspectSourceConfiguration` in -[shared readiness](../../internal/readiness/readiness.go), lines 281–309. - -To validate a module selection without a caller-supplied version, readiness -constructs a synthetic version from `module.SplitPathVersion` output using -`strings.TrimLeft(major, "/.") + ".0.0"`. That transformation does not preserve -all major-suffix forms already supported by the production identity resolver. - -For example, `gopkg.in/fixture.v2-unstable` is accepted by the existing module -identity implementation with the stable version `v2.0.0`. Readiness instead -constructs `v2-unstable.0.0` and reports an invalid SemVer identifier. A local -probe confirmed that production identity resolution succeeds while readiness -fails the same source selection. The `-unstable` spelling here is part of the -module path, not a requested prerelease identifier. - -**Recommended remediation:** validate normalized source/version policy directly -without inventing a release identifier where possible. Where major-version -reasoning is needed, reuse the existing Go module suffix handling rather than -reimplementing it with punctuation trimming. Keep readiness independent of a -selected release version and preserve currently supported Go module paths. - -**Regression coverage:** working and committed readiness for the supported -`gopkg.in` unstable-major form, alongside ordinary unsuffixed, `/vN`, and -`gopkg.in` major suffixes. Tests need no real module download or publication. - -## 4. A definitively rejected push strands cleanup waiting for nonexistent CI - -**Completed:** Git push errors retain definite non-dispatch/rejection evidence; -the coordinator records `not_dispatched` and cleanup removes owned local -resources without CI. Ambiguous writes retain observation-based recovery. -Native rejecting-hook, pre-dispatch, lost-acknowledgment, unavailable-observation, -Git/rehearsal, and source-publication regression checks pass. -The CLI recovery path also skips remote credential loading for confirmed -non-dispatch; an explicit saved-record cleanup/resume regression passes. - -**Priority:** P2. **Stages:** 9, 10, 12, 13. - -**Relevant code:** [`Start`](../../internal/rehearsal/coordinator.go), lines -206–215; [diagnostic Git push](../../internal/git/diagnostic.go); and -[`cleanup` and `quiescent`](../../internal/rehearsal/cleanup.go). - -Every push error is saved as `push: "unknown"` unless a subsequent query finds -the exact intended tag. Known rejection and confirmed absence receive no -distinct outcome. Cleanup then requires a terminal matching CI pipeline for -that attempt. - -A temporary bare remote with a rejecting `pre-receive` hook reproduced this: -the remote tag is absent, the record says `unknown`, and cleanup returns -`pending: no matching CI pipeline has reached completion`. Repeated cleanup -cannot complete because that rejected push triggered no pipeline. The local -diagnostic tag remains, and the command reports uncertainty instead of the known -dispatch failure. - -**Recommended remediation:** retain Git write evidence sufficient to distinguish -definite rejection or failure before dispatch from an ambiguous transport -outcome. Record the reconciled state before returning. An established -non-dispatch permits owned local cleanup without requiring a CI run. Preserve -unknown status for genuinely ambiguous writes; do not infer quiescence merely -from a timeout or an empty CI search. - -**Regression coverage:** a rejecting receive hook, failure before the push is -issued, accepted push with a lost acknowledgment, and unavailable observation. -Verify that known non-dispatch removes only owned local resources and preserves -the original push error, while uncertain dispatch retains recovery evidence. - -## 5. An already-absent tag prevents cleanup of its known hosted page - -**Completed:** Cleanup accepts confirmed tag absence for a recorded matching -page, while retaining target verification for page adoption and preserving -conflicting IDs, contents, and live targets. Missing-tag, repeated-cleanup, -conflict, and the full rehearsal suite pass. - -**Priority:** P2. **Stages:** 10, 13. - -**Relevant code:** [`cleanup`](../../internal/rehearsal/cleanup.go) accepts an -absent remote tag, but `deleteRecordedPage` subsequently requires -`TagCommit` to succeed before deleting the page. - -If the recorded diagnostic tag has already been removed while its hosted page -remains, cleanup establishes quiescence and confirms the tag's absence, then -fails the page's tag lookup. A probe with an explicitly recorded page ID, -matching title/body/tag, and an absent remote tag returned `cleanup: "unknown"` -with zero page deletions. The owned page remains indefinitely. -This is a viable Gitea state: native Git tag deletion leaves the release row -and its attachments intact, as described in -[Gitea's account of push-driven tag deletion](https://github.com/go-gitea/gitea/security/advisories/GHSA-vvqw-mjq8-x248). - -The selected partial-cleanup contract treats already-absent resources as -cleaned. Requiring the tag to remain available adds a prerequisite that defeats -recovery for this partial state. - -**Recommended remediation:** distinguish a conflicting tag from an already-absent -tag. Permit deletion of a known recorded page when its stable ID and other -ownership evidence match and the tag is confirmed absent. Keep uncertainty or -conflict when ownership cannot be established, especially when adopting a page -whose creation response was lost. Recovery should not recreate a tag to satisfy -this check. - -**Regression coverage:** absent remote tag with a matching recorded page; -already-absent page/tag; and conflicting page ID, contents, or live tag target. -Retain deletion ordering and CI-quiescence protection. - -## 6. Diagnostic CI delivery bypasses the orchestration facade - -**Completed:** `DeliverRehearsal` owns verified diagnostic CI orchestration -through shared backend/delivery conversions; the CLI retains configuration, -framing, and established exit mappings. Records preserve an immutable explicit -forge selection for recovery. Facade, binary/read-back, paired credential and -uncertain-write exit, assembled-workflow, record, and compiled boundary checks -pass. - -**Priority:** P2. **Stages:** 4, 9–11, 14. - -**Relevant code:** [`runDiagnosticDelivery`](../../cmd/releasekit/diagnostic.go) -constructs `gitea.NewBackend`, sequences preflight/dependency preparation, -assembles internal build requests, and calls `internal/delivery.Deliver` -directly. In [the root facade](../../rehearsal.go), `recoverRehearsal` also -reconstructs the destination with `ForgeGitea` rather than a recorded selection. -[Attempt records](../../internal/rehearsal/record.go) store forge coordinates -but omit the forge selector. - -The shared build/upload engine is reused, but the supported facade does not own -the assembled diagnostic CI operation. This diverges from the selected boundary -in which reusable orchestration and backend construction belong behind the -facade and the CLI owns configuration, credentials, reporting, and exits. It -also embeds Gitea assumptions in new generic paths instead of carrying the -explicit destination selection through recovery. - -The duplicated CLI branch already has an observable classification difference: -its binary preflight failures and final delivery errors return status 1 -unconditionally, whereas ordinary `ci-deliver` uses the established preflight -and uncertain-delivery exit mappings. - -**Recommended remediation:** provide a cohesive supported facade route for the -diagnostic CI operation, using shared backend selection and resolved delivery -coordination. Keep implementation types private and leave report framing in the -CLI. Carry the selected forge in attempt evidence and reconstruct it through the -same backend factory during recovery. Preserve existing credential/error -classification across production and diagnostic invocations. Additional forge -implementations or public adapter interfaces are outside this remediation. - -**Regression coverage:** exercise diagnostic CI delivery through the facade, -protect the CLI's orchestration/dependency boundary, retain explicit destination -selection through record/recovery, and compare rejected credentials and uncertain -writes across ordinary and diagnostic CI exit mapping. - -## 7. Safe job diagnostics disappear from public and CLI results - -**Completed:** The shared facade outcome conversion projects saved safe job -phase messages with attempt context, including results reconstructed by cleanup -and resume. Regression coverage retains credential, dependency, and delivery -phase messages in public results and human/JSON CLI output; focused tests pass. - -**Priority:** P2. **Stages:** 11–14. - -**Relevant code:** [`observe`](../../internal/rehearsal/coordinator.go) saves -`JobEvidence`; [`outcomeFromAttempt`](../../internal/rehearsal/cleanup.go) -constructs recovery outcomes; [`publicRehearsalOutcome`](../../rehearsal.go) -copies only `Outcome.Diagnostics`; and -[`writeRehearsalReport`](../../cmd/releasekit/rehearsal.go) renders that slice. - -The job deliberately emits safe phase messages such as `prepare build -dependencies` or `delivery credential unavailable`. Those messages survive in -the private `JobEvidence.Diagnostics` field, but no path projects them into -`Outcome.Diagnostics`. The public result and its CLI document therefore omit -the available explanation and commonly retain only the generic error that CI -delivery did not complete successfully. - -A saved-attempt probe retained a job diagnostic in the record but produced an -empty recovered diagnostic slice. Automatic cleanup also reconstructs an outcome, -so fixing only transient observation output would still lose the messages. - -**Recommended remediation:** project the saved safe job diagnostics into the -public outcome consistently after observation, automatic cleanup, and explicit -recovery. Preserve their job/attempt context. Continue omitting raw logs and -token-bearing error bodies; the producer's existing safe phase messages supply -the missing information. - -**Regression coverage:** CI credential, dependency preparation, and build failures -retain their safe explanation through start/cleanup and saved resume, in both -human and JSON reports. Keep secret-redaction assertions. - -## 8. Pagination assumes a stable snapshot of live CI history - -**Completed:** Pagination deduplicates consistent immutable identities while -retaining first-seen order and updated status observations. Partial and whole-page -overlap continue to later pages; conflicting identities fail, and a non-advancing -feed remains cancelable without an arbitrary duplicate-page limit. Woodpecker -and rehearsal suites pass. - -**Priority:** P2. **Stages:** 10, 12, 13. - -**Relevant code:** -[`MatchingPipelines`](../../internal/woodpecker/client.go), especially its -unconditional error for a repeated pipeline ID across pages. - -The [Woodpecker API](https://woodpecker-ci.org/api) exposes page-based listing. -The implementation treats overlap between pages as a malformed response. -With offset pagination, an insertion ahead of the current page can legitimately -shift a previously observed item onto the next page. A run being restarted or -new matching CI activity can therefore turn observation or cleanup into a -remote-verification failure despite readable, valid pipeline identities. - -A local HTTP probe supplied 50 items on each of the first two pages with one -overlapping ID, then the remaining item. Instead of collecting the 100 distinct -identities, the adapter returned `pagination repeated a pipeline` and discarded -the accumulated matches. The assumption that live pages form a stable snapshot -is an additional requirement on the external service. - -**Recommended remediation:** deduplicate consistent repeated identities while -continuing pagination and checking complete ref/commit identity. Handle genuine -non-progress or inconsistent identity as observation problems without declaring -ordinary overlap malformed. Preserve cancellation and uncertain-state handling; -no new history-size limit or snapshot guarantee is needed. Status progression -between duplicate observations is normal; consistency checks should concern -identity rather than requiring identical mutable status fields. - -**Regression coverage:** overlapping pages during insertion, consistent -duplicates, conflicting identity, unrelated runs, cancellation, and actual -non-progress. Retain exact matching and complete-page traversal. - -## 9. Canonical references retain obsolete unconditional module assumptions - -**Completed:** The configuration reference makes Go execution conditional and -describes production tags through the selected identifier format, linking the -separate diagnostic contract. The package inventory reflects source, calendar, -and diagnostic identity responsibilities. Prose whitespace and local links pass. - -**Priority:** P3. **Stage:** 15. - -**Relevant documentation:** [configuration](../config.md), the paragraphs -describing the standard `check`/`publish` suite and the final component of a -`ci-deliver` tag; and [the internal inventory](../internal/overview.md), the -candidate, release-identity, and version-contract responsibility descriptions. - -The configuration reference still says `check` and `publish` run a Go suite -unconditionally and that a `ci-deliver` tag ends in a stable semantic version. -Other sections correctly describe source-only and calendar behavior, and the -implementation also accepts diagnostic tags. The inventory still describes -general identity/version packages as semantic/stable-version-only components. - -These contradictions leave consumer and implementation guidance short of the -Stage 15 target and can be read as restrictions on the newly supported source -release formats and repositories. - -**Recommended remediation:** qualify Go execution by selected capability, -describe production tag components through the selected format, link diagnostic -dispatch to its separate identity contract, and refresh the affected package -descriptions. Keep the intentionally SemVer-based policy for releases of -ReleaseKit itself unchanged. - -**Verification:** compare the revised references with existing source-only, -calendar, and diagnostic fixtures; review local links and prose whitespace. - -## 10. Diagnostic dispatch intercepts valid production tag prefixes - -**Completed:** CLI and maintained bootstrap dispatch classify the complete -diagnostic spelling. Production calendar and legacy nested-module tags beneath -the same prefix follow normal delivery; manifest and foreign-selector rejection -remain intact. Identity, selector, CLI, guard, and maintained-workflow tests pass. - -**Priority:** P2. **Stages:** 2, 4, 11, 14. - -**Relevant code:** `runCIDelivery` in the -[CLI dispatcher](../../cmd/releasekit/main.go), `runDiagnosticDelivery` in -[diagnostic delivery](../../cmd/releasekit/diagnostic.go), and the diagnostic -branches in the [maintained selector](../../examples/multi-module/select-module.sh) -and [single-product workflow](../../examples/woodpecker/tag-delivery.yml). - -Production identity permits valid physical source directories and product tag -prefixes beneath `releasekit-test`. For example, a source profile with -`source.tag_prefix: "releasekit-test/product"` and date versions resolves the -production tag `releasekit-test/product/2026-12-01`. Candidate checking accepts -that selection and its ordinary release note. A second probe reproduced the -same dispatch failure for a legacy nested Go module producing -`releasekit-test/product/v1.2.3`. - -The new CI dispatcher classifies every tag starting with `releasekit-test/` as -diagnostic, before loading its production selection. An annotated production -tag from the example therefore fails with `diagnostic annotation has an invalid -marker` instead of reaching ordinary delivery. The maintained selector makes -the same prefix-only choice and rejects the tag as an invalid diagnostic -attempt, even when a production mapping row matches it. This introduces a -restriction that the production resolver and configuration contract do not -establish. Single-product workflow guards also classify this entire prefix as -diagnostic and can reject a production prefix as an unknown selector before -bootstrap. - -**Recommended remediation:** distinguish diagnostic refs by their complete -selected spelling, including the selector and 32-character lowercase hexadecimal -attempt component, and apply consistent classification in CLI and bootstrap -dispatch. Production identifiers contain version separators and can be -distinguished from diagnostic attempt IDs. Route production refs through their -production selection; retain full manifest/profile verification before -diagnostic effects. This can preserve existing production prefixes without -introducing a reserved-prefix prohibition. - -**Regression coverage:** a source-only calendar production tag with this -prefix, a legacy nested module production tag, and their normal selector/CI -delivery paths. Retain valid diagnostic dispatch and malformed/foreign manifest -rejection. Assert that production identity and CI routing agree. - -## 11. Readiness treats supported Go package patterns as literal directories - -**Completed:** Working and committed readers distinguish package patterns from -literal directories and report their resolution as unchecked. Relative and -module-qualified patterns pass readiness and real builds; a captured-pattern -rehearsal reaches dispatch. Missing literal-directory checks remain active. -Focused readiness, builder/CLI, and rehearsal regressions pass. - -**Priority:** P2. **Stages:** 7, 12. - -**Relevant code:** `inspectBuild` and `localMainPackage` in -[working readiness](../../internal/readiness/readiness.go), -`inspectCommittedBuild` in -[committed readiness](../../internal/readiness/committed.go), and the existing -[builder](../../internal/build/build.go), which passes `MainPackage` to Go. -[`Start`](../../internal/rehearsal/coordinator.go) runs committed readiness -before recording or dispatching a rehearsal. - -The builder accepts Go package patterns when Go resolves them to one main -package. A local fixture with `build.main_package: "./..."`, one root main -package, and a native target built and passed its version smoke check through -the existing CLI. Offline build readiness then failed the same configuration -with `stat /...: no such file or directory` and status 2. - -Readiness recognizes the leading `./` as a local package directory and treats -the pattern literally. Module-qualified patterns take the same path after -conversion to a relative spelling. Committed readiness likewise resolves the -pattern as a literal destination, so the mandatory rehearsal preflight prevents -these otherwise buildable profiles from reaching their existing CI build path. - -**Recommended remediation:** distinguish literal package-directory inputs from -package patterns before filesystem or committed-tree inspection. Preserve the -builder's existing accepted inputs. For patterns that require Go resolution, -report that resolution/build execution remains unchecked, consistently with -other inputs requiring execution, or resolve them through a shared offline -inspection path. Keep readily inspectable literal-directory checks and the -selected boundary against builds or dependency downloads during readiness. - -**Regression coverage:** successful working and committed readiness for a -single-main `./...` fixture and a module-qualified equivalent, plus rehearsal -preflight reaching dispatch with that profile. Pair at least one case with an -actual shared-builder success. Retain failures for missing literal directories -and keep pattern-resolution limits explicit rather than certifying a future -build. - -## 12. CI run bookkeeping performs quadratic membership scans - -**Completed:** Observation and cleanup index recorded ID/number pairs with a -transient map while retaining ordered saved evidence. Repeated observations, -new reruns, record round trips, and missing/mismatched recovery identities are -covered; active-run and deletion guards remain intact. The rehearsal suite and -focused recovery regressions pass. Membership bookkeeping is expected O(R) -per pass with O(R) index space. - -**Priority:** P3. **Stages:** 12, 13. - -**Relevant code:** `observe` and `containsID` in the -[rehearsal coordinator](../../internal/rehearsal/coordinator.go), and -`quiescent` in [cleanup](../../internal/rehearsal/cleanup.go). - -Each pass iterates matching pipelines and calls `containsID` on the growing -`attempt.PipelineIDs` slice. With `R` distinct runs and no recorded IDs, a -complete pass makes `R(R-1)/2` unsuccessful ID comparisons while inserting -them. A complete subsequent pass over the same recorded runs makes -`R(R+1)/2` comparisons. Thus local membership -bookkeeping takes O(R²) time per observation or quiescence pass, independently -of the required linear API traversal and workflow inspection. Repeated polling -repeats this cost; reruns increase `R` for the same saved attempt. - -**Recommended remediation:** build a transient map from recorded pipeline ID -to its recorded number once per operation, update it as new runs are observed, -and use it for membership checks. Rebuild it from the saved slices on recovery. -Keep the slices as the ordered encoded evidence and preserve ID/number -consistency checks. Expected membership work becomes O(R) per pass with O(R) -additional indexing space; the overall evidence already occupies O(R) space. -This change preserves complete matching-run observation and the selected -cleanup quiescence rules. - -**Regression coverage:** initial and repeated observations of several paginated -runs, newly discovered reruns, ordered ID/number evidence after recovery, and -missing or mismatched previously observed runs. Preserve existing active-run -and deletion guards. Verify the loop uses indexed membership; elapsed-time -thresholds are unnecessary. - -## 13. Package readiness enumerates more metadata than its check needs - -**Completed:** Captured package inspection lists immediate entries through a -literal, scoped Git directory operation. Working inspection uses unsorted, -bounded batches and stops at a readable input. Root/nested, unrelated subtree, -literal-path, missing/test-only, batched, and symlink regressions pass, along -with Git, readiness, and rehearsal suites. Metadata scanning is O(G) plus path -resolution; working directory batches use bounded storage. - -**Priority:** P3. **Stages:** 7, 12. - -**Relevant code:** `inspectCommittedBuild` in -[committed readiness](../../internal/readiness/committed.go), -[`git.ReadTree`](../../internal/git/source.go), and `inspectBuild` in -[working readiness](../../internal/readiness/readiness.go). - -Both readers need to establish that the selected literal package directory -contains a readable non-test Go input. The current implementations do extra -work before they can return the first acceptable input: - -- Committed readiness calls `git.ReadTree`, which runs recursive - `ls-tree -r --full-tree` for the entire commit, then filters entries by the - resolved package directory. For `N` repository entries and `G` immediate - package entries, metadata enumeration and allocation are O(N), even when - `G` stays small as unrelated repository content grows. This runs during - rehearsal preflight as well as committed input inspection. -- Working readiness uses `os.ReadDir(path)`. That helper reads all `G` entries - and sorts them before inspection, adding worst-case O(G log G) sorting and - O(G) metadata space. This existence/readability check requires neither a - complete sorted list nor a particular successful filename. - -**Recommended remediation:** after resolving the committed directory, list -that directory's immediate entries through the Git boundary, using its tree -object or a literal directory selection. Preserve captured-commit and symlink -resolution semantics. Metadata work can then depend on O(G), plus the existing -path-resolution cost, instead of the entire repository. For working inputs, -iterate an open directory with batched `File.ReadDir` calls and stop on a -readable input; this gives O(G) worst-case scanning with bounded batch storage. -Actual source-blob reading costs are separate from these metadata bounds. -Coordinate this refactor with finding 11 so package patterns retain their -supported interpretation. - -**Regression coverage:** root and nested literal packages, a small package -beside unrelated committed subtrees, readable and unreadable input candidates, -symlinked inputs, and no eligible Go files. Retain the tests that distinguish -committed inputs from a changed working checkout. Confirm scoped Git listing -and unsorted directory iteration by reviewing their respective boundaries; -no runtime threshold or public directory-size limit is needed. - -## 14. Result parsing buffers ordinary log lines that it discards - -**Completed:** The parser checks the fixed prefix and discards ordinary lines -through reusable reader fragments, accumulating only candidate result frames. -Long/chunked ordinary and result lines, near-prefix text, CRLF, unterminated -lines, equivalent/conflicting evidence, identity checks, and read-error -propagation pass in the rehearsal suite. Buffering is O(B + E), with linear -processing time and no new line-size limit. - -**Priority:** P3. **Stages:** 11, 12. - -**Relevant code:** `ReadResult` in the -[rehearsal result parser](../../internal/rehearsal/result.go). - -The parser uses `bufio.Reader.ReadString('\n')` for every log line before -checking `ResultPrefix`. `ReadString` accumulates and copies all fragments of -an arbitrarily long line. An ordinary CI output line therefore requires memory -proportional to its entire length even though the parser immediately discards -it. The existing long/chunked-log test demonstrates that these lines are valid -inputs but does not constrain their buffering strategy. - -For `L` bytes in the longest ordinary line and `E` bytes of retained or candidate -result evidence, peak parser storage includes O(L + E). Large single-line -diagnostics can dominate memory even when the actual rehearsal result is small. -Processing time is already linear in the total log bytes. - -**Recommended remediation:** inspect the fixed prefix at each line start and -consume ordinary lines through reusable `ReadSlice` fragments, discarding them -as they arrive. Accumulate only candidate result lines for the existing JSON -decoder and canonical comparison. This reduces buffering to O(B + E), where -`B` is the reader buffer, while retaining linear processing time and support -for arbitrarily long result lines. Preserve framing across reads, final lines -without a newline, CRLF handling, identity checks, equivalent retransmission, -and conflicting-result rejection. - -**Regression coverage:** retain the current long/chunked-log and result-conflict -cases; exercise long ordinary lines before and between results, partial prefixes -across reader fragments, and final unterminated lines. Review that discarded -fragments are not accumulated. This needs neither a new log-line limit nor -workload measurements.