Part 6 of 7 in a stack that splits #52331 into reviewable pieces.
Resolves part of
[FE-4693](https://linear.app/supabase/issue/FE-4693/pilot-migrate-branches-to-grants-8-endpoints-createbranchmodal).
There are no functional changes beyond #52331, and the top of the stack
is identical to it. See #52331 for the full rationale.
## Stack
1. #52372 Grant infra for branch variants
2. #52373 Branches list query
3. #52374 Page gates on the list grant
4. #52375 Branch creation
5. #52376 Branch read, delete, reset, and restore
6. 👉#52377 Branch update and push
7. #52378 Branch diff and merge
## Changes
The update and push mutations take grants. `Overview` (including "Switch
to persistent", which previously had no check), `EditBranchModal`,
`SwitchToPreviewModal`, `MergeRequestButton`, the merge-requests page,
and the merge page use `useBranchGrant`. The "Update branch" button in
`OutOfDateNotice` is disabled without push; previously it did nothing.
The GitHub integration form blocks saving without the production-branch
grant. Previously the connection was saved even when the branch request
failed.
## Testing
New `GitHubIntegrationConnectionForm` test.
"Switch to preview" in the delete flow read its refs from the selected
project, so on the branching overview `parent_project_ref` was undefined
and the handler bailed with a `console.error` — persistent branches
couldn't be deleted.
Both refs now come from the `branch` prop, and the not-ready state shows
on the confirm button instead of the console. Covered by a new MSW test
that fails against the old code.
Fixes FE-4219
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit
* **Bug Fixes**
* Improved switching branches to Preview mode by using the selected
branch’s project information.
* Prevented confirmation when no branch is available.
* Preserved success notifications and modal closing after a successful
switch.
* **Tests**
* Added coverage for successful updates, API failures, error feedback,
request details, and disabled confirmation states.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->