Skip to content

bot: widen the ceiling to the reads the merge gate needs - #21

Merged
imanimanyara merged 1 commit into
mainfrom
chore/merge-gate-ceiling
Nov 4, 2026
Merged

imanimanyara merged 1 commit into
mainfrom
chore/merge-gate-ceiling

Conversation

@imanimanyara

Copy link
Copy Markdown
Member

Summary

refresh-bot was granted checks: read and statuses: read on 2026-11-03, and all 10 owned orgs approved them, so the policy ceiling can now move with the app.

before  contents=write metadata=read pull_requests=write                    (3)
after   + checks=read statuses=read                                          (5)

Why this is a separate change from the grant

A ceiling that claims a permission the app does not hold makes create-github-app-token answer 422 on every run. So the order is: grant on the app → every org approves → widen the ceiling. bot/README.md's "Adding a job" step says exactly this; this is the first time it has been exercised.

dependabot-merge gets the two reads back. merge.py reads commits/{sha}/check-runs and commits/{sha}/status; without them decide() sees no checks and refuses every pull request — fail-closed, but useless.

workflows: write is still absent, and must stay absent

This app's key is an organisation-level secret, so that permission would be within reach of every workflow in the estate — letting a release job rewrite the CI that gates it. A Dependabot pull request touching .github/workflows/ is therefore never merged by this token; those go to @dependabot merge, which Dependabot performs with its own credentials.

Verification

  • 24 tests pass. CeilingMatchesTheAppTest still refuses workflows, issues, administration, members and secrets by name, and was re-proven red: planting workflows: write in the ceiling fails 6 tests, reverting goes green.
  • bot/resolve.py --job dependabot-merge --owner laranail now emits contents=write pull-requests=write checks=read statuses=read.
  • .github/actions/bot-token/action.yml passes exactly the ceiling (a ceiling permission the action does not pass is silently dropped — test_the_action_passes_exactly_the_ceiling covers it).
  • Both workflows parse; jobs unchanged.

Not changed

The gate stays dry-run: it acts only where DEPENDABOT_MERGE_APPLY is true, and no repository variable sets it. gh api repos/simtabi/.github/actions/variables returns none, so it has never merged anything.

refresh-bot was granted checks:read and statuses:read on 2026-11-03 and all
10 owned orgs approved them, so the ceiling can now move with the app.

Order matters and is the reason this is a separate change: a ceiling that
claims a permission the app does not hold makes create-github-app-token answer
422 on every run. Grant on the app, let every org approve, then widen. The
bot/README "Adding a job" step says exactly this; this is the first time it
has been exercised.

dependabot-merge gets the two reads back. merge.py reads
commits/{sha}/check-runs and commits/{sha}/status, and without them decide()
sees no checks and refuses every pull request -- fail-closed, but useless.

workflows:write is still absent and must stay absent. This app's key is an
organisation-level secret, so that permission would be within reach of every
workflow in the estate, letting a release job rewrite the CI that gates it. A
Dependabot pull request touching .github/workflows/ is therefore never merged
by this token; those go to `@dependabot merge`, which Dependabot performs with
its own credentials.

The gate remains dry-run: it acts only where DEPENDABOT_MERGE_APPLY is true,
and no repository variable sets it, so it has never merged anything.

CeilingMatchesTheAppTest still refuses workflows, issues, administration,
members and secrets by name, and was re-proven red: planting workflows:write
in the ceiling fails 6 tests, reverting goes green. 24 tests pass.
Copilot AI balanced review requested due to automatic review settings November 3, 2026 21:24

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

@imanimanyara
imanimanyara merged commit b77f665 into main Nov 4, 2026
6 checks passed
@imanimanyara
imanimanyara deleted the chore/merge-gate-ceiling branch November 4, 2026 13:59
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