Skip to content

fix(release): give a crate added since the last release a first-release tag pattern, and check both ends - #222

Merged
aRustyDev merged 1 commit into
mainfrom
fix/release-plz-new-crate
Nov 16, 2026
Merged

aRustyDev merged 1 commit into
mainfrom
fix/release-plz-new-crate

Conversation

@aRustyDev

Copy link
Copy Markdown
Owner

The release-pr job has failed on main since #211, so no release-candidate pull request can be made:

cannot find package "thrust-edge" in workspace "/tmp/release-plz-thrust-contracts-…/worktree"

Why

Every crate finds its previous version from the one tag, v<version>. release-plz 0.4.3 then rebuilds that tag's
workspace and looks the crate up in it (next_ver.rs, process_git_only_package). thrust-edge is not in v0.2.0.
release-plz treats a crate as a first release only when no tag matches its pattern. I found no upstream issue for this.

(#211 also left Cargo.lock with thrust-edge at 0.1.0, which failed every --locked job. #221 has since rewritten that
line, so it needs no pull request.)

The change

  • release-plz.toml: thrust-edge gets a first-release pattern, git_tag_name = "thrust-edge-v{{ version }}",
    which matches no tag. The header explains the rule.
  • check-release-plz.py:
    • A git_tag_name may only be the entry's own first-release pattern, and never on the tagger.
    • New --first-release, compared against the highest v<major>.<minor>.<patch> tag, by package name. A crate that only
      moved directory is not new: chore: move every crate into its ADR-0009 directory (crates-layout PR 3) #221's moved crates pass.
    • required, in ci.yml's deps job (its checkout now has fetch-tags: true): every crate the tag lacks has its
      pattern. The pull request that adds a crate adds its pattern too.
    • exact, in release-plz.yml's release-pr job before release-plz runs: no crate the tag has keeps a pattern.
      That job runs after release, so it sees the tag of a release made by the same push.
    • Why exact is not in deps: from the moment a release is tagged until the pattern is removed, it would fail
      every pull request, and main's run of the release commit itself.
  • cicd.md: a "A new crate" bullet under Release candidates, and how it was verified.

What to expect after merging

  1. release-pr turns green but proposes nothing yet. release-plz counts a crate's commits by its current directory,
    so feat(edge): route the shared hostname to production or to an opted-in target, decided by Flagship #211's feature, made under crates/thrust-edge/, stopped counting when chore: move every crate into its ADR-0009 directory (crates-layout PR 3) #221 moved the crate to crates/edge/, and
    the move itself is a chore. The next feat or fix in a crate opens the candidate. A first release's own commits do
    not set the bump, so a feature only in the edge would propose a patch.
  2. feat(edge): route the shared hostname to production or to an opted-in target, decided by Flagship #211's feature reaches a changelog only by hand. To get it there, make the release by hand as cicd.md describes
    (the rc/manual-<version> branch), or add its line to the candidate.
  3. One cleanup after the first release that contains thrust-edge. Delete the pattern line. The release-pr job
    fails until you do, and names the line.

Verified with release-plz 0.4.3, on clones of main

Case Result
at #218, main's release-plz.toml exit 1, the CI error
at #218, this release-plz.toml exit 0; proposes 0.2.1 with #211's feature; the candidate's Cargo.lock passes cargo metadata --locked
at #221, main's / this release-plz.toml exit 1, the same error / exit 0, nothing to propose (above)
at #221 + a fix(edge) proposes 0.2.1
then v0.2.1 tagged + a second fix, pattern kept 0.2.2 lists the first fix (and the move) again; --first-release exact refuses it
the same, pattern removed 0.2.2 lists only the second fix; exact passes

On this repository:

  • --first-release required refuses main's release-plz.toml, naming only thrust-edge, and passes with this one;
  • exact passes.

Tests: test_check_release_plz.py passes 151, over generated git histories for every crate. Nine hand mutants of the
checker each make it fail:

  • the last release chosen by name order, or a pre-release counted as one;
  • exact never refusing, or always refusing;
  • any pattern value accepted, or the tagger allowed one;
  • no tag passing;
  • crates compared by directory;
  • a patterned crate still required.

