Repository navigation
Description
Problem or Motivation
Child 13 of the ADR modernization (#5233). Decision (owner decision 3). It waits until the owner has changed the App settings.
The review of each record that this item changes:
- ADR 0015 (amend now; supersede after owner decision 3): The App identity holds. The six amendment notes become Status History, and the permission sets live in constants.py and the github-app-identity spec. The cut of the grant and the App webhook need the owner.
Proposed Solution & Architectural Design
At Service start, a JWT read of GET /app/installations/{id} compares the granted permissions with the two token sets and names each missing permission. A new record supersedes 0015: least privilege for each token, the two sets in constants.py and the spec, the App webhook with one secret, and the key never in Actions secrets. 22 citation lines move. #4417 and #4560 stay separate PRs.
Owner decision 3 of 2026-11-12: All three GitHub settings, in this order: (1) cut the App grant to the 9 permissions that the code asks for; (2) after #4417, turn on the App webhook (Issues only) and delete the 7 repository hooks in the same hour; (3) bind the 3 required checks of the ruleset to the GitHub Actions app.
Rules of the ADR process (docs/adr/README.md, #5225) that apply:
- Supersession: the new record sets 'supersedes', and the same PR sets status and 'superseded-by' on the old record. The test fails on a link that goes only one way. The new record restates each rule and each rejected option that still holds, because the alternatives check drops superseded records. Never amend a superseded record. After a third amendment, or when a body contradicts the code, the next change is a supersession.
- Length: the body of a new record has 1,000 words or fewer, its title has 10 words or fewer, and its slug has 60 characters or fewer. Designs, catalogues, row tables, cutover plans, caps and measurements go to OpenSpec changes and specs, to settings or to docs, with a link under More Information.
- Use one Considered Options section. Each bullet ends with 'chosen.', 'rejected, because .' or 'deferred until .'. 'Deferred' does not match the rejected regex (adr.py:49), so the check stops refusing on a premise that changed. Each record has a Confirmation section that names its test, CI row or metric, and an optional tracker key.
- Code, tests and workflows cite the record in force. A test fails on a citation of a superseded record in src/, tests/ and .github/ (archived changes and CHANGELOG.md are history). Each superseding PR moves the citations of the records that it supersedes. Rename sweeps do not change docs/adr/.
- Merge ADR changes in batches. Each change of the ADR set changes adr_hash (alternatives.py:634-644, 1006) and makes every checked item due again. So all pure status changes go in docs(adr): add MADR front matter, a Status History and the ADR rules #5225, and the record PRs merge one at a time in the planned order.
- Keep the fix(roadmap): the ADRs in force fill the alternatives ADR budget #5049 budget test. A new record must fit in the tokens that the records it supersedes free. Short option bullets keep the budget, because options are 6,883 of the 8,464 tokens today.
The owner merges this pull request.
Target Subsystem
src/devops_cli/server/, src/devops_cli/config/constants.py, docs/adr/.
Existing Tool Considered
GitHub REST GET /app/installations/{installation_id} with the App JWT, through gidgethub (in use). No new tool.
Acceptance Criteria
- At Service start, a JWT read of
GET /app/installations/{id}compares the granted permissions with the two token sets and names each missing permission. A test with a recorded answer shows the name of a missing permission. - A new record supersedes ADR 0015: least privilege for each token, the two sets in
constants.pyand the spec, the App webhook with one secret, and the key never in Actions secrets. - The 22 citation lines move. feat(service): verify GitHub App webhooks with one secret #4417 and feat(service): redeliver webhook deliveries that failed #4560 stay separate pull requests.
- The index and link tests of docs(adr): add MADR front matter, a Status History and the ADR rules #5225 pass, and the fix(roadmap): the ADRs in force fill the alternatives ADR budget #5049 budget test passes: the alternatives check fits every record in force under its cap.
Dependencies
- test: enforce the program allowlist and record it #5250
- feat(service): verify GitHub App webhooks with one secret #4417
Owner decision 3 of 2026-11-12 is made. The owner changes the App settings (tracker owner steps 3 and 4) before this item merges.
Related
- Tracker: docs(adr): track the ADR modernization #5233. Review source:
docs/adr/at e413c40. - feat(service): verify GitHub App webhooks with one secret #4417 (one App webhook secret), feat(service): redeliver webhook deliveries that failed #4560 (redelivery with the App JWT).
Source: #5233
Alternatives check of 2026-11-28: in-use.
The repository already uses this tool.
Tool: gidgethub/gidgethub (https://github.com/gidgethub/gidgethub), Apache-2.0, last activity 2026-11-20, maintained.
Reason: Searches found no separate grant-check tool; gidgethub, already the project's GitHub transport, sends the App JWT read of GET /app/installations/{id}, so only the permission comparison and the ADR record are project work.
Covers:
- Signed App JWT and installation requests to the GitHub REST API
- One transport for the existing token exchange path
- Installation answers with granted permission mappings
Lacks:
- No comparison of granted levels with the two constants
- No start-up failure path that names each missing permission
- No ADR supersession, index or citation move
Proposed design
Problem statement
The Service starts without a check of the permissions that its GitHub App installation grants. A missing permission appears only when a later token request fails. ADR 0015 is six amendments old, and the two permission sets now live in constants.py and the github-app-identity spec. The change adds a start-up grant read, records the App identity in a new ADR that supersedes 0015, and moves the citations.
Acceptance criteria
Requirement: Start-up App grant check
The Service SHALL read GET /app/installations/{installation_id} with the App JWT at start and SHALL compare the granted permissions with CONST_GITHUB_APP_TOKEN_PERMISSIONS and CONST_GITHUB_APP_METRICS_TOKEN_PERMISSIONS.
Scenario: Missing permission stops the start
- WHEN A test gives the start path a recorded installation answer that lacks the administration permission.
- THEN The start raises ValueError whose message holds administration, and no later start step runs.
Requirement: Grant level comparison
The start-up check SHALL name each permission whose granted level is below the level that the two constants ask for.
Scenario: Read grant where write is required
- WHEN A test gives the check a recorded answer that grants contents: read while the constants ask for contents: write.
- THEN The ValueError message holds contents, the granted level and the required level.
Requirement: Failed installation read stops the start
A refused or failed GET /app/installations/{installation_id} MUST stop the Service start and MUST name the request path and the status, without the private key.
Scenario: GitHub refuses the JWT read
- WHEN A test gives the check a recorded HTTP 401 answer for the installation read.
- THEN The check raises ValueError whose message holds /app/installations/42 and 401, and does not hold the private key.
Requirement: Permission sets from constants
The start-up check SHALL take both permission sets from src/devops_cli/config/constants.py and SHALL ask for no permission outside their union.
Scenario: Union of the two sets
- WHEN A test compares the required permissions of the check with the merged CONST_GITHUB_APP_TOKEN_PERMISSIONS and CONST_GITHUB_APP_METRICS_TOKEN_PERMISSIONS.
- THEN The two mappings are equal.
Requirement: ADR 0015 supersession
A new ADR SHALL supersede ADR 0015, and the same change SHALL set status: superseded and superseded-by on ADR 0015 and SHALL add its Superseded by line.
Scenario: Two-way supersession link
- WHEN uv run devops ci test tests/invariants/test_adr_records.py runs on the changed tree.
- THEN The command passes: the new record names 0015, 0015 names the new record, and both records keep the front matter, body-hash and length rules.
Requirement: Restated options and confirmation
The new ADR SHALL restate each rule and each rejected option of ADR 0015 that stays in force in one Considered Options section, and SHALL name its proof in a Confirmation section.
Scenario: Restated options pass the record rules
- WHEN uv run devops ci test tests/invariants/test_adr_records.py runs on the changed tree.
- THEN The command passes: the record holds one Considered Options section whose every bullet ends in chosen., rejected, because <reason>. or deferred until <condition>., and a Confirmation section that names a test.
Requirement: Citation move
The change SHALL move every citation of ADR 0015 in src/, tests/ and .github/ to the new record.
Scenario: No stale citation
- WHEN uv run devops ci test tests/invariants/test_adr_superseded_citations.py runs on the changed tree.
- THEN The command passes: no file in src/, tests/ or .github/ cites ADR 0015.
Requirement: ADR index and token cap
The new ADR SHALL fit in the tokens that ADR 0015 frees, and the ADR index SHALL list it.
Scenario: Index and token cap pass
- WHEN uv run devops ci test tests/invariants/test_adr_records.py tests/roadmap/test_roadmap_adr.py and uv run devops docs check run on the changed tree.
- THEN Both commands pass: the index lists the new record, no generated document is stale, and the token cap accepts the new record.
Requirement: Pending a person after the merge
The owner SHALL merge the pull request after the three GitHub App settings of owner decision 3 are applied.
Scenario: Owner merges the change
- WHEN The three App settings are applied and the checks of the pull request pass.
- THEN A live check of the pull request shows merged by the owner, and the next Service start names no missing permission.
Existing Tool Considered
gidgethub (https://github.com/gidgethub/gidgethub), verdict in-use: the alternatives check in the issue body records what it covers and lacks. The proposal fills those lacks in src/devops_cli/server/ for the start-up check, in src/devops_cli/config/constants.py for the two sets, and in docs/adr/ for the new record and the citation move. Cost to build and test the comparison: about 20,000 tokens and about 2 hours. Cost to keep: about 1,000 tokens at each change of a permission set.
Key questions
- Which client sends the App JWT read of GET /app/installations/{id}?: gidgethub, through the project GitHub client with app_id and private_key. ADR 0006 makes it the GitHub transport, and it already signs the App JWT for the token exchange. (best practice) [sources: docs/adr/0006-github-session-requests-go-through-gidgethub.md, docs/adr/0015-roadmap-jobs-act-as-a-github-app-on-the-personal-account.md]
- Chosen: gidgethub. ADR 0006 makes it the transport, and it signs the App JWT already.
- Rejected: A new direct HTTP client. It adds a second transport and a second auth path with no new capability.
- Rejected: PyGithub. It adds a dependency that no code uses and a second GitHub client.
- Does a missing permission stop the Service start or only log a warning?: It stops the start and names each missing or insufficient permission. The Service cannot do its work with a token that lacks a permission, and a warning hides the failure until a later request. (best practice) [sources: openspec/specs/github-app-identity/spec.md, docs/adr/0015-roadmap-jobs-act-as-a-github-app-on-the-personal-account.md]
- Chosen: Fail the start and name each permission. The Service cannot do its work with a token that lacks a permission.
- Rejected: Log a warning and continue. A later request fails without naming the permission.
- Rejected: Retry the read with backoff. A grant does not change during a restart, so a retry delays the same failure.
- Does the check compare permission names only, or names and levels?: It compares names and levels. A grant of contents: read where the constants ask for contents: write is reported as missing. (best practice) [sources: src/devops_cli/config/constants.py]
- Chosen: Names and levels. The constants hold a level for each name, and a read grant cannot do a write.
- Rejected: Names only. It would pass a grant that cannot do the work.
- How does the change record the App identity in the ADR set?: A new ADR supersedes ADR 0015 with a two-way link. It sets supersedes: ["0015"] and restates each live rule and rejected option. The same change sets status: superseded and superseded-by on 0015 and adds its Superseded by line. (best practice) [sources: docs/adr/README.md, docs/adr/0015-roadmap-jobs-act-as-a-github-app-on-the-personal-account.md]
- Chosen: A new ADR that supersedes 0015. The README requires a supersession after the third amendment or when the body contradicts the code, and 0015 has six amendment notes.
- Rejected: Amend 0015 in place. The README forbids an edit of the body of an accepted record.
- Rejected: Add a Status History line only. The permission sets, the webhook and the start-up check are rules, not one dated fact.
- Which test proves that the citations of ADR 0015 moved?: tests/invariants/test_adr_superseded_citations.py scans src/, tests/ and .github/ and fails on a citation of a superseded record. It checks no count, so the criterion is that no citation remains. The issue gives no source for the number 22. [sources: tests/invariants/test_adr_superseded_citations.py, docs/adr/README.md]
- Which GitHub App settings does the owner change, and in what order?: Owner decision 3 of 2026-11-12 names three settings. (1) Cut the App grant to the 9 permissions that the code asks for. (2) After feat(service): verify GitHub App webhooks with one secret #4417, turn on the App webhook for Issues only and delete the 7 repository hooks in the same hour. (3) Bind the 3 required checks of the ruleset to the GitHub Actions app. (best practice) [sources: src/devops_cli/config/constants.py]
- Chosen: Apply the three settings in the order of owner decision 3. The owner recorded this order on 2026-11-12 in the issue body.
- How does the new record fit the alternatives token budget?: The record must fit in the tokens that ADR 0015 frees, under CONST_ROADMAP_ALTERNATIVES_MAX_ADR_TOKENS of 8,192. Short option bullets keep the budget, because options hold most of the tokens. [sources: docs/adr/README.md]
Fit
Fits in one pull request.
Suspected block
The owner applies the three GitHub App settings of owner decision 3 of 2026-11-12 before this item merges.
Activity
dan-petty commentedon Nov 12, 2026
Both concern the App token permission sets, but #2473 configures the sets while this candidate adds a startup check and an ADR record.devops-cli-service commentedon Nov 16, 2026
Alternatives check: in-use
Reason: The searches turned up no dedicated tool that verifies a GitHub App's granted permissions at startup; that check is project logic. The issue itself already names the tool it uses — the GitHub REST call
GET /app/installations/{id}with the App JWT, through gidgethub — and says "No new tool." gidgethub is open, maintained and already the project's chosen GitHub transport (ADR 0006), so it covers the tool need and no ADR rejects it.The repository already uses this tool.
Tool: gidgethub/gidgethub (https://github.com/gidgethub/gidgethub)
Covers:
Lacks:
Tools considered:
Searches run:
Sources:
Checked on 2026-11-16. A person decides what this means for the item. The check changes no label and closes no issue.
devops-cli-service commentedon Nov 17, 2026
Owner question: Does the owner change the GitHub App settings before this item merges? (a person decides)
Options
Recommendation: Decide the question: only a person can answer it.
Evidence
devops-cli-service commentedon Nov 21, 2026
Next step: the open items close, or a person replies in a comment or edits the body. See Dependencies in the section Proposed design of the body.