fix(scripts): validate every release tag and gate --apply on origin/main

A mis-cut tag could serve as the start point and silently drop the runs
before it: x-v9.9.9 or a lightweight x-v1.0.1 on a later landing hid an
untagged 1.1.0 and --apply succeeded. Every reachable <p>-v<semver> tag is
now validated (annotated, peels to a landing of its own version); an
invalid one is an ERROR row naming it, blocks --apply, and is never the
start point.

Also from review:
- --apply needs origin/main and a ref on it; no local-main fallback.
- A version with literal quotes is invalid, not stripped.
- Plugin dirs are listed NUL-separated; a leading-dash name exits 2.
- With no tags, the backfill starts at the current version's first
  landing, so a recurring version is released once, there (Case 2, 12d).
- expect_row ERE-escapes plugin and version.

ADR-0033 updated to match.

Refs: #223

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_014uGZTNugst7K9Bd2FTR4Mi
This commit is contained in:
Defame1297andClaude Opus 5.5 committed 2026-11-27 18:14:23 +00:00
1 parent b3cdcc9bbb
commit b3fd1f2f0c
3 files changed
+194 -37

No files matched your search

@@ -38,7 +38,9 @@ Two facts limit where enforcement can live:
landed on `main`, never a feature-branch commit. An `apm.yml` edit that leaves `version:` alone
does not start a new run.
- **Immutability.** Tags are never moved, overwritten or silently re-cut. A tag that is lightweight
or that peels to no landing of its version is reported as an error for a human to resolve.
or that peels to no landing of its version is reported as an error for a human to resolve. Every
reachable `<plugin>-v*` tag is checked this way, not only those of the wanted runs, and an
invalid one never decides where the wanted runs start, so it cannot hide the versions before it.
- **A version is released once, at its first landing.** When a version comes back (a reverted
bump, or an `apm.yml` deleted and re-added), the later run is not tagged again: its tag already
exists on the earlier run, so the script reports that run `RELEASED` and it blocks nothing. An
@@ -47,14 +49,17 @@ Two facts limit where enforcement can live:
- **Mechanism.** `scripts/tag-plugin-releases.sh` computes the targets from `origin/main`'s
history and cuts the tags after merge. Without arguments it is a dry run: it prints a
`plugin version commit status` table and exits 1 if any tag is missing. `--apply` creates the
missing tags locally, and only when no error exists anywhere (all or nothing). It then prints the
missing tags locally, and only when no error exists anywhere (all or nothing) and the commit read
is on `origin/main`; it never falls back to the local `main`. It then prints the
exact `git push origin <tag>…` line, naming each tag explicitly and never using `--tags`. The
script never fetches and never pushes. No hook gates any of this.
- **Which versions are wanted.** If a plugin already has a `<plugin>-v*` tag reachable from
- **Which versions are wanted.** If a plugin already has a valid `<plugin>-v*` tag reachable from
`main`, the script wants every version run from the newest such tag onward, including a reverted
version's run, which then reports `RELEASED` as above. If it has none, the script wants only the
current run. That second rule is the backfill: older history is not
tagged retroactively.
version's run, which then reports `RELEASED` as above. If it has none, the script wants every run
from the first landing of the current version onward, so the current version is tagged at its
first landing anywhere in history and any later run of it reports `RELEASED`; when the current
version never recurred, that is the current run alone. That second rule is the backfill: older
history is not tagged retroactively.
- **One deliberate exception to the backfill: git's previous version, `git-v1.3.8`, is also
tagged**, on `32fbe39fb8923854ca8e743a0d2cad81720c736c`, where 1.3.8 first landed on `main`. This
gives a consumer pinned to an older git tag something real to check `apm outdated` against. It is