Skip to content

fix(ci): finish the private-repo correction, and stop infra PRs paying the Rust gate - #366

Merged
athvin merged 1 commit into
mainfrom
bm/ci-private-sweep
Nov 1, 2026
Merged

athvin merged 1 commit into
mainfrom
bm/ci-private-sweep

Conversation

@athvin

@athvin athvin commented Nov 1, 2026

Copy link
Copy Markdown
Owner

The tail of #362, which corrected the "public repository" claim in the files it owned and deliberately left rust.yml and build-cost.md to #359. #359 has corrected one line of build-cost.md and is still open, so these are the remaining ones — the edits sit in different hunks from its, so a rebase either way is clean.

1. rust.yml's six sccache comments

The cache-poisoning argument stands; only its premise moves. Poisoning outlives the credential that planted it, which is why writes are restricted to main — and the repository being private means the branch has to come from a collaborator rather than from anyone at all. Narrower, not closed.

2. build-cost.md said the CI bill is zero

It claimed "its minutes are free, because standard GitHub-hosted runners are free for public repositories. The current bill for all of this CI is zero." That's materially wrong on a private repo, and it's the one instance of this error with a real consequence: the runtime this entire file measures is a cost, not only a wait.

Two downstream conclusions moved with it:

  • Option 2 (org on Team plan) said it "gives up the free-for-public-repos standard-runner minutes". It doesn't — it trades one metered rate for another, which is a smaller step than it read.
  • Option 3 (self-hosted) led with the fork-PR objection, which is why GitHub advises against self-hosted runners on public repos. That mostly doesn't apply here. What remains is ordinary and still real: a compromised collaborator account or a malicious dependency gets code execution inside the AWS account, so the runner wants its own least-privileged identity.

No replacement figure is asserted. The allowance and consumption are account settings rather than repository state, and gh api /users/{user}/settings/billing/actions needs a user scope this session doesn't hold — so the text says where to read them rather than substituting one unverified number for another.

3. infra.yml joins the Rust detect denylist

Along with scripts/ci/tf-*, which was already exempt in infra.yml's own detect but not here. An infra-only PR was paying the full ~40-minute backend gate — test plus the DuckLake e2e — and infra.yml defines no Rust job and cannot affect the workspace build. Every infra PR in this series paid it, which is how it got noticed.

Named file by file, not as ^\.github/workflows/: rust.yml, frontend.yml and images.yml must keep triggering the gates they define, or a change to a gate would stop reporting on exactly the PR most likely to break it.

Simulated over nine shapes:

change gate
infra.yml alone / + terraform / + a tf helper skip
rust.yml, frontend.yml, images.yml run
docs/, scripts/ci/actionlint.sh run
infra.yml + a Rust source file run

This PR should be the first to demonstrate it: it touches rust.yml, so the Rust gate correctly still runs here. The next infra-only PR is where it shows.

Left alone, checked rather than assumed

rust/deny.toml's "Public repo, fetched over HTTPS in CI" describes github.com/athvin/feather-flow — the ff-analysis dependency, not this repo — and that one really is public (gh repo view --json visibility → PUBLIC). The two remaining matches in build-cost.md and ci-terraform.tf are my own text quoting the old claim in order to correct it.

🤖 Generated with Claude Code

…g the Rust gate

The tail of #362, which corrected the "public repository" claim in the
files it owned and deliberately left `rust.yml` and `build-cost.md` to
#359. #359 has corrected one line of `build-cost.md` and is still open, so
these are the remaining ones — the edits sit in different hunks from its,
and a rebase either way is clean.

**`rust.yml`'s six sccache comments.** The cache-poisoning argument stands;
only its premise moves. Poisoning outlives the credential that planted it,
which is why writes are restricted to `main` — and the repository being
private means the branch has to come from a collaborator rather than from
anyone at all. Narrower, not closed.

**`build-cost.md` claimed "its minutes are free, because standard
GitHub-hosted runners are free for public repositories" and that the bill
for all of this CI is zero.** That is materially wrong on a private repo:
the runtime this whole file measures is a cost, not only a wait. Two
downstream conclusions moved with it — an organisation on the Team plan
trades one metered rate for another rather than giving up a free one, which
is a smaller step than it read; and the usual objection to self-hosted
runners (a fork PR executing arbitrary code) mostly does not apply, so what
remains is the ordinary compromised-collaborator case and the runner
wanting its own least-privileged identity.

No replacement figure is asserted. The allowance and consumption are
account settings rather than repository state, and
`gh api /users/{user}/settings/billing/actions` needs a `user` scope this
session does not hold — so the text says where to read them instead of
substituting one unverified number for another.

**`.github/workflows/infra.yml` joins `rust.yml`'s detect denylist**, with
`scripts/ci/tf-*` which was already exempt in `infra.yml`'s own detect but
not here. An infra-only PR was paying the full ~40-minute backend gate —
`test` plus the DuckLake e2e — and `infra.yml` defines no Rust job and
cannot affect the workspace build. Every infra PR in this series paid it.

Named FILE BY FILE and not as `^\.github/workflows/`: `rust.yml`,
`frontend.yml` and `images.yml` must keep triggering the gates they define,
or a change to a gate would stop reporting on exactly the PR most likely to
break it. Simulated over nine shapes — infra.yml alone, with terraform, and
with a tf helper all skip; rust.yml, frontend.yml, images.yml, docs,
`scripts/ci/actionlint.sh`, and infra.yml+rust all still run.

