Repository navigation
feat(fleet): derived per-app versioning from tags (#8566) - #8630
Conversation
Implement the #5790 ruled policy (2026-11-06) for the fleet apps in pkgs/fleet: the version a binary reports is derived at build time, never a hand-maintained literal. - New pure derivation module (crates/fleet/src/derived_version.rs, shared with build.rs by path): nearest <app>/vX.Y.Z tag exactly -> X.Y.Z; N commits after on main -> X.Y.(Z+1)-dev.N+g<shorthash>; feature branch adds +<branch-slug>; no tag yet -> the 0.1.0-dev fallback family. 9 unit tests whose oracle is the #5790 sec.1 policy text (tag-present, no-tag, prerelease-from-main cases). - build.rs bakes FLEET_DERIVED_VERSION via git describe --match 'fleet/v*' (short app name = tag prefix for all apps), with $FLEET_DERIVED_VERSION as the packaged-build channel - the same channel shape as the existing FLEET_SOURCE_REV bake. - Surface: `fleet version`, `fleet capabilities` (build. derived_version) and every --version form now print `Derived version: ...` alongside the source rev, so --version and the #5760 deployed-state checks can consume it. - README gains the tag/release procedure where the fleet release tooling lives: per-app short-name tags, first tag 0.1.0, stay in 0.x (minor = features, patch = fixes, no major bumps), releases are tag builds only, main deploys are prereleases, repo tags repo/v<YYYYMMDD>.<minor>.<patch> at release points (prerelease repo tags on deploys allowed). - smoke.sh asserts the derived-version line on the version surfaces. Tests: cargo test -p fleet --locked - 28+1+7 passed. A binary built from this branch reports: Derived version: 0.1.0-dev.11339+g3c42146+queue-14886-8566-derived-version (no fleet/v* tag exists yet, so the no-tag fallback on a feature branch is the live proof). Out of scope per #8566: cutting the first real tags, any 1.0 move, the #5760 drift-check work itself.
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 56 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
@codex review Please review this PR: derived per-app versioning for the fleet binary (#8566, policy #5790). Focus on the derivation transform in |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: e95fe4151b
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Four findings from the Codex review of e95fe41, all accepted: 1. SemVer build metadata permits ONE '+' separator: the feature branch slug now dot-joins the hash identifier (0.4.3-dev.7+g1a2b3c4.ws-h-versioning) instead of a second '+'. The #5790 policy text's example spelling is corrected in the module docs and the README table; a regression test asserts every derived form carries at most one '+'. 2. The packaged (nix) build now produces the derived version: pkgs/fleet/default.nix takes a derivedVersion argument (release tooling passes the clean tag version for a tag build, where the git history exists) and otherwise derives a unique prerelease from sourceRev (0.1.0-dev+g<rev7>) - no more colliding bare 0.1.0-dev from every packaged build. README step 3 documents it. 3. A malformed nearest tag (fleet/v01.2.3, fleet/v0.4.3-rc.1) no longer hides a valid older release tag: when parse_describe rejects describe's pick, build.rs scans reachable fleet/v* tags, keeps only validated <app>/vX.Y.Z ones, and derives from the nearest (ties: highest version). 4. build.rs registers the git refs it reads (refs/tags, packed-refs, HEAD) as rerun-if-changed inputs, so cutting a release tag on an already-built tree invalidates the bake. Verified live in the worktree: with fleet/v01.2.3 tagged at HEAD (describe's pick) and fleet/v0.1.0 at HEAD~1, a build reports 0.1.1-dev.1+ge95fe41.queue-14886-8566-derived-version; with fleet/v0.1.0 at HEAD, a source-unmodified rebuild reports clean 0.1.0; with the tags deleted it reports the 0.1.0-dev fallback again. cargo test -p fleet --locked: 29+1+7 passed.
|
@codex review Re-review head 605e3e2: all four P2 findings from the first round are fixed (dot-joined build metadata, nix |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 605e3e255a
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Codex round-2 P2 on 605e3e2: the rerun watcher tracked HEAD, refs/tags and packed-refs, but on an attached HEAD an ordinary commit updates the loose branch ref (refs/heads/<branch>, in the common dir for linked worktrees) - HEAD is only the symref naming it and never changes content - so a rebuild after an unrelated commit could keep the previous commit's derived version and source rev. rerun_on_git_refs now also watches refs/heads (the directory covers a ref's first loose creation out of packed-refs) and the resolved current branch ref itself (git symbolic-ref -q HEAD, joined to the common dir). Verified live before this commit: an empty commit on the branch with no source edits moved the rebuilt binary from 0.1.0-dev.11341+g605e3e2... to 0.1.0-dev.11342+g4855f7a... (distance and hash both refreshed). cargo test -p fleet --locked: 29+1+7 passed.
|
Codex Review: Didn't find any major issues. Bravo. Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
Closes #8566. Implements the versioning policy Drew ruled on #5790 (2026-11-06, refined same day).
What
pkgs/fleet/crates/fleet/src/derived_version.rs, pure, shared with the build script by path): nearest<app>/vX.Y.Ztag exactly →X.Y.Z; N commits after it on main →X.Y.(Z+1)-dev.N+g<shorthash>; feature branch adds+<branch-slug>; no tag yet → the0.1.0-devfallback family (bare0.1.0-devonly for a history-less build).build.rs):git describe --tags --long --match 'fleet/v*'(short app name = tag prefix, the one policy for all apps) transformed by the module;$FLEET_DERIVED_VERSIONis the packaged-build channel, the same shape as the existingFLEET_SOURCE_REVbake.fleet version,fleet capabilities(build.derived_version), root--version, and the queue--versionshortcut all reportDerived version: ...alongside the source rev — the channel--versionand the Fleet path Nix-build state: deployed fleet lags pkgs/fleet HEAD; remaining non-Nix pieces #5760 deployed-state checks consume.repo/v<YYYYMMDD>.<minor>.<patch>at release points (prerelease repo tags on deploys allowed), deploy truth read from the binary itself.smoke.shasserts the derived-version line on the repo-queue and fleet version surfaces.Tests
cargo test -p fleet --locked— 28 + 1 + 7 passed, including 9 new derivation unit tests (oracle: the design: versioning for a monorepo whose apps deploy individually — derived versions, per-app tags + repo date tag, survey of schemes (WS-H) #5790 §1 policy text) covering tag-present, no-tag, and prerelease-from-main cases.fleet/v*tag exists yet):Out of scope per #8566: cutting the first real release tags, any 1.0 move, and the #5760 drift-check work itself.
Queue: task 14886, lane code-d.
Open in [code]smith · Need help on this PR? Tag
@codesmith-botwith what you need.