Skip to content

impl(deploy): the release verb — tag cutting, attestation, and the untagged-release refusal (#13306) - #13329

Merged
dezren39 merged 1 commit into
mainfrom
lane-xd-13306
Nov 23, 2026
Merged

dezren39 merged 1 commit into
mainfrom
lane-xd-13306

Conversation

@dezren39

@dezren39 dezren39 commented Nov 23, 2026 •

Copy link
Copy Markdown
Member

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 from origin/main, judges the attestation gate for that exact commit (the main-gate watched set, judged by the same rules .github/scripts/release-gate.sh implements — 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 tag 0.1.0, 0.x only, next minor or next patch only, duplicate/collision refusals), cuts the annotated app tag carrying the release-attestation:v1 block and the release point's annotated repo/v<YYYYMMDD>.<minor>.<patch> tag, pushes both, and appends the release record to the release ledger (releases.jsonl in the deploy state dir). --dry-run judges and reports without cutting.
  • The deploy-time refusal (design §6): a deploy whose artifact self-reports a clean X.Y.Z version claims release status and is refused in both activation paths (systemd and sandbox) unless an attested <app>/vX.Y.Z tag 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 against fleet/vX.Y.Z.
  • Registry: new optional field evidenceWorkflow (design §3 part 2), validated like the other optional fields and set to fleet-rust-tests on the fleet-backed definitions (queue-broker, secrets-broker) in pkgs/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

  • New pkgs/deploy/test_deploy_release.py (17 tests) over a fixture git remote with faked gh: 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.
  • All nine pkgs/deploy suites pass on the laptop; nix build .#deploy succeeds and the rendered registry carries evidenceWorkflow on both fleet services (verified in the built CLI's registry JSON).
  • A remote dispatch of the same suites at this head is recorded on impl(deploy): the release verb — tag cutting, attestation, and the untagged-release refusal (#11177 implementation) #13306.

The first real release cut with the verb (fleet/v0.1.0 plus 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.


Run Proof on this PR
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.

…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.
@coderabbitai

coderabbitai Bot commented Nov 23, 2026

Copy link
Copy Markdown

Warning

Review limit reached

You'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.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 0c63e4d2-cc06-4592-bd04-cad651efe5e3
Commits

Reviewing files that changed from the base of the PR and between 6314507 and 8e882d5.

Files selected for processing: 4

  • pkgs/deploy/deploy.py
  • pkgs/deploy/services.nix
  • pkgs/deploy/test_deploy_release.py
  • pkgs/fleet/README.md
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

Share

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 23, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-23T13:43:38.029119Z 8e882d5 PR opened
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@dezren39
dezren39 merged commit ed3ab90 into main Nov 23, 2026
2 checks passed
@dezren39
dezren39 deleted the lane-xd-13306 branch November 23, 2026 13:42

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment thread pkgs/deploy/deploy.py
Comment on lines 1230 to +1231
artifact = defn["package"]
refusal = release_claim_refusal(name, defn)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge 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 👍 / 👎.

Comment thread pkgs/deploy/deploy.py
Comment on lines +2177 to +2178
if rc == 0 and name not in tags:
_git(repo, "tag", "-d", name)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge 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 👍 / 👎.

Comment thread pkgs/deploy/deploy.py
Comment on lines +2322 to +2323
source_rev = _source_rev()
if not FULL_SHA_RE.fullmatch(source_rev):

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

Comment thread pkgs/deploy/deploy.py
f"registry definitions for app {app!r} disagree on "
f"evidenceWorkflow: {', '.join(sorted(workflows))}"
)
return workflows.pop() if workflows else None

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

Comment thread pkgs/deploy/deploy.py
)
created.append(repo_tag)
_git_checked(
repo, "push", "origin", f"refs/tags/{app_tag}", f"refs/tags/{repo_tag}",

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

Comment thread pkgs/deploy/deploy.py
Comment on lines +2267 to +2269
proc = subprocess.run(
[path, "version"], capture_output=True, text=True, timeout=15
)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

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