Skip to content

Quick Deploy clone: a root admin may smoke-clone an unpromoted bake - #314

Merged
vsilent merged 1 commit into
devfrom
fix/clone-unstable-root-admin
Oct 30, 2026
Merged

vsilent merged 1 commit into
devfrom
fix/clone-unstable-root-admin

Conversation

@vsilent

@vsilent vsilent commented Oct 30, 2026

Copy link
Copy Markdown
Collaborator

Problem (seen on production after #310). POST /api/v1/deploy/clone with channel: "unstable" checked user.role == "group_admin" literally. In Casbin, root inherits group_admin, so a root admin passes /api/admin/bake and /promote. The smoke clone of that admin's own bake was refused:

403 {"error": "Forbidden", "details": "only an admin can clone a bake that has not been promoted"}

As a result bake_pipeline.py can never promote a bake that a root admin started.

Change. The check accepts group_admin | root, the same as routes/agent/audit.rs. Buyers (group_user) still get 403.

Test. a_root_admin_may_smoke_clone_an_unpromoted_bake in tests/bake_channels.rs. It failed against the old code with 403, the same as production, and now returns 404 (past the admin check, no unstable bake). All 8 tests in the file pass against real Postgres. clippy and rustfmt report nothing new in the changed lines.

🤖 Generated with Claude Code

`channel: "unstable"` was allowed only for role `group_admin`. `root`
inherits `group_admin` in Casbin, so the same admin who can POST
/api/admin/bake got 403 on the smoke clone of that bake (seen on
production), and the bake could never be promoted.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@vsilent
vsilent merged commit fb64a9c into dev Oct 30, 2026
11 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.

2 participants