`rust/deny.toml`'s "Public repo" is left alone: it describes
`github.com/athvin/feather-flow`, the ff-analysis dependency, which really
is public (checked).

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
@athvin
athvin merged commit 74437ed into main Nov 1, 2026
24 checks passed
athvin pushed a commit that referenced this pull request Nov 1, 2026
…safe rule

Noticed on this PR's own run: it correctly paid the full backend gate
(because it touches `docs/`, which is never exempt), but `drift.yml` is a
new workflow and #366 had only named `infra.yml`. Leaving an inconsistency
I created one commit earlier is worse than one more regex token.

Same argument as `infra.yml`: `drift.yml` defines no Rust job and cannot
affect the workspace build. `rust.yml`, `frontend.yml` and `images.yml` stay
out of the exempt set, because a change to a gate must keep reporting on
exactly the PR most likely to break it.

While here, the rule behind the enumeration is now written down rather than
implied: naming files, instead of exempting `^\.github/workflows/` and
listing exceptions, is the FAIL-SAFE direction. A workflow added later runs
the gate until someone argues it should not, rather than skipping it until
someone notices. Verified with a hypothetical `something-new.yml`, which
still runs.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
athvin added a commit that referenced this pull request Nov 1, 2026
…367)

* feat(infra): detect out-of-band drift, which -refresh=false gives up

§14.2 gives up one thing on purpose: the plan tier runs `-refresh=false`,
because `er-ci-tf-plan` is assumable from any PR branch and a refreshing
plan reads secret VALUES. What that loses is drift — a console edit, a
manual fix during an incident, an AWS-side default that moved.

Nothing noticed. The only thing that refreshes is `apply` on `main`, which
then silently reconciles whatever it finds, so drift stayed invisible until
some unrelated infra PR merged and quietly fixed or failed on it with
nobody connecting the two. Dev has already shown this once: #357's apply
reported `0 added, 1 changed, 0 destroyed` against a PR plan that had shown
nothing.

`drift.yml` runs `plan -refresh-only` daily across all four stacks.
`-refresh-only` is a different question from the plan tier's and that is
why this is a separate workflow rather than a flag: it compares STATE
against REALITY and ignores the configuration entirely, so what it reports
is only ever "something changed outside Terraform", never "someone edited
a .tf file".

**A third read role, because the second one must not grow.**
`er-ci-tf-drift` holds the two reads `ReadOnlyAccess` omits —
`secretsmanager:GetSecretValue` and `bcm-data-exports:GetExport`, the two
that broke the first run of the plan gate in #354 — which a refresh needs
and the plan role must never have.

That is safe only because of who can reach it, and it takes TWO trust
conditions rather than one:

- `sub` pinned to `:ref:refs/heads/main`. No PR branch can mint that
  claim. On its own it still admits any `main`-ref job, including the plan
  tier on a push, so it is necessary and not sufficient.
- `job_workflow_ref` pinned to `drift.yml` on `main`. This is the condition
  that narrows it to one file's jobs, so adding a step to another workflow
  cannot quietly inherit secret-read.

Matched with `StringLike` and a leading wildcard deliberately: the
repository prefix in `job_workflow_ref` is not the customised immutable
`sub` prefix, and pinning a format that AWS and GitHub both have to agree
on would be a silent never-match rather than a visible error.
`GetSecretValue` is scoped to `er/*` in this account, not `*`.

Read-only including the lock, so `-lock=false` like the plan tier — the
role holds no S3 write and acquiring the lockfile is one. A refresh-only
PLAN writes no state; only `apply -refresh-only` would, and nothing here
applies. **Drift is reported for a human, never auto-reconciled:** writing
reality back into state is how a console change becomes permanent without
anyone deciding so.

Drift FAILS the run rather than warning, because a scheduled workflow that
goes red notifies and one that warns is a line in a log nobody opens. If an
environment turns out to drift chronically the answer is to fix the
configuration or record the exception, not to lower this to a warning —
which would retire the check while leaving it in the tree.

It can never be a required check: it never runs on a pull request.

One PR rather than the two the last three IAM changes needed. The ordering
trap does not apply here — `apply (core)` creates the role, and nothing
consumes it until the next cron or a manual dispatch, so there is no
same-run dependency to lose.

Verified by extracting both steps from the YAML and running them against a
stub terraform: exit 0 → `drifted=false` → job green; 2 → `drifted=true` →
red naming the env; 1 and an init failure → `drifted=error` → red saying it
is not a clean result; and an empty value fails closed. The summary step is
`always()` and ordered before the gate, so a red run explains itself
without opening the log.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>

* fix(ci): exempt drift.yml from the Rust gate too, and state the fail-safe rule

Noticed on this PR's own run: it correctly paid the full backend gate
(because it touches `docs/`, which is never exempt), but `drift.yml` is a
new workflow and #366 had only named `infra.yml`. Leaving an inconsistency
I created one commit earlier is worse than one more regex token.

Same argument as `infra.yml`: `drift.yml` defines no Rust job and cannot
affect the workspace build. `rust.yml`, `frontend.yml` and `images.yml` stay
out of the exempt set, because a change to a gate must keep reporting on
exactly the PR most likely to break it.

While here, the rule behind the enumeration is now written down rather than
implied: naming files, instead of exempting `^\.github/workflows/` and
listing exceptions, is the FAIL-SAFE direction. A workflow added later runs
the gate until someone argues it should not, rather than skipping it until
someone notices. Verified with a hypothetical `something-new.yml`, which
still runs.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>

---------

Co-authored-by: bmoore813 <[email protected]>
Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
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