Repository navigation
feat(deploy-approvals): optional auto-approval - #227
Merged
Merged
Conversation
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>
|
|
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.
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds an optional global setting,
deploy_approval_auto_approve(off by default), that approves each deploy approvalrequest 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.
approved_deploy_commandsget their env vars. Every build, release and command still goes through the gateway.(
system)deploy_approval_request.approvewithauto_approved: true, after the request's create entry. Theapproval 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.
deploy_approval_require_different_approveris on. Both settings are read from onesnapshot, 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).
RGW_SETTING_DEPLOY_APPROVAL_AUTO_APPROVE, and docs (deploy approvals, settings, env vars,SOC 2 checklist).
Tests
internal/gateway/handlers/deploy_approval_auto_approve_test.go: off by default, on through the database andthrough 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, andnothing is approved when the event can't be appended.
internal/gateway/settings/service_deploy_test.go: bothsettings from one read, env var overrides, invalid stored values.
AI review: codex review (3 rounds), last run on 8fc7840. 2 findings: 2 fixed.