Local CI checks: all 12 steps of the deps job pass, as do actionlint, test-lint-all-workflows.sh,
test-lint-workflow.sh, test-required-contexts.sh and test_plan_ci.py (5013).

Not verified

  • fetch-tags: true at depth 1 on the runner. The source of actions/checkout at the pinned commit adds
    +refs/tags/*:refs/tags/* to the fetch. This pull request's deps job is the check: without the tags, the guard exits
    2 rather than passing.
  • The release-pr step on main. It runs only after a merge.

Refs #195

🤖 Generated with Claude Code

…se tag pattern, and check both ends

release-pr has failed on main since #211: `cannot find package "thrust-edge" in workspace`. Every crate finds its previous
version from the one tag v<version>; release-plz 0.4.3 then rebuilds that tag's workspace and looks the crate up in it
(next_ver.rs, process_git_only_package), and thrust-edge is not in v0.2.0. A crate is treated as a first release only
when no tag matches its pattern.

- release-plz.toml: thrust-edge gets git_tag_name = "thrust-edge-v{{ version }}", which matches no tag. The header says
  why, and that the pattern goes once a release contains the crate.
- check-release-plz.py: a git_tag_name may only be the entry's own first-release pattern, and never on the tagger. New
  --first-release, against the highest v<major>.<minor>.<patch> tag, comparing package names (a moved crate is not new):
  - `required`: every crate the tag lacks has its pattern. Run by ci.yml's deps job, whose checkout now fetches the tags.
  - `exact`: and no crate the tag has keeps one. Run by release-plz.yml's release-pr job before release-plz. It is not
    run in deps, where from the tag of a release to the pattern's removal it would fail every pull request, and main's run
    of the release commit.
- cicd.md: "A new crate", and how it was verified.

Verified with release-plz 0.4.3 on clones of main:
- at #218: release-plz update exits 1 with the CI error on main's config; with this one it exits 0 and proposes 0.2.1
  with #211's feature in the changelog. The candidate's Cargo.lock passes cargo metadata --locked. A first release's own
  commits do not set the bump (a feature alone proposed the patch).
- at #221 (every crate moved, ADR-0009): the same error on main's config. With this one, exit 0 and nothing to propose:
  release-plz counts a crate's commits by its current directory, so #211's feature (made under crates/thrust-edge) no
  longer counts and the move is a chore. #211's feature reaches a changelog only through a release made by hand.
- then a fix(edge) commit proposes 0.2.1. With v0.2.1 tagged and a second fix: with the pattern kept, 0.2.2's section
  lists the first fix (and the move) again, and --first-release exact refuses it; with it removed, only the second fix,
  and exact passes.
- on this repository: --first-release required refuses main's release-plz.toml (thrust-edge only: the moved crates are
  found in v0.2.0 by name) and passes with this one; exact passes.
- test_check_release_plz.py: 151 passed, over generated git histories for every crate. Nine hand mutants of the checker
  (name-order or pre-release tags as the last release, exact never or always refusing, any pattern value accepted, the
  tagger's pattern allowed, no tag passing, crates compared by directory, a patterned crate still required) each fail it.
- lint-all-workflows.sh, actionlint, test-lint-all-workflows.sh, test-lint-workflow.sh, test-required-contexts.sh and
  test_plan_ci.py (5013) pass.

Not verified: actions/checkout with fetch-tags at depth 1 on the runner. Its source at the pinned commit adds
+refs/tags/*:refs/tags/* to the fetch; this pull request's deps job is the check.

Refs: #195
Co-Authored-By: Claude Opus 5.5 <[email protected]>
@aRustyDev
aRustyDev merged commit 7e493d6 into main Nov 16, 2026
38 checks passed
@aRustyDev
aRustyDev deleted the fix/release-plz-new-crate branch November 16, 2026 20:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant