Repository navigation
chore(cli): map branches and backups command permissions - #7152
Merged
Merged
Conversation
Declares the Management API operations behind `branches create|delete| disable|get|list|pause|unpause|update` and `backups list|restore`, so scoped PATs can be granted per command. Adds a `branchPrompt` block for the branch listing shown when no branch is given on a TTY, and rewords the context of the project picker, linked-project cache and branch lookup blocks so each fits every command that includes it. `branches get` names the output flags, since only machine output reads the branch's API keys and pooler config. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Seven `branches` side-effect docs placed the linked-project cache under `~/.supabase/<workdir-hash>/`; it is written to `<workdir>/supabase/.temp/linked-project.json`. `branches get` reads the branch's API keys and pooler config for machine output, not only when `--output` is not `pretty`. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…ayers Runs the project picker, branch picker and linked-project cache through their real layers in each branches and backups command test, asserts the exact request sequence, and checks the recorded requests against the declarations. `branches get` also covers each output mode that changes which calls it makes, including agent-detected JSON. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…ps docs
Adds the project picker (`GET /v1/projects`), the branch picker
(`GET /v1/projects/{ref}/branches`) and the linked-project cache lookup
(`GET /v1/projects/{ref}`) to each command's API routes, states when the
cache file is actually written, and replaces the empty Files Written
tables in the `backups` docs.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
🤖 AI Review
Both independent reviews completed; Codex reported no findings. Verified both Claude findings: confirmed one documentation nit and refuted the fixture-duplication nit based on the trusted testing convention. No functional defect was established.
Findings
| Severity | Location | Category | Sources | Claim |
|---|---|---|---|---|
| ⚪ NIT | apps/cli/src/command-internal/branch-ref.resolver.ts:14 |
documentation |
claude | The shared branchRef permission contexts misleadingly include --project-ref as a branch identifier source. All four commands currently using this block treat --project-ref as the parent project. |
Refuted findings (kept for transparency, not posted as review comments)
apps/cli/src/commands/branches/delete/delete.integration.test.ts:47(test-maintainability): Nine integration test files repeat nearly identical typed PROJECT fixtures, increasing maintenance work when the API schema changes.
Refuted: The duplication exists, but trusted/CLAUDE.md:159 explicitly permits small local fixtures and says to accept some duplication rather than introduce unnecessary test abstractions. These are short, typed data fixtures with no duplicated behavior; the restore fixture also preserves distinct existing values. No correctness problem or concrete drift was identified, so extraction is an optional preference rather than an established issue under the documented convention.
Stats
Claude findings: 2 · Codex findings: 0 · Confirmed: 1 · Refuted: 1 · Uncertain: 0
Models: claude-opus-5-5 + gpt-6.1-sol · Trigger: auto · Workflow run
This review runs once per PR. A maintainer can request another with a /ai-review comment.
The branch commands pass --project-ref as the parent project, not as a branch identifier. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
jgoux
approved these changes
Oct 15, 2026
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.
Maps
branches create|delete|disable|get|list|pause|unpause|updateandbackups list|restoreto the Management API operations they can call, so scoped PATs can be granted per command. Drift tests keep each declaration in step with what the command does.Shared changes.
branchPromptblock (v1-list-all-branches, required) for the branch listing shown when no branch is given on a TTY.projectRefPicker,linkedProjectCacheandbranchRefis reworded so it fits every command that includes it. No condition or label changed.Blocks used.
projectRefPickerandlinkedProjectCache(all ten),branchPromptandbranchRef(delete, pause, unpause, update;getusesbranchPromptand declares its name lookup itself),upgradeSuggestion(create, update).Conditions.
branches getnames the global output flags: the branch's API keys and pooler config are read for-oother thanpretty, and with no-owhen the output format is json or stream-json (--output-format,--agent yes, or a detected coding agent). This is the first declaration to name global flags inwhen.Findings.
pauseandunpausecall the project-level pause and restore operations, so they needproject_admin_write, not a branching permission.disableneeds onlybranching_production_delete.createorupdatetriggers the upgrade-suggestion lookups (best-effort).Tests. Each command's integration test runs the project picker, the branch picker where it applies, and the real linked-project cache, and checks the exact request sequence.
branches getcovers each output mode that changes its calls; the agent-detected case is simulated through the output format.Not covered. Context entries (
branchPrompt,branchRef, the cache, the agent-detected entry) are asserted by request sequence only.--persistent=falseis not run on every command.Docs. The
branchesSIDE_EFFECTS.mdfiles now give the cache path as<workdir>/supabase/.temp/linked-project.json, andget's doc states when the API keys and pooler config are read. All ten docs now list the project picker, branch picker and linked-project cache routes, and say when the cache file is written.🤖 Generated with Claude Code