diff --git a/openspec/changes/add-release-branches-and-backports/design.md b/openspec/changes/add-release-branches-and-backports/design.md new file mode 100644 index 0000000000..a632599dd5 --- /dev/null +++ b/openspec/changes/add-release-branches-and-backports/design.md @@ -0,0 +1,230 @@ +# Design + +## Facts checked + +Repository (origin/main at the time of writing): + +- `release-please.yml` triggers on `push` to `main` only. Its `container` job tags `latest`, `X.Y` and `X` only when a release + was created, and it builds a `nightly` tag for every other relevant push. `maven`, `jar`, `plugins` and `chart` run on + `release_created`. The `jar` job verifies its attestations with `--source-ref refs/heads/main` (also in `.github/RELEASE.md`), + so a jar built on a branch would fail verification. +- `heavy.yml` "Resolve the latest release" takes the highest `v*` tag as the previous release for the upgrade rehearsal. It + does not know about lines. +- `ci.yml`, `heavy.yml`, `dco.yml`, `openapi-diff.yml` and `codeql.yml` name `main` as the only base or push branch. + `ci.yml` also runs a nightly full pass on `main`. + +Release Please, `googleapis/release-please-action` at `v5.0.0` (commit `45996ed1f6d02564a971a2fa1b5860e934307cf7`, the SHA +pinned in `release-please.yml`), read in its `action.yml` at that commit: + +- `target-branch` is an input (default empty). The release-please manifest documentation says a manifest "must exist at the tip of + the `--target-branch`", so each branch carries its own `.release-please-manifest.json`. +- `versioning-strategy` is an input (default `default`). The release-please core accepts `always-bump-patch`, documented as + "useful for backporting bugfixes to previous major/minor release branches". Whether the input overrides a `versioning` + key in the config file is not verified yet, and the spike in the tasks checks it. +- The action has no input that sets the GitHub "Latest" flag, and nothing in its inputs creates a branch. The branch cut is + therefore a job of this repository. + +These two facts drive the design. Anything that depends on how the action behaves is tested in a spike before the workflow +change lands (tasks group 2). + +## Decision 1: the support lines live in one file + +`support-lines.json` at the repository root lists the lines in the order they are supported: + +```json +{ + "lines": [ + { "line": "2.0", "kind": "regular", "status": "latest" }, + { "line": "1.1", "kind": "regular", "status": "previous", "end_of_life": "2027-02-13" } + ] +} +``` + +The dates above are illustrative. `end_of_life` is the date the line stops receiving fixes. + +- For `kind: regular`, the check requires `end_of_life` to equal the ship date of the successor line plus 90 days. +- `kind: lts` is accepted with any `end_of_life` that is later than that. Nothing else changes (see "LTS later"). +- `.github/scripts/render_support_tables.py` writes the support table of `SUPPORT.md` and the + `Supported Versions` table of `.github/SECURITY.md` between marker comments. CI renders the tables and fails when the files + differ, so the text cannot be edited by hand and drift away. +- The same check reads the set of lines and requires a `backport:` label per non-latest line, and a release branch + `release/.x` for every non-latest line that is still open. It fails when a label or a branch is missing or when a + closed line still has a branch. + +Consequence: changing the window means changing one file and running one command. The tables and the labels follow. + +## Decision 2: a release branch is cut when the next line ships, from the last tag of the old line + +- Name: `release/..x`, for example `release/1.1.x`. The `x` stays literal, so the branch name matches the + line and not a version. +- Trigger: a release created on `main` whose version has patch 0 (`X.Y.0`). A major release counts as a new line too, so the + release that ships 2.0.0 cuts `release/1.1.x` (open question 1, settled 2026-11-17). +- Base: the tag of the last release of the old line (`v1.1.1` for `release/1.1.x`), not the tip of `main`. `main` already + holds unreleased changes for the new line, and the old line must not receive them. +- Who: a job in `release-please.yml` (`cut-release-branch`), running after a release on `main` that has patch 0. It runs with + the release bot token, so the branch can be pushed past a protection rule that allows only that actor. It is idempotent: + when the branch exists and points at the old tag, it does nothing; when it exists and points elsewhere, the job fails + and names the branch for the maintainer. +- It also creates the label `backport:` (if missing) and opens a tracking issue "Window for ends on " with + the end of life date. `support-lines.json` is not edited by the job. The job opens a pull request that adds the new line to + `support-lines.json` and re-renders the tables, and a maintainer reviews and merges it, so `main` only changes through review. +- Never earlier: no branch exists before the successor ships, so nothing needs to be maintained on a line that is not yet + superseded. Main is the only place that receives fixes until then. + +## Decision 3: Release Please on a release branch + +- The `release-please` job runs on `push` to `release/**` as well, with `target-branch: ${{ github.ref_name }}` and + `versioning-strategy: always-bump-patch`, and the existing `concurrency` group per ref. +- Each branch keeps its own `.release-please-manifest.json` (value `1.1.1` at the cut, then `1.1.2` after the first patch) and + its own `CHANGELOG.md`, which starts as a copy of the old line's changelog. +- Versions on a branch always have the branch's major and minor. `always-bump-patch` makes a backported security fix a patch + release, so a backport never moves a line to a new minor. +- Tags: `v1.1.2` on the branch commit. The tag namespace is shared with `main`, which is safe because `main` never produces a + version below its own manifest value and a branch never produces a version outside its line. The changelog of `main` + never lists a patch of an older line, and no branch is merged back into `main` (the runbook says so, and a ruleset + refuses merges from `release/**`). +- The release pull request title carries the line, for example `chore(release-1.1.x): release 1.1.2`, so a reviewer sees which + line it belongs to. The exact pattern is set in the branch configuration and checked in the spike. +- The `maven`, `plugins` and `chart` jobs run for branch releases as they do for `main`. The plugin catalogue is only + regenerated on `main`, because the catalogue lists the newest versions (open question 6). + +## Decision 4: the GitHub "Latest" flag follows the newest line + +- The action creates releases without a Latest option (checked above), and GitHub marks the most recently created + release as Latest. A `1.1.2` created after `2.0.0` would therefore take the badge. +- A step after every release, on any branch, runs `gh release edit --latest`, where `` is the highest + `v*` tag across all lines. A patch on an old line therefore never takes the badge, and the newest line keeps it. The command + is the one `gh release edit --latest` documents ("Explicitly mark the release as Latest"). +- The step is one shell script with a unit-testable core: the function that picks the newest tag from a list of tags. + +## Decision 5: container tags + +The image job keeps `X.Y.Z` on every release. Whether `X.Y` and `X` move is decided by comparing versions, not by the branch: + +| Tag | Moves when | Built from `release/1.1.x` | +|---|---|---| +| `X.Y.Z` | every release | `1.1.2` | +| `X.Y` | every release of that line, because the line is `X.Y` | `1.1`, moved to `1.1.2` | +| `X` | the release is the highest version with major `X` | `1`, moved to `1.1.2` while no `1.2` or higher exists | +| `latest` | the release is the highest version across all lines | not moved | + +- Comparison uses the existing version tags (`git ls-remote --tags`, sorted with `sort -V`), the same method + `heavy.yml` already uses. The decision is a small pure function with unit tests. +- SBOM and provenance stay on for every release (`sbom: true`, `provenance: mode=max`), as on `main`. +- Nightlies: the `nightly` tag is pushed only for `main`. The `changes` job and the `nightly` branch of the image job are + guarded with `github.ref == 'refs/heads/main'`. +- The image labels (`org.opencontainers.image.version`) carry the patch version, and the drop-in contract checks (the + upstream compose file, the adoption of an existing `/app/data`, `PUID`/`PGID`/`REPOSILITE_OPTS`) run for every image + build, because `heavy.yml` builds from whatever branch triggers it. +- The `jar` job replaces `--source-ref refs/heads/main` with the ref that built the jar (`github.ref`), in the workflow and in + `.github/RELEASE.md`. Signer identity stays the release workflow path. + +## Decision 6: CI on release branches + +- `ci.yml`, `heavy.yml`, `dco.yml`, `openapi-diff.yml` and `codeql.yml` get `release/**` as a base or push branch. The + `plugin-api` job of `ci.yml` is what keeps a backport from breaking the plugin contract, so it must run on release + branches. +- `heavy.yml`'s "Resolve the latest release" must find the previous release of the line under test. Rehearsing an upgrade + of a `1.1.x` build from a `2.0.x` image would be wrong, so the rule becomes: on a branch, the previous release is the + highest tag of the same line; on `main`, the highest tag overall, as today. +- The nightly full run in `ci.yml` covers `main` and each open release branch, so a branch gets the full pass at least + once a day. + +## Decision 7: backports + +- The trigger is `pull_request_target` with `types: [closed, labeled]`, restricted to merged pull requests into `main` with the + `backport:` label. The workflow never checks out the pull request head. It works on the squashed commit on `main` + (`merge_commit_sha`), so no code from a fork runs with write access. The helper script is loaded from `main`. +- Eligible: only a `fix` with the scope `security` (`fix(security): ...`), without `!` and without a `BREAKING CHANGE:` footer. + The previous line receives security fixes only. `fix` and `perf` stay on `main`, the current line, and ship with its next + release. Every other type, including `revert`, is refused with a comment, and a breaking marker is refused even on a security + fix, because a backport must not change the API (the `plugin-api` job checks that again on the backport pull request). + There is no force label: an accidental label on a non-security change cannot spread it to a line it was never meant for. +- The cherry-pick: `git cherry-pick -x -s ` on a branch `backport/-` created from `origin/release/.x`. + `-x` adds the `(cherry picked from commit ...)` trailer and `-s` a sign-off. The sign-off names the label actor, because the + Developer Certificate of Origin certification has to come from a person (open question 5). +- Pull request: title equal to the title of the source pull request, which is already a valid Conventional Commit. The body + states "Backport of # to `release/.x`" and links the source pull request. Base `release/.x`. The pull request + is opened by the release bot, which the sign-off check accepts as a bot pull request (`add-dco-check`, C2). The cherry-pick + trailer is not a DCO exemption on its own, because the source commit is not an ancestor of `upstream/main`. +- Conflict: the cherry-pick fails, the job aborts and removes its branch, and it comments on the source pull request with the + commands to finish the backport by hand: fetch, branch from `origin/release/.x`, cherry-pick with `-x`, resolve, + push, and open the pull request with the same title. The job status of the source pull request stays green, because the + merge to `main` succeeded; the comment is the report. +- Who merges a backport: a maintainer, with the same CI as `main`, after the branch protection rule (required review and + checks) passes. + +## Decision 8: window end and archiving + +- At `end_of_life`, the scheduled job `end-of-life` (a `schedule` in `release-please.yml`, runs daily, reads the date from + `support-lines.json`, injected as a parameter for tests) does three things through one pull request: it sets the line to + `status: archived` in `support-lines.json`, re-renders the tables and removes the `backport:` label from open + pull requests with a comment. The maintainer merges that pull request. +- Archiving the branch: the job renames `release/.x` to `archive/.x`. The commits and the tags stay, the release + workflow stops matching the branch, and a rename is reversible. Deleting the branch would also be possible, but a rename + keeps the history visible without the workflow. +- Tags are never deleted or moved. + +## Decision 9: plugin support tiers + +- `add-plugin-support-tiers` defines the tiers Core and Official. Its text says those tiers are supported "for the supported + release lines" as defined in `SUPPORT.md`. This change provides that definition through `support-lines.json` and the rendered + table, so the tier change refers to `SUPPORT.md` and does not repeat the window. +- Plugin jars for a branch release are published from that branch's release run, so a Core or Official plugin that changed + in a backport gets a patch on the line. The plugin catalogue (`generate_plugin_catalogue.py`) lists the newest versions and + is only regenerated on `main`. +- No duplicated tier text in this change. The one sentence in `SUPPORT.md` that connects both is written by this change and + names the tiers only by reference. + +## LTS later + +LTS is a non-goal. The design leaves room for it, so that an LTS line is a data change: + +- `kind: lts` in `support-lines.json`, with an `end_of_life` later than the regular rule. No workflow change, no change to + the branch cut, the backport labels, the tags or the archive job. +- The check already accepts `lts`. The rendered tables show the kind. +- Example shape for a later decision (not decided here): the first minor of each major becomes `lts` with 12 months of + support, which means `1.0` would become `kind: lts` with `end_of_life` 12 months after `2.0.0`. Whether `1.0` is kept as + an LTS line depends on whether a branch exists for it, which the cut rule already allows. +- LTS adds a policy decision the maintainer must make (which minors, how long, whether security-only). The file format is + designed so that decision costs one reviewed pull request. + +## Sequencing with pull request #22 + +- Release 2.0.0 (PR #22) is the first release that cuts `release/1.1.x`. If it merges before the cut job exists, the branch has + to be cut by hand from `v1.1.1` with the steps in the runbook, and the window clock starts on the ship date either way. +- Settled 2026-11-17: groups 3 to 9 and 13 to 14 of `tasks.md` are merged before PR #22. The release pull request itself is + not changed. + +## Risks + +- The spike may show that `versioning-strategy` does not override a `versioning` key in the config file. The fallback is a + one-line `versioning` key in each branch's `release-please-config.json`, committed by the cut job as its first commit. +- A release run on a branch that fails after the tag is pushed leaves a tag without assets. The existing `--clobber` upload + and the `container_version` rebuild input cover that, as they do on `main`. +- Shared tag namespace: a mistake that tags a branch commit with a `main` version would block that version. The version + check in the release step refuses any version outside the branch's line. +- The workflow file grows. The release decisions are moved into scripts with tests, so the YAML only wires them. + +## Open questions, settled 2026-11-17 + +The maintainer settled every question below with the default recommended in this design. The answers are binding for the code +pull requests. + +1. **Cut on a new major as well as a new minor?** Settled 2026-11-17: yes. The release that ships 2.0.0 cuts `release/1.1.x` + (Decision 2). +2. **Maintainer creates `release/1.1.x` before PR #22 or the job does it on release?** Settled 2026-11-17: the job does it, with + the sequencing above. A manual cut from `v1.1.1` stays the fallback. +3. **Tag `X` on patch releases of an older line.** Settled 2026-11-17: `1` moves to `1.1.2` while `1.1` is the highest 1.x + (Decision 5). `X` does not track only the newest line. +4. **Label naming.** Settled 2026-11-17: `backport:.`, for example `backport:1.1`, mapped to `release/1.1.x`. +5. **Sign-off identity of a backport.** Settled 2026-11-17: the sign-off of the label actor. If that person has no public email, + the job comments and the maintainer adds the sign-off before merge. +6. **Plugin catalogue for branch releases.** Settled 2026-11-17: regenerated on `main` only. +7. **Renovate on release branches.** Settled 2026-11-17: not covered. Security dependency updates for an old line are a manual + backport. +8. **Archive by rename or by deletion.** Settled 2026-11-17: rename to `archive/.x`. +9. **Confirmation of the window.** Settled 2026-11-17: the window stays as `SUPPORT.md` states it. The latest line receives every + fix, the previous line receives security fixes for 90 days after the next line ships, and older lines receive nothing. +10. **Scope of backports.** Settled 2026-11-17: only security fixes go to a previous line, marked as `fix(security)` in the pull + request title. `fix` and `perf` reach users through `main` and its next release only. The `backport:force` label is dropped. diff --git a/openspec/changes/add-release-branches-and-backports/proposal.md b/openspec/changes/add-release-branches-and-backports/proposal.md new file mode 100644 index 0000000000..b70a136caa --- /dev/null +++ b/openspec/changes/add-release-branches-and-backports/proposal.md @@ -0,0 +1,91 @@ +# Proposal + +## Why + +`SUPPORT.md` and `.github/SECURITY.md` promise that the previous minor line receives security fixes for 90 days after the +next line ships. The repository cannot keep that promise. Release Please releases only from `main` +(`release-please-config.json`, `.release-please-manifest.json`, `.github/workflows/release-please.yml`), and there is no +release branch to build a fix on. When release 2.0.0 ships (pending as PR #22), 1.1.x becomes the previous line, and a +security fix for it has nowhere to be built or published. `openspec/changes/archive/2026-11-15-document-support-policy/design.md` +records the same gap. + +The maintainer decided to make the existing support window technically real now. Long-term support (LTS) is not part of +this change. + +## What Changes + +- **Release branches.** A branch `release/..x` is created from the last tag of a line when the next line ships + on `main`. It is never created earlier. A workflow job creates it, and the branch is archived when its window ends. +- **Release Please on release branches.** Each release branch runs Release Please with `target-branch` set to the branch, + its own manifest and changelog, and `always-bump-patch` versioning. Such a branch only produces patch releases, and its + tags never collide with `main`. +- **Backports.** A label `backport:.` on a merged `fix(security)` pull request into `main` makes a bot cherry-pick the squashed + commit onto the release branch and open a pull request. No other change type is backported. A conflict is reported on the source pull request with the steps + to resolve it by hand. +- **CI, images and releases on release branches.** The checks that run for `main` run for release branches too, including + the image builds for both architectures and the drop-in contract checks. Release images carry SBOM and provenance as + `main` releases do. Tags `X.Y.Z` and `X.Y` are pushed for every release, `latest` stays on the newest line, and nightlies + stay on `main`. +- **One source for the support lines.** A file `support-lines.json` lists every line with its kind and end of life date. + The support tables in `SUPPORT.md` and `.github/SECURITY.md` and the set of `backport:` labels are generated from it or + checked against it, so the promise and the mechanism cannot drift apart. +- **Documentation.** `SUPPORT.md`, the security table, the GitBook upgrade and release-notes pages and `VERSIONING.md` + describe the same window. `.github/RELEASE.md` gets a maintainer runbook for cutting and backporting. +- **Plugins.** The support tiers of `add-plugin-support-tiers` follow the lines defined here. That change is referenced, not + duplicated (see the design, section "Plugin support tiers"). + +### Out of scope + +- **LTS.** No line is long-term supported by this change. The file format and the checks are designed so that LTS is a + policy and configuration change later (see the design, section "LTS later"). The example of "first minor of each major, + 12 months" is an example only. +- Renovate updates for release branches. Dependency updates keep targeting `main`. +- Changes to the upstream Reposilite line. It is not covered by this policy. +- Changing the `main` release flow, the version scheme or the Conventional Commits rules. +- Branch protection and rulesets in the GitHub settings. They are described in the runbook and set by a maintainer. +- Creating `release/1.1.x` by hand before pull request #22 ships. The cut job creates it when 2.0.0 ships (open question 2, + settled 2026-11-17). + +## Capabilities + +### New Capabilities + +- `release-lines`: the support lines, how a release branch is cut, what Release Please, the container tags and the GitHub + Latest flag do on a branch, when a line ends, and how the support tables follow the lines file. +- `backports`: how a change reaches a release branch, which change types may go there, how a conflict is reported, and what + a backport pull request must carry. + +## Impact + +- **Type and scope.** The mechanism ships under `ci(release)`. Documentation commits inside the same pull requests keep their + own types (`docs(support)`, `docs(release)`), one type per commit, as `add-dco-check` does. The squash commit on `main` carries + the title of the pull request. The title of the code pull request series is: + + `ci(release): add release branches and backport automation` + + The proposal pull request is titled `docs(openspec): propose add-release-branches-and-backports`. +- **Breaking marker.** No breaking change for an operator. No configuration key, environment variable, volume, image name or + manifest changes. Tags `X.Y.Z` and `X.Y` are added to images that already exist under the same names. The tag `X` keeps its + current meaning (see the design, section "Container tags"). `latest` keeps pointing at the newest release. +- **Behaviour that changes.** A release line that is not the newest one can now receive a patch release from its own branch. + The GitHub "Latest" badge follows the newest line, not the most recent release. +- **Dependencies on other changes.** + - `add-plugin-support-tiers`: its tier text refers to the supported release lines defined in `SUPPORT.md`. This change + defines those lines. Neither blocks the other. No open pull request for that change was found at the time of writing + (`gh pr list -R OneLiteFeatherNET/ingot --search add-plugin-support-tiers` returned nothing), so the reference is by + change name only. + - `add-dco-check`: the backport pull requests must pass the sign-off check, and the check must also run for release branches. + - `add-repository-trust-files` and `document-support-policy`: both touch `.github/SECURITY.md` or `SUPPORT.md`. This change + replaces the window text those files carry, so it lands after them or rebases onto them. +- **Code.** `.github/workflows/release-please.yml`, `ci.yml`, `heavy.yml`, `dco.yml`, `codeql.yml`, `openapi-diff.yml`, + `.github/scripts/` (new helper scripts and their tests), `support-lines.json`, `SUPPORT.md`, `.github/SECURITY.md`, + `.github/RELEASE.md`, `VERSIONING.md` and `docs/gitbook/release-notes/`. + +## Verification + +- `openspec validate add-release-branches-and-backports --strict --no-interactive` passes. +- `grep -rnP '[\x{2013}\x{2014}]' openspec/changes/add-release-branches-and-backports` prints nothing. +- Every helper script and its unit tests are written first and fail until the script exists. The tests create their own + temporary directories and inject the date, so no test reads the clock or the network. +- The first code pull request that touches the release workflow is checked on a fork or on a throwaway branch before it + reaches `main`, because the action behaviour in the design is verified by a spike and not by reading alone. diff --git a/openspec/changes/add-release-branches-and-backports/specs/backports/spec.md b/openspec/changes/add-release-branches-and-backports/specs/backports/spec.md new file mode 100644 index 0000000000..1b3d8de568 --- /dev/null +++ b/openspec/changes/add-release-branches-and-backports/specs/backports/spec.md @@ -0,0 +1,101 @@ +# Spec Delta + +## Purpose + +A fix that lands on `main` reaches a supported release line through a reviewed pull request, and a change that cannot be applied +cleanly is reported to the people who can resolve it. Only security fixes reach a previous line; everything else ships with the +next release of `main`. + +## ADDED Requirements + +### Requirement: A backport label starts a backport + +A merged pull request into `main` that carries a label `backport:.` for a line with a release branch and whose title +is an eligible security fix SHALL get a backport pull request into `release/..x`, opened by the release bot. + +#### Scenario: A labelled security fix gets a backport pull request + +- **WHEN** a merged `fix(security)` pull request carries `backport:1.1` and `release/1.1.x` exists +- **THEN** a pull request into `release/1.1.x` is opened with the same title as the source pull request + +#### Scenario: A label for a line without a branch is refused + +- **WHEN** the label names a line that has no release branch +- **THEN** no branch is created and the source pull request receives a comment that names the missing line + +### Requirement: Only security fixes are backported to a previous line + +Only a `fix(security)` commit SHALL be backported to a previous line. Every other change SHALL stay on `main` and SHALL NOT be +backported, whatever labels it carries. + +#### Scenario: A security fix is backported + +- **WHEN** a merged pull request titled `fix(security): ...` without a breaking marker carries a backport label for a line with a branch +- **THEN** a backport pull request is opened into that release branch + +#### Scenario: A non-security fix is refused + +- **WHEN** a merged pull request titled `fix: ...` carries a backport label +- **THEN** no backport pull request is opened and the source pull request receives a comment that says the fix ships with the next release of `main` + +#### Scenario: A change that is not a security fix is never backported + +- **WHEN** a `docs`, `test`, `build`, `ci`, `refactor`, `chore` or `revert` pull request carries a backport label +- **THEN** no backport pull request is opened + +#### Scenario: A performance change is refused + +- **WHEN** a merged pull request titled `perf: ...` carries a backport label +- **THEN** no backport pull request is opened and the source pull request receives a comment that gives the reason + +#### Scenario: A feature is refused + +- **WHEN** a merged pull request with title type `feat` carries a backport label +- **THEN** no backport pull request is opened and the source pull request receives a comment that gives the reason + +#### Scenario: A breaking security fix is refused + +- **WHEN** a merged pull request titled `fix(security)!: ...` or with a `BREAKING CHANGE:` footer carries a backport label +- **THEN** no backport pull request is opened + +#### Scenario: No label overrides the security-only rule + +- **WHEN** a merged pull request titled `docs: ...` carries a backport label and any other label +- **THEN** no backport pull request is opened + +### Requirement: A backport keeps the commit conventions + +A backport commit SHALL keep the message of the source commit, including its Conventional Commits title, and SHALL carry a sign-off +line. It SHALL contain no AI attribution, no `Co-Authored-By` trailer for a tool and no session link. The pull request body SHALL +name the source pull request. + +#### Scenario: The backport commit is signed off + +- **WHEN** the cherry-pick succeeds +- **THEN** the commit message contains a `Signed-off-by` line naming the actor who applied the label, and the + `(cherry picked from commit ...)` trailer + +#### Scenario: The label actor has no public email + +- **WHEN** the actor who applied the label has no public email address +- **THEN** the job comments on the source pull request, and the maintainer adds the sign-off before the backport is merged + +### Requirement: A conflict is reported on the source pull request + +When the cherry-pick conflicts, the job SHALL abort, remove its branch and comment on the source pull request with the commands a +maintainer runs to finish the backport by hand. + +#### Scenario: A conflicting cherry-pick leaves a comment and no branch + +- **WHEN** the cherry-pick of a source commit conflicts on `release/1.1.x` +- **THEN** the source pull request receives one comment with the manual steps and no backport branch remains on the remote + +### Requirement: Backports never reach main + +A release branch SHALL NOT be merged into `main`. A change reaches `main` first and is cherry-picked to a release branch, never the +other way round. + +#### Scenario: A pull request from a release branch into main is refused + +- **WHEN** a pull request has `release/1.1.x` as its head and `main` as its base +- **THEN** the check fails and the pull request is not merged diff --git a/openspec/changes/add-release-branches-and-backports/specs/release-lines/spec.md b/openspec/changes/add-release-branches-and-backports/specs/release-lines/spec.md new file mode 100644 index 0000000000..f84f494e62 --- /dev/null +++ b/openspec/changes/add-release-branches-and-backports/specs/release-lines/spec.md @@ -0,0 +1,125 @@ +# Spec Delta + +## Purpose + +A release line that is still supported can receive a patch release from its own branch, the support tables and the labels say +the same thing as the mechanism, and `latest` keeps pointing at the newest line. + +## ADDED Requirements + +### Requirement: The support lines are listed in one file + +The repository SHALL list every release line in `support-lines.json`, with its kind (`regular` or `lts`) and its end of life +date. The support tables in `SUPPORT.md` and `.github/SECURITY.md` and the set of `backport:` labels SHALL be generated from or +checked against that file. + +#### Scenario: A table that differs from the file fails the check + +- **WHEN** the rendered support table of `SUPPORT.md` differs from the table rendered from `support-lines.json` +- **THEN** the check fails and names the file + +#### Scenario: A regular line ends 90 days after its successor ships + +- **WHEN** a line with kind `regular` has a successor released on a given date +- **THEN** its end of life date is that date plus 90 days + +### Requirement: A release branch is cut when the next line ships + +A release branch `release/..x` SHALL be created from the last tag of the previous line when a release with patch +version 0 is created on `main`, whether that release is a minor or a major release. The branch SHALL NOT be created before that release. The branch SHALL point at the previous +line's last tag, not at the tip of `main`. + +#### Scenario: No branch exists while the line is the newest + +- **WHEN** the newest line has not been superseded +- **THEN** no release branch exists for it + +#### Scenario: The branch starts at the last release of the old line + +- **WHEN** release 2.0.0 is created on `main` and the last release of the 1.1 line is `v1.1.1` +- **THEN** `release/1.1.x` points at the commit of `v1.1.1` + +#### Scenario: An existing branch that points elsewhere is not overwritten + +- **WHEN** the branch already exists and does not point at the last tag of the old line +- **THEN** the cut job fails and does not move the branch + +### Requirement: Release Please produces only patch releases on a release branch + +Release Please SHALL run for each release branch with that branch as its target, its own manifest and its own changelog, and with +the `always-bump-patch` versioning strategy. Every version it produces on a branch SHALL have the branch's major and minor. + +#### Scenario: A backported security fix is a patch release + +- **WHEN** a `fix(security)` commit is backported to `release/1.1.x` and released +- **THEN** the version is `1.1.` + +#### Scenario: A version outside the line is refused + +- **WHEN** a release run on `release/1.1.x` would produce a version that does not start with `1.1.` +- **THEN** the release step fails before a tag is created + +### Requirement: The GitHub Latest flag and the container latest tag stay on the newest line + +The GitHub release marked Latest SHALL be the highest version tag across all lines. The container tag `latest` SHALL point at the +highest version across all lines. A release on an older line SHALL NOT move either of them. + +#### Scenario: A patch on an old line leaves latest alone + +- **WHEN** `1.1.2` is released from `release/1.1.x` while `2.0.0` is the highest version +- **THEN** the Latest flag and the container tag `latest` still refer to `2.0.0` + +#### Scenario: The version tag of the old line moves with its patches + +- **WHEN** `1.1.2` is released from `release/1.1.x` +- **THEN** the container tags `1.1.2` and `1.1` point at that image, and the tag `1` points at it while no version `1.2` or higher exists + +### Requirement: Nightly images are built from main only + +The rolling `nightly` container tag SHALL be pushed only for runs on `main`. A push to a release branch SHALL NOT move it. + +#### Scenario: A push to a release branch leaves nightly alone + +- **WHEN** a commit is pushed to `release/1.1.x` and no release is created +- **THEN** no image is pushed and the `nightly` tag is unchanged + +### Requirement: Release branches get the checks of main + +Pull requests into release branches SHALL run the same checks as pull requests into `main`, including the image builds for both +architectures, the drop-in contract checks and the plugin API check. Release images SHALL carry an SBOM and provenance. + +#### Scenario: A backport that breaks the plugin API fails its check + +- **WHEN** a pull request into `release/1.1.x` changes the plugin API +- **THEN** the plugin API check fails and the pull request cannot be merged + +### Requirement: The support window of each line is fixed + +The newest line SHALL receive every fix. The previous line SHALL receive security fixes for 90 days after the next line ships. +Older lines SHALL receive no fixes. The window SHALL be stated in `SUPPORT.md` and in `.github/SECURITY.md` from the same file. + +#### Scenario: The previous line keeps security fixes for 90 days + +- **WHEN** release 2.0.0 ships on a given date +- **THEN** the end of life date of the 1.1 line is that date plus 90 days + +### Requirement: A window ends with a reviewed change + +When a line reaches its end of life date, a scheduled job SHALL open a pull request that marks the line archived in +`support-lines.json`, re-renders the tables and removes the `backport:` label from open pull requests. The branch SHALL be +renamed to `archive/.x`. Tags SHALL NOT be deleted or moved. + +#### Scenario: The window ends on the date in the file + +- **WHEN** the scheduled job runs on or after the end of life date of a line +- **THEN** it opens the archiving pull request for that line and changes nothing else + +### Requirement: LTS is a data change + +A line with kind `lts` SHALL be accepted by the check with any end of life date later than the regular one, and adding such a line +SHALL NOT require a change to the release workflow. + +#### Scenario: An LTS line is added as data only + +- **WHEN** a line with kind `lts` and a longer end of life date is added to `support-lines.json` +- **THEN** the check passes and no workflow file changes diff --git a/openspec/changes/add-release-branches-and-backports/tasks.md b/openspec/changes/add-release-branches-and-backports/tasks.md new file mode 100644 index 0000000000..6c6f7b2061 --- /dev/null +++ b/openspec/changes/add-release-branches-and-backports/tasks.md @@ -0,0 +1,120 @@ +# Tasks + +Each group is one or more commits, and each commit has one Conventional Commits type. The mechanism ships under `ci(release)`, +the documentation under `docs(support)` and `docs(release)`. Every helper script is written with its unit tests first and the +tests fail until the script exists. The tests follow F.I.R.S.T.: no sleep, the date injected as a parameter, no network, a +temporary directory per test and no shared state. Groups 3 to 12 are one pull request each, unless noted, and each pull request +builds and passes on its own. + +## 1. Proposal + +- [ ] 1.1 `docs(openspec): propose add-release-branches-and-backports`: this change and nothing else, branched from the remote + main. Verify: `openspec validate add-release-branches-and-backports --strict --no-interactive` passes and the dash grep from + the proposal prints nothing. The proposal pull request is merged before the first code pull request is opened. + +## 2. Spike and maintainer decisions + +- [ ] 2.1 Spike on a throwaway repository (a fork, not `main`): with release-please-action at the pinned SHA `45996ed`, check that + `target-branch` reads the manifest and config of the branch, that `versioning-strategy: always-bump-patch` overrides a + `versioning` key in the config file or not, and the release pull request title pattern for a branch. Record the answers in the + first code pull request description. Verify: each claim in the design, section "Facts checked", is either confirmed or + corrected in the design before group 6 starts. +- [ ] 2.2 The maintainer confirmed the open questions of the design (1 to 9) on 2026-11-17, in particular the window, cutting on a + major, the meaning of tag `X`, the label name and the archive method. Verify: the answers are recorded in design.md, section + "Open questions, settled 2026-11-17". +- [ ] 2.3 Sequencing: the maintainer decided on 2026-11-17 that pull request #22 (release 2.0.0) waits until groups 3 to 9 and + 13 to 14 are merged. Verify: the decision is written on PR #22 before it is merged. + +## 3. Support lines + +- [ ] 3.1 `ci(release)`: add `.github/scripts/render_support_tables.py` and its tests. The script reads `support-lines.json` and + renders the support table and the label set; the tests cover a regular line, an LTS line with a later end of life date, and a + regular line whose end of life date is wrong. Add `support-lines.json` with the lines as they are today. Verify: the tests pass + and the script output is deterministic. +- [ ] 3.2 `docs(support)`: render the support table of `SUPPORT.md` and the `Supported Versions` table of `.github/SECURITY.md` + from the script, between marker comments, and state the window in `SUPPORT.md` as confirmed in 2.2. Do not touch the contact + section of `.github/SECURITY.md`. Verify: running the script changes nothing in the two files. +- [ ] 3.3 `ci(release)`: add a `support-lines` job to `ci.yml` that runs the renderer in check mode, verifies the `backport:` + labels and the existence of `release/.x` for each open non-latest line. Verify: the job fails on a deliberately wrong + date in a test fixture and passes on the repository. + +## 4. Release tags + +- [ ] 4.1 `ci(release)`: add `.github/scripts/release_tags.py` and its tests. Pure functions: the newest tag across lines, the + highest version with a given major, the tag set for a release (`X.Y.Z`, `X.Y`, `X` and `latest` as decided in the design), and + the refusal of a version outside the branch's line. Verify: the tests cover `1.1.2` on `release/1.1.x` with `2.0.0` present, + and `2.0.0` on `main`, and pass without a network. + +## 5. Workflow triggers on release branches + +- [ ] 5.1 `ci(release)`: add `release/**` to the base or push branches of `ci.yml`, `heavy.yml`, `dco.yml`, `openapi-diff.yml` + and `codeql.yml`. Verify: the workflows parse, and a pull request into a test release branch runs the checks of `main`. + +## 6. Release Please on release branches + +- [ ] 6.1 `ci(release)`: `release-please.yml` runs on `push` to `release/**` with `target-branch: ${{ github.ref_name }}` and the + versioning strategy from 2.1. It refuses a release whose version is outside the branch's line, using `release_tags.py`. The + `concurrency` group stays per ref. Verify: a dry run on the throwaway repository from 2.1 produces a patch version and a + release pull request against the branch only. + +## 7. Container images and jars + +- [ ] 7.1 `ci(release)`: the image job takes its tags from `release_tags.py`, builds `nightly` only on `main`, and keeps SBOM and + provenance for every release. Verify: the tags for a `1.1.2` release on a branch are `1.1.2`, `1.1` and `1` while no higher + major exists, and no `latest`. +- [ ] 7.2 `ci(release)`: the `jar` job verifies its attestations with `--source-ref` set to the ref that built the jar, and + `heavy.yml` resolves the previous release of the same line on a branch. `.github/RELEASE.md` is updated in group 13, not here. + Verify: the workflow parses and the heavy previous-release rule has a test in `release_tags.py`. + +## 8. GitHub Latest + +- [ ] 8.1 `ci(release)`: a step after every release runs `gh release edit --latest`, with the newest tag chosen by + `release_tags.py`. Verify: on the throwaway repository a patch on the old line keeps the Latest flag on the newest line. + +## 9. Cutting a release branch + +- [ ] 9.1 `ci(release)`: add `.github/scripts/release_branch.py` and its tests for the cut decision (patch 0 on `main`, base tag + of the previous line, idempotence, refusal when the branch points elsewhere), and the `cut-release-branch` job that creates the + branch, the `backport:` label and the tracking issue. The job opens the pull request that adds the line to + `support-lines.json`. Verify: the tests pass and the throwaway repository gets its branch from `v1.1.1` once and not twice. + +## 10. Backport decisions + +- [ ] 10.1 `ci(release)`: add `.github/scripts/backport_decision.py` and its tests: label parsing, the security-only rule (`fix(security)` + accepted, every other type refused, the breaking marker), and the refusal of a label for a line without a branch. Verify: each rule in the backports spec has a + failing test first. + +## 11. Backport workflow + +- [ ] 11.1 `ci(release)`: add `.github/workflows/backport.yml` on `pull_request_target` (`closed`, `labeled`), restricted to merged + pull requests into `main`. It never checks out the pull request head. It cherry-picks the merge commit with `-x -s`, opens the + pull request as the release bot, and on conflict aborts, removes its branch and comments on the source pull request with the + manual steps. Verify: on the throwaway repository a labelled fix opens one pull request, and a conflicting one opens none and + leaves one comment. + +## 12. End of a window + +- [ ] 12.1 `ci(release)`: a `schedule` job in `release-please.yml` that reads the end of life dates from `support-lines.json`, with the + date passed in as a parameter, opens the archiving pull request, and renames the branch to `archive/.x` once that pull + request is merged. Verify: the tests for the date decision pass, and the job changes nothing before the end of life date. + +## 13. Maintainer runbook + +- [ ] 13.1 `docs(release)`: add a section "Release branches and backports" to `.github/RELEASE.md`, covering the cut, the manual cut + from the last tag, the backport label and the conflict steps, the window end, the branch protection and the rule that no release + branch merges into `main`. Replace `--source-ref refs/heads/main` in `.github/RELEASE.md` with the ref that built the jar. Link the + section from `.github/MAINTAINING.md` under "Versions". Verify: every command in the section runs on the throwaway repository. + +## 14. Public documentation + +- [ ] 14.1 `docs(support)`: update `docs/gitbook/release-notes/upgrade-changes.md` (supported upgrade paths for the lines), + `docs/gitbook/release-notes/release-notes.md` (how a release line and a backport appear in the changelog) and `VERSIONING.md` + (the lines and the tags). The table in `SUPPORT.md` already comes from group 3. Verify: every link resolves and the pages agree + with `support-lines.json`. + +## 15. Pull requests + +- [ ] 15.1 Open the code pull requests in the order of groups 3 to 14, each under its own title, starting with `ci(release): add + the support lines file and its renderer`. Groups 3 to 9 and 13 to 14 go before pull request #22 is merged, if the maintainer + decided so in 2.3. Each description follows `.github/PULL_REQUEST_TEMPLATE.md`, carries no session link and states that + no release branch exists until the cut. Verify: `gh pr list -R OneLiteFeatherNET/ingot --search 'ci(release)'` lists the series in order.