fix(settings): require and surface pull_requests:write in the install preview for PR comment/label output#420
Merged
JSONbored merged 2 commits intoJun 5, 2026
Conversation
…mment/label output
|
Note Gittensory Gate skippedPR closed before full evaluation. No late first comment was created.
Checked by Gittensory, a quiet PR intelligence layer for OSS maintainers. |
JSONbored
approved these changes
Jun 5, 2026
Owner
JSONbored
left a comment
There was a problem hiding this comment.
@galuis116 this is ready from my side.
A few notes:
- This aligns the settings preview with the app’s declared
pull_requests: writerequirement. - The missing-permission path now reports
pull_requestsinstead of silently under-specifying the install. - Non-Gittensory checks are green, and I do not have code changes to request.
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.
Summary
The maintainer-facing repo settings preview computed its required/missing permission guidance in
src/signals/settings-preview.ts, but that guidance disagreed with the GitHub App's own declared baseline insrc/github/backfill.ts:REQUIRED_INSTALLATION_PERMISSIONSdeclarespull_requests: "write"(PR conversation comments and PR labels are gated by GitHub on the Pull requests permission, not Issues).requiredInstallPermissionslistedpull_requests: readand never upgraded it for comment/label output, andactiveMissingPermissionscheckedissues/checksbut neverpull_requests.So when an installation was missing
pull_requests: write, the itemized guidance the maintainer reads (installPreview.permissions.requiredand the missing-permission summary) understated the requiredpull_requestslevel and omitted it from the remediation. The overallpermissionStatuswas rescued by a separateinstallation.status === "needs_attention"clause, so it did not falsely flip to "ready" -- but the maintainer was told to grant the wrong/incomplete permissions, and comment/label publishing would then fail at runtime with GitHub's "Resource not accessible by integration." Closes #419.The required-write level is already the app's own contract:
test/integration/api.test.tsassertsrequiredPermissions: { metadata: "read", pull_requests: "write", issues: "write" }and exercises a state where apull_requests: readgrant is reported as missing.Scope
src/signals/settings-preview.ts:writesPrPublicSurfacehelper.requiredInstallPermissionsnow requirespull_requests: write(notread) for comment/label outputs, keepingreadas the read-only baseline.activeMissingPermissionsnow surfaces a missingpull_requestspermission for comment/label outputs, alongside the existingissues/checkschecks.test/unit/settings-preview.test.ts:pull_requests: readtopull_requests: write(the corrected level).pull_requestswith comment/label output must listpull_requests: writeinrequiredand["pull_requests"]inmissing(old code surfaced neither).Validation
npx tsc --noEmit-- clean.npx vitest run test/unit/settings-preview.test.ts test/integration/api.test.ts-- 47/47 pass.mcp-clitimeout that passes in isolation).Safety
installPreview.permissionskeeps the same fields; only the (now correct)pull_requestslevel inrequiredand its presence inmissingchange, and only for comment/label-output previews.pull_requests: readand are unaffected.REQUIRED_INSTALLATION_PERMISSIONSand the install-health surface rather than diverging from them.Notes
A follow-up could source the baseline directly from the shared
REQUIRED_INSTALLATION_PERMISSIONSconstant so the two surfaces cannot drift again; this change keeps the fix focused on the corrected levels and the missing-permission check.