Repository navigation
fix(update): stop leasing the default branch in ref updates - #81
Merged
Merged
Conversation
Every `updateRefs` call carried a no-op lease entry for the default branch. Rulesets that require a pull request treat that entry as a push to the default branch and reject it, and because `updateRefs` is atomic, every branch in the batch failed with it. Drop the default-branch entry from the batch publish, the single-branch publish and obsolete-branch deletion. Each branch keeps its own `beforeOid` lease, and `prepare()` still refuses a moved base when it reads the head. `Error::Graphql` now carries GitHub's `errors[].message` values (joined with "; ", truncated to 300 characters), so a failed update says why. Refs #79
|
|
Overall Grade |
Security Reliability Complexity Hygiene |
Code Review Summary
| Analyzer | Status | Updated (UTC) | Details |
|---|---|---|---|
| Rust | Oct 30, 2026 9:11p.m. | Review ↗ | |
| JavaScript | Oct 30, 2026 9:11p.m. | Review ↗ | |
| Shell | Oct 30, 2026 9:11p.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.
There was a problem hiding this comment.
All reported issues were addressed across 11 files
Reply with feedback, questions, or to request a fix.
View guided diff | Turn on auto-fix | Re-trigger cubic
|
Docs7 for sweepies/count-patchula
Commit |
…read Deleting obsolete branches no longer leases the default branch, so check its head just before deleting and leave cleanup to the next run if it moved. Also correct the ref update docs: a branch left behind by a moved base follows prs.rebase on the next run. Refs #79
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
count-patchula | eb4c0ea | Commit Preview URL Branch Preview URL |
Oct 30 2026, 09:11 PM |
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.
Cause
Every GraphQL
updateRefscall included a no-op lease entry for the default branch (beforeOid=afterOid= the base commit). On a repository whose default branch has a "Require a pull request before merging" ruleset, GitHub treats that entry as a push to the default branch and rejects it.updateRefsis atomic, so one rejection failed every branch in the batch withatomic batch ref lease failed … GitHub GraphQL returned errors.Fix
updateRefsinputs: the batch publish (chunks are now 50 branch refs, and the empty-batch skip isrefs.is_empty()), the single-branch publish, and obsolete-branch deletion.beforeOidlease, so a concurrent push to an update branch is still refused.prepare()still refuses a moved base when it reads the head. A branch left behind by a base that moves afterwards is rebased on the next run.delete_ownedloses itsbaseparameter, and the auto-merge caller no longer reads the merge response'sshafor it. Nothing else used them.Error::Graphqlnow carries GitHub'serrors[].messagevalues, joined with "; " and truncated to 300 characters, so a failure readsGitHub GraphQL returned errors: Push blocked …. Only the message text is kept, not request data.Tests
no_ref_update_names_the_default_branchchecks that the single-branch publish, the batch publish and cleanup never name the default branch.batch_ref_race_keeps_every_prepared_branch_unpublishednow expects 2 refs, not 3. Both fail without the fix.fixtures/github/graphql-errors.jsonhas two messages, and the offline test asserts they are carried and that the token and non-message fields are not.updateRefsbody. These paths are tested against in-process fakes.Docs
guide/pull-requests.md,guide/how-it-works.mdxandinternals/engine.mdsay leases are on the branch only, and why the default branch is not named.Refs #79