Skip to content

docs(agents): derive the dev-version N from main's declared version, not a commit count - #32

Open
defl wants to merge 1 commit into
mainfrom
fix/agents-dev-version
Open

docs(agents): derive the dev-version N from main's declared version, not a commit count#32
defl wants to merge 1 commit into
mainfrom
fix/agents-dev-version

Conversation

@defl

@defl defl commented Jul 29, 2026

Copy link
Copy Markdown
Owner

The N = git rev-list LAST_TAG..HEAD --count rule in AGENTS.md regresses as soon as PRs are squash-merged.

A branch counts its own commits since the tag, but the squash lands on main as a single commit — so main's own count sits well below the number the last merged branch declared. The next branch then computes a lower N than main already has, and apt stops treating the build as an upgrade, which is the one thing the scheme exists to guarantee.

Hit this on #31 earlier today: main declared 4.0.1.dev11 while its own rev-list count was 7, so a two-commit branch computed dev.9. I had to override it by hand to dev.12 to avoid shipping a version that went backwards.

Change

N is now CUR + 1, where CUR is the dev number declared in python/pyproject.toml on origin/main. Monotonic by construction, and it needs no history archaeology.

Two smaller fixes to the same block:

  • Prerelease suffix. "parse LAST_TAG (strip leading v, split on .)" gives PATCH = "0-beta1" for the current tag v4.0.0-beta1. Now says to drop the prerelease suffix.
  • Concurrent branches. Two open branches compute the same N; spelled out that the second to merge recomputes against the new main, the same as any other conflict in these files.

Applied to itself: main declares dev.12, so this is dev.13.

🤖 Generated with Claude Code

…not a commit count

The `N = git rev-list LAST_TAG..HEAD --count` rule regresses as soon as PRs are
squash-merged. A branch counts its own commits since the tag, but the squash
lands on main as a single commit, so main's own count sits well below the number
the last merged branch declared. The next branch then computes a LOWER N than
main already has, and apt stops treating the build as an upgrade -- which is the
one thing the dev-version scheme exists to guarantee.

Observed 2026-07-28 on #31: main declared 4.0.1.dev11 while its own rev-list
count was 7, so a two-commit branch computed dev.9. That had to be overridden by
hand to dev.12 to avoid shipping a version that went backwards.

N is now CUR + 1, where CUR is the dev number declared in python/pyproject.toml
on origin/main. Monotonic by construction, and it needs no history archaeology.
Also spells out that the prerelease suffix must be dropped when parsing PATCH out
of the tag (v4.0.0-beta1 gives 0, not "0-beta1" -- the current tag hits this), and
what to do when two branches are open at once.

Applied to itself: main declares dev.12, so this is dev.13.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
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