Repository navigation
impl(deploy): the release verb — tag cutting, attestation, and the untagged-release refusal (#13306) - #13329
Conversation
…elease refusal (#13306) Implements the release-workflow design record (#11177) in pkgs/deploy: - `deploy release <app> [--version X.Y.Z] [--commit <sha>] [--bump minor|patch]` verifies the commit is reachable from origin/main, judges the attestation gate for that exact commit (the main-gate watched set judged by the release-gate.sh rules, plus the app's evidence workflow), checks the #5790 version discipline (first tag 0.1.0, 0.x only, next minor or next patch), cuts the annotated app tag carrying the release-attestation:v1 block and the release point's annotated repo tag, pushes both, and appends the release record to the release ledger in the state dir. - The deploy-time refusal (design §6): a deploy whose artifact self-reports a clean X.Y.Z is refused unless an attested <app>/vX.Y.Z tag exists at the artifact's source commit with a verifiable attestation block; -dev artifacts are unaffected. - New optional registry field `evidenceWorkflow` (design §3 part 2), set to fleet-rust-tests on the fleet-backed definitions (queue-broker, secrets-broker) in services.nix. - `deploy status` reads the release ledger beside the per-target report; ledger/tag disagreements are reported with the tag winning. - Fleet README's tag-and-release procedure names the design record as the workflow of record. - test_deploy_release.py: 17 tests over a fixture git remote with faked gh — red-gate and missing-signal refusals, version-discipline refusals, the untagged-release deploy refusal, a successful release with a parseable attestation block, and the ledger round-trip through the status report.
|
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 14 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. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 8e882d539d
ℹ️ 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".
| artifact = defn["package"] | ||
| refusal = release_claim_refusal(name, defn) |
There was a problem hiding this comment.
Realize the artifact before checking its release claim
When the target package is not already present in the Nix store, this check silently permits deployment: probe_artifact_version() returns None for the missing executable, which is treated as no release claim. The package is only realized afterward by install_generation() through ensure_artifact(), and its version is never checked again before activation. Because the registry deliberately avoids realizing target packages when building the CLI, this is a normal first-deployment path in both systemd and sandbox activation. Realize the artifact before probing it, while keeping the attestation check before profile changes or activation.
Useful? React with 👍 / 👎.
| if rc == 0 and name not in tags: | ||
| _git(repo, "tag", "-d", name) |
There was a problem hiding this comment.
Preserve local tags during release dry runs
If an unpublished local app or repo tag exists, deploy release --dry-run deletes it here before reaching the later dry-run return. This also happens when gate judgment subsequently fails, so an inspection command can destroy local release state despite reporting that no tags were cut. Guard this cleanup with not dry_run and report the proposed deletion instead. The root AGENTS.md operator-script contract explicitly requires parsed safety flags to be honored on every code path.
AGENTS.md reference: AGENTS.md:L43-L48
Useful? React with 👍 / 👎.
| source_rev = _source_rev() | ||
| if not FULL_SHA_RE.fullmatch(source_rev): |
There was a problem hiding this comment.
Verify the source revision reported by the artifact
For an already-realized release artifact, _source_rev() reads only the caller's DEPLOY_SOURCE_REV environment variable, not the artifact's source revision. Neither the packaged deploy wrapper nor another production caller in the repository sets that variable, so an ordinary deployment of a correctly attested release is refused as working-tree. Conversely, setting it to an attested commit can authorize an artifact built from a different commit because the artifact's actual revision is never compared. Fleet already prints Source rev: alongside Derived version: in print_version(); read and verify that artifact provenance rather than treating caller-provided logging metadata as its source commit.
Useful? React with 👍 / 👎.
| f"registry definitions for app {app!r} disagree on " | ||
| f"evidenceWorkflow: {', '.join(sorted(workflows))}" | ||
| ) | ||
| return workflows.pop() if workflows else None |
There was a problem hiding this comment.
Require the dedicated evidence workflows for registered apps
For deploy release pm-aggregator and deploy release ready-for-agent, this returns None because their definitions in pkgs/deploy/services.nix omit evidenceWorkflow. Both apps have dedicated suites outside WATCHED_WORKFLOWS: .github/workflows/pm-aggregator-tests.yml names pm-aggregator tests, and .github/workflows/ready-for-agent-tests.yml names ready-for-agent tests. Consequently, either app can receive a release attestation while its own suite is failing or has never run. The release design §3 explicitly requires those additional suites; populate the evidence field for these registered apps instead of treating the watched set as their complete evidence.
Useful? React with 👍 / 👎.
| ) | ||
| created.append(repo_tag) | ||
| _git_checked( | ||
| repo, "push", "origin", f"refs/tags/{app_tag}", f"refs/tags/{repo_tag}", |
There was a problem hiding this comment.
Push the app and repository tags atomically
When two releases for different apps run concurrently, both can choose the same next repository tag from their initial remote snapshot. After one publishes, this push can publish the other's unique app tag while rejecting its now-occupied repository tag. _git_checked() then reports failure and skips the ledger append even though the app release is public, and retrying refuses the existing app tag as already released. Push the pair with --atomic; the locally inspected git push -h documents that option as “request atomic transaction on remote side,” preventing this partially published release.
Useful? React with 👍 / 👎.
| proc = subprocess.run( | ||
| [path, "version"], capture_output=True, text=True, timeout=15 | ||
| ) |
There was a problem hiding this comment.
Restrict version probes to entry points that support them
For already-built targets such as quota-recorder and laptop-agent, passing version runs their normal workload rather than a read-only query: pkgs/deploy/quota-recorder.py:348-367 ignores arguments and appends quota records and flushes them to Turso, while pkgs/laptop-agent/src/laptop_agent.py:1620-1632 loads and reaps persisted jobs before starting its HTTP server. This now happens before managed activation, under the deploy caller's environment rather than the service's configured environment; the 15-second timeout does not undo those effects. Make version probing an explicit supported command in the registry, or add a side-effect-free version command to these entry points before probing them unconditionally.
Useful? React with 👍 / 👎.
Implements the release verb for the deploy tool, per the release-workflow design record (#11177) and issue #13306.
What lands
deploy release <app> [--version X.Y.Z] [--commit <sha>] [--bump minor|patch]— the estate's only release actor. It verifies the commit is reachable fromorigin/main, judges the attestation gate for that exact commit (the main-gate watched set, judged by the same rules.github/scripts/release-gate.shimplements — the non-push ancestor rule is the live one — plus the app's own evidence workflow when the watched set does not cover it), checks the ratified design: versioning for a monorepo whose apps deploy individually — derived versions, per-app tags + repo date tag, survey of schemes (WS-H) #5790 version discipline (short app-name prefix, first tag0.1.0, 0.x only, next minor or next patch only, duplicate/collision refusals), cuts the annotated app tag carrying therelease-attestation:v1block and the release point's annotatedrepo/v<YYYYMMDD>.<minor>.<patch>tag, pushes both, and appends the release record to the release ledger (releases.jsonlin the deploy state dir).--dry-runjudges and reports without cutting.X.Y.Zversion claims release status and is refused in both activation paths (systemd and sandbox) unless an attested<app>/vX.Y.Ztag exists at the artifact's source commit with a verifiable attestation block. Prerelease (-dev) artifacts are unaffected. The app a definition speaks for is its name or the app whose binary it runs, so the fleet services verify againstfleet/vX.Y.Z.evidenceWorkflow(design §3 part 2), validated like the other optional fields and set tofleet-rust-testson the fleet-backed definitions (queue-broker,secrets-broker) inpkgs/deploy/services.nix.deploy status(bare) reads the release ledger beside the per-target reports; where ledger and tags disagree the tag wins and the disagreement is reported. Per-target status also lists that app's ledger records.pkgs/fleet/README.md: the tag-and-release procedure now names the design record as the workflow of record.Verification
pkgs/deploy/test_deploy_release.py(17 tests) over a fixture git remote with fakedgh: successful release producing both tags with a parseable attestation block, second/third releases following the discipline and the repo-tag counter, dry-run cutting nothing, red-gate / missing-signal / off-main / version-discipline / unknown-app refusals, the untagged-release deploy refusal (and the attested control deploying), and the ledger round-trip through the status report including tag-wins disagreement.pkgs/deploysuites pass on the laptop;nix build .#deploysucceeds and the rendered registry carriesevidenceWorkflowon both fleet services (verified in the built CLI's registry JSON).The first real release cut with the verb (
fleet/v0.1.0plus the repo tag) follows the merge if the gate judges green at cutting time, recorded on #11177 as the acceptance requires; #13306 stays open until that leg is recorded.Open in [code]smith · Need help on this PR? Tag
@codesmith-botwith what you need.