Repository navigation
fix(infra): the deploy role trusts GitHub's immutable subject, so the workflow can sign in - #532
Merged
Conversation
… workflow can sign in The repository issues GitHub's immutable OIDC subject, which carries the owner and repository ids, so the deploy role's name-only subject never matched and the first production deploy could not assume it. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
This was referenced Oct 5, 2026
allisonmahmood
added a commit
that referenced
this pull request
Oct 15, 2026
A pull request that touches only `packages/execution`, `apps/infra`, the dev `scenarios/`, `t3.json` or `favicon.svg` gets no area label, because `.github/labeler.yml` names none of them (#471, #531 and #532 went out with no area or only `area:docs`). Triage reads the matching table in `docs/agents/triage-labels.md`, which had the same gaps. Nothing enforced the "change both together" note at the top of the labeler config, so the next package would slip through the same way. ## What changed - `packages/execution/**` and `apps/infra/**` join `area:server`. Execution is part of the Runtime context and infra is the hosting side. - `scenarios/**`, `t3.json` and `favicon.svg` join `area:ci`. These are the seeds `pnpm dev up` builds environments from, plus T3 Code's project config and icon. - The triage table's `area:server` and `area:ci` rows now match the globs line for line. The whole table is rewrapped because prettier pads its columns. - `scripts/labeler.test.ts`, which runs in `pnpm test`, reads the labeler config's `area:*` globs. It matches each directory git lists under `apps/` and `packages/` with minimatch and `dot: true`, the way actions/labeler v7 does, and fails naming any directory with no area. It probes each directory with `<dir>/package.json`: #471 touched only that and the lockfile, and a Markdown probe would always match `area:docs`. `minimatch` and `yaml` become root devDependencies; both were already in the lockfile. ## What I checked by hand The test, against deliberately broken configs: | Change | Result | | --- | --- | | None | passes | | Delete the `packages/execution/**` glob | fails: `expected [ 'packages/execution' ] to deeply equal []` | | Delete the `apps/infra/**` glob | fails: `[ 'apps/infra' ]` | | Rename `area:server` to `server` | fails, naming its 15 directories | | Add an untracked, unignored `packages/zz-scratch/package.json` | fails: `[ 'packages/zz-scratch' ]` | | Add an untracked `packages/core/zz-café.txt` (git quotes non-ASCII paths unless `-z`) | passes | I also ran actions/labeler's own code (`getLabelConfigs` and `checkMatchConfigs` with `dot: true`, from its source at the SHA pinned in `pr-labels.yml`) over `main`'s config and this branch's: | Changed files | `main` | this branch | | --- | --- | --- | | `scenarios/team/scenario.json` | none | `area:ci` | | `scenarios/brightline/patches/kudos/index.html` | none | `area:ci` | | `t3.json` | none | `area:ci` | | `favicon.svg` | none | `area:ci` | | `packages/execution/src/index.ts` | none | `area:server` | | `packages/execution/package.json` + `pnpm-lock.yaml` | none | `area:server` | | `apps/infra/src/index.ts` | none | `area:server` | | `pnpm-lock.yaml` alone | none | none (as the table says) | The label workflow runs on `pull_request_target` and reads `labeler.yml` from `main`, so this PR's own labels come from the old config. The new globs apply to PRs opened after this merges. ## Hit every surface Applied: the labeler config and triage table pair. They agree on every area changed here. Did not apply: the wire contract, CLI, dev loop (no runner or seed change), vocabulary, migrations, company resources, served pages, reverse states and repo layout. Closes #498 Made by Claude Opus 5.5 in Claude Code, running in T3 Code. --------- Co-authored-by: Claude Opus 5.5 (1M context) <[email protected]>
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.
The first production deploy (#416) failed at its first AWS step:
configure-aws-credentialscould not assumepatchy-production-deploy("Not authorized to perform sts:AssumeRoleWithWebIdentity"). The role trustsrepo:allisonmahmood/patchy-cloud:environment:production, but this repository issues GitHub's immutable subject claims, so its tokens sayrepo:allisonmahmood@20662394/patchy-cloud@1347287974:environment:productionand theStringEqualsnever matches.The subject format. GitHub's OIDC reference gives the immutable syntax as
repo:OWNER@OWNER-ID/REPO@REPO-ID:…, and says the owner and repository ids are "always included in thereposegment of thesubclaim"; the rest of the subject is the context, which for a job that references an environment isenvironment:ENVIRONMENT-NAME. The changelog describes only the subject changing; the reference still documents the issuer ashttps://token.actions.githubusercontent.com, andconfigure-aws-credentials@v6still requests thests.amazonaws.comaudience by default, so the provider and theaudcondition are unaffected. The repository'sactions/oidc/customization/subendpoint reportsuse_immutable_subject: trueandsub_claim_prefix: repo:allisonmahmood@20662394/patchy-cloud@1347287974, and those ids matchgh api repos/allisonmahmood/patchy-cloud(owner.id,id). The ids are public.The fix.
names.tsreplacesrepositorySlug(used only by the trust) withgithubSubjectRepo, the immutablereposegment verbatim as GitHub reports it, and the role trusts${githubSubjectRepo}:environment:${environment}. It stays one exactStringEqualsonaudandsub: same repository, same environment, no wildcard, and now also bound to the ids, so a renamed or re-registered owner or repository name cannot claim it. A new infra test pins the synthesized condition to the literal subject; it fails against the old one.docs/OPERATIONS.mdsays to keep the immutable subject on, since turning it off would lock the workflow out again.After merge. The workflow cannot apply this itself, because it has to assume the role first. An administrator redeploys
patchy-production-basefrom their shell, as in "Setting up production" step 2, then reruns the Deploy workflow.Hit every surface. Applied: none of the code surfaces (no wire contract, CLI, dev loop, migrations, company resources, served pages or layout change). Docs:
docs/OPERATIONS.mdupdated; ADR-0012's "trusted only for the repository's GitHub environment of the same name" still holds. No vocabulary change. Infra snapshot unchanged (it pins security groups only); the trust is pinned by the new test.Refs #416
Made by Claude Opus 5.5 (1M context) in Claude Code, driven from T3 Code.