Skip to content

feat(deploy-approvals): optional auto-approval - #227

Merged
ndbroadbent merged 7 commits into
mainfrom
nathan/auto-approve-deploy-approvals
Nov 15, 2026
Merged

ndbroadbent merged 7 commits into
mainfrom
nathan/auto-approve-deploy-approvals

Conversation

@ndbroadbent

@ndbroadbent ndbroadbent commented Nov 15, 2026 •

Copy link
Copy Markdown
Member

Summary

Adds an optional global setting, deploy_approval_auto_approve (off by default), that approves each deploy approval
request as it's created. It's for a rack where the CI pipeline's own approval step decides when a deploy runs, such
as staging, so nobody has to approve the same deploy twice.

  • The approval works like a person's: bound to its app, commit and API token, valid for the approval window, and
    approved_deploy_commands get their env vars. Every build, release and command still goes through the gateway.
  • It has no approving user. Its notes say it was automatic, and the audit log records it as the gateway's own
    (system) deploy_approval_request.approve with auto_approved: true, after the request's create entry. The
    approval and its audit event commit in one transaction under the audit chain lock, as the expiry sweep does: if the
    event can't be written, the request stays pending.
  • Nobody needs to act, so no Slack alert or PR comment goes out for it, and it never approves a CircleCI job.
  • It doesn't apply while deploy_approval_require_different_approver is on. Both settings are read from one
    snapshot, so a request created while an admin changes them together never sees one old value and one new. A
    setting the gateway can't read, or an approval that fails, leaves the request pending for an approver (reported to
    Sentry).
  • Settings page toggle, RGW_SETTING_DEPLOY_APPROVAL_AUTO_APPROVE, and docs (deploy approvals, settings, env vars,
    SOC 2 checklist).
  • Bumps the version to v0.1.38.

Tests

  • Go: internal/gateway/handlers/deploy_approval_auto_approve_test.go: off by default, on through the database and
    through the env var, refused while a different approver is required, the one-active-request rule still holds.
    internal/gateway/db/deploy_approval_auto_approve_test.go: the approval and its event are written together, and
    nothing is approved when the event can't be appended. internal/gateway/settings/service_deploy_test.go: both
    settings from one read, env var overrides, invalid stored values.
  • Web: the Settings page saves the toggle and locks it when an env var sets it.

AI review: codex review (3 rounds), last run on 8fc7840. 2 findings: 2 fixed.

A global setting, deploy_approval_auto_approve (off by default), approves each deploy approval
request as it's created, for a rack where the CI pipeline's own approval step decides when a
deploy runs (a staging rack, say). The approval works like a person's: it's bound to its app,
commit and API token, lasts for the approval window and gives approved_deploy_commands their env
vars. It has no approving user, its notes say it was automatic, and the gateway audit-logs it as
its own (system) deploy_approval_request.approve with auto_approved: true. Nobody needs to act,
so it sends no Slack alert or PR comment, and it never approves a CircleCI job.

It doesn't apply while deploy_approval_require_different_approver is on, and a setting the
gateway can't read or an approval that fails leaves the request pending for an approver. It's on
the Settings page and settable with RGW_SETTING_DEPLOY_APPROVAL_AUTO_APPROVE. The approval window
lookup is shared between the approve and create handlers.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@deepsource-io

deepsource-io Bot commented Nov 15, 2026 •

Copy link
Copy Markdown

DeepSource Code Review

We reviewed changes in 090e679...8fc7840 on this pull request. Below is the summary for the review, and you can see the individual issues we found as inline review comments.

See full review on DeepSource ↗

PR Report Card

Overall Grade   Security  

Reliability  

Complexity  

Hygiene  

Code Review Summary

Analyzer Status Updated (UTC) Details
JavaScript Nov 15, 2026 11:03p.m. Review ↗
Go Nov 15, 2026 11:03p.m. Review ↗

Important

AI Review is run only on demand for your team. We're only showing results of static analysis review right now. To trigger AI Review, comment @deepsourcebot review on this thread.

ndbroadbent and others added 6 commits November 16, 2026 11:28
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…shot

A request created while an admin changes deploy_approval_auto_approve and
deploy_approval_require_different_approver together now sees the old values or the new
ones, never one of each, so it can't be approved without a person under a combination
that neither configuration allowed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… one transaction

The gateway approved the request, then logged the approval and ignored a failed write, so an
approval could exist with no record of it. The approval and its audit event now commit
together under the audit chain lock, as the expiry sweep does: if the event can't be
appended, the request stays pending for a person.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@ndbroadbent
ndbroadbent merged commit 30bec25 into main Nov 15, 2026
13 checks passed
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