Skip to content

fix(skills): the infra-platform follow-ups, and the gate hole verifying them exposed - #708

Merged
athvin merged 5 commits into
mainfrom
fix/infra-platform-followups
Nov 6, 2026
Merged

athvin merged 5 commits into
mainfrom
fix/infra-platform-followups

Conversation

@athvin

@athvin athvin commented Nov 6, 2026

Copy link
Copy Markdown
Owner

The two follow-ups left open at the end of #685, done — plus two defects that only showed up because they were verified rather than assumed.

1. main had no completed rust run — already resolved, no change

Four consecutive merges had their post-merge rust run cancelled by the next merge. 20a77159 has rust: success and contains #685's merge d8768a69, so the push-side gate did complete with the change on main. Nothing to fix.

2. The generator — built, but not the one proposed

I proposed deriving the NodePool manifests and the Terraform stacks. Checked against the tree, half of that was worthless: make cluster-objects runs kubectl apply -f infra/k8s/nodepools/, which is non-recursive, so the deployed set is the top level and measure/ is excluded by the layout itself. A set difference there is empty by construction.

What is genuinely unguarded is the stack enumerations. infra.yml lists stacks three separate times — the validate shell loop, plan's matrix.include, apply's — and nothing cross-checks them against the tree. A stack missing from one is never checked and no job goes red.

So infra-coverage derives three tables, each a set difference. One surfaced something nobody would guess from the old hand-written table: infra/k8s/secrets/ and network-policy-controller.yaml are referenced by no target, script or workflow in the tree — hand-applied or not applied at all.

3. An eval I added in #685 demanded a wrong answer

This is the one worth reading. The rule said "A new stack needs the plan role's state read first, in its own PR." The grant is actually two prefix wildcards (envs/*.tfstate, bootstrap/*.tfstate), so a new stack under either needs no IAM change. #358 needed one because bootstrap/ was a new prefix.

#685's eval 7 made that claim a MUST and used envs/staging as its example — so a session answering correctly would have been scored as failing. Fixed, with a must-not for the imprecise version.

4. The gate had a hole, and my own change fell into it

Mutation-testing commit 2 (fake envs/staging stack → committed block goes stale) returned "generated references are current", exit 0.

Adding a generator takes two edits nothing tied together: the splice call, and an entry in generated_files — the list the drift check iterates. infra-coverage had the first and not the second, so it regenerated locally and was never compared against HEAD. A stale block would have passed CI. Nothing hinted at it: the "regenerated N" line prints the array length, not what was spliced.

Fixed, plus a guard — splice now asserts its target is registered and fails with the reason.

Verification

Mutation-tested three ways, because bash -n passed while the generator was fatally broken (under set -o pipefail, the no-match grep that is the gap case exits 1 and killed the whole regen — twice, once per pipeline stage — with an empty block as the only symptom):

Test Expected Result
Source mutated, committed block stale FAIL exit 1, names the file + diff
Clean tree pass exit 0
Splice with no generated_files entry FAIL exit 1, actionable message

make skills-check: ok, regen a no-op on the rebased tree. detect_classify on this diff returns code=true drift=true, so unlike #685 the required checks actually exercise it rather than all skipping.

No Rust, frontend or Terraform source changes, so cargo/next/terraform gates have no subject here beyond proving the workspace still builds.

Consistency sweep

  • infra/k8s/priorityclasses/ was missing from the non-chart manifest table; "the three upstream chart value files" was already wrong (there are four plus openobserve.yaml). Count removed, not corrected.
  • make nodepools → make cluster-objects, old name still callable.
  • Checked and left alone: docs/infrastructure.md §5.1 is still titled "Karpenter disruption settings", every skill this one routes to exists, and fix(skills): infra-platform's stale NodePool count, and two one-way routes #685's routing tails survived the later audits in all three directions.

🤖 Generated with Claude Code

bmoore813 and others added 5 commits November 6, 2026 01:07
…he wrong answer

Doing the follow-ups from #685 started by checking the premise of one, and the
premise was wrong.

The plan role's state grant is two PREFIX wildcards — `envs/*.tfstate` and
`bootstrap/*.tfstate` (envs/core/ci-terraform.tf:112-118). So a new stack under
either prefix needs no IAM change at all. The rule read "A new stack needs the
plan role's state read first, in its own PR", which is true only for a stack
introducing a NEW prefix. That is what #358 actually did: it added
`bootstrap/*.tfstate` so `bootstrap/state-backend` could join the plan matrix.
#350 is cited alongside it as the same apply-before-merge ordering trap, but on
sccache roles rather than state, so it no longer reads as evidence for this rule.

Eval 7, which #685 added, was worse: it made that claim a MUST and used
`envs/staging` as its example, so a session answering correctly — no grant
needed, the wildcard covers it — would have been scored as failing. It now
tests the precise rule, with a must-not for the imprecise one.

What a new stack does need is the part the rule never mentioned, and it is the
quieter failure: the `validate` tier's `for d in …` loop and the `plan` job's
`matrix.include` are both hand-written enumerations. A stack in neither is
never checked and nothing turns red. The next commit derives that gap.

make skills-check: ok.

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

the follow-up that stops them coming back. This is it — but not the one that
was proposed, and the difference is the point.

The proposal was a NodePool inventory plus a stack list. Checked against the
tree, half of that is worthless: `make cluster-objects` runs
`kubectl apply -f infra/k8s/nodepools/`, which is non-recursive, so the deployed
set is the top level and `measure/` is excluded by the layout itself. A set
difference there is empty by construction.

What is NOT covered is the stack enumerations. `infra.yml` lists stacks three
separate times — the `validate` shell loop, `plan`'s `matrix.include` and
`apply`'s — and nothing cross-checks them against the tree. A stack missing from
one is never checked and no job goes red. Same shape for `infra/k8s`: the skill
carried a hand-written manifest table that had already gone stale (it omitted
`priorityclasses/`, added later).

So `infra-coverage` derives three tables, each a set difference:

- stacks in the tree (by `backend.tf`) against all three tiers, flagging any
  stack no tier reaches
- every `infra/k8s` path against the sites referencing it — which surfaced that
  `secrets/` and `network-policy-controller.yaml` are referenced by NOTHING in
  the tree, so they are hand-applied or not applied at all. Nobody would guess
  that from the old table
- the NodePool manifests against the non-recursive apply, which derives the
  `measure/` exclusion that #685 had to state by hand

Verified by running it, not by reading it: `bash -n` passed while the generator
was fatally broken. Under `set -o pipefail` the no-match `grep` that IS the gap
case exits 1 and killed the entire regen, twice — once for the search and again
for the filter stage — with an empty generated block as the only symptom. Both
stages are now explicitly tolerant, and the committed output exercises both
(three rows resolve to "nothing in the tree"). That trap is now recorded in
docs/agent-skills.md for the next generator author.

make skills-check: ok, 14 generated files.

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

Found by mutation-testing the previous commit rather than trusting it: added a
fake `envs/staging` stack so the committed coverage block went stale, ran
`skills-check check`, and it reported "generated references are current" and
exited 0.

Adding a generator takes TWO edits that nothing tied together — the `splice`
call in `run_regen`, and an entry in `generated_files`, which is the list
`run_drift_check` iterates. `infra-coverage` had the first and not the second,
so the file regenerated locally and was never compared against HEAD. A stale
committed block would have sailed through CI, which is the one failure mode this
gate exists to prevent.

Nothing hinted at it. The "regenerated N generated files" line prints
`${#generated_files[@]}` — the array length, not what was actually spliced — so
the count was identical whether or not the new file was registered.

Two changes: the missing entry, and a guard so the pairing cannot be forgotten
again. `splice` already knows its target, so it now asserts membership and fails
with the reason rather than leaving the file silently unguarded.

Verified by mutation, all three ways:
- stale committed block  -> exit 1, names the file and prints the diff
- clean tree             -> exit 0
- splice with no array entry -> exit 1, "spliced but missing from
  generated_files, so the drift check would never see it"

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

The consistency sweep over what the merge left behind. Both defects are the
class the new generated coverage table exists to end, which is why they were
worth finding rather than just fixing.

- `infra/k8s/priorityclasses/` was missing from the non-chart manifest table.
  It exists, holds the task PriorityClass, and is applied by the same target as
  the node pools and again by the kind probe.
- "the namespace and the **three** upstream chart value files" was already
  wrong: there are four value files plus `openobserve.yaml` beside
  `namespace.yaml`. The count is gone, not corrected.
- The closing claim that these are "applied directly" was doing less work than
  it sounds. `secrets/` and `network-policy-controller.yaml` are referenced by
  no target, script or workflow anywhere in the tree, so they are applied by
  hand or not at all — stated now, because a reader assumes the opposite.
- The table is marked purpose-only, deferring the inventory to the generated
  table. It names `coverage.md` in prose rather than linking it, since a
  reference must not link a sibling.
- `make nodepools` is now `make cluster-objects`, with the old name kept
  callable. The bullet also names the mechanism that matters: the apply is
  non-recursive, which is the entire reason `measure/` stays out of the cluster.

Checked and found still accurate, so left alone: `docs/infrastructure.md` §5.1
is titled "Karpenter disruption settings", and every skill this one routes to
exists.

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

CI caught this; `make skills-check` could not. The membership tests in
`gen_infra_coverage` were spelled as a `printf` piped into a quiet exact-match
grep — the form `scripts/ci/skills-check-test.sh` exists to forbid in this
file, because a quiet grep closes the pipe at its first match, SIGPIPEs the
writer under `pipefail`, and can report a FOUND match as missing. Three lines,
one per tier, each a latent false "—" in the coverage table.

Replaced with `in_list`, a pure-bash `[[ ]]` membership test: no subprocess, no
pipe, nothing to race. The needle is quoted inside the pattern so a stack path
matches literally rather than as a glob.

Two things worth recording, because both cost a round trip:

- The gate I verified was not the gate CI runs. `make skills-check` runs
  `skills-check.sh all`; the meta-test is a SEPARATE workflow step
  (`rust.yml:388`) that the Makefile target does not invoke. Running the local
  target to green says nothing about it.
- That test is TEXTUAL, so the first fix failed it again on the explanatory
  comment, which quoted the bad form as an example. The comment now describes
  the shape instead of spelling it, and says why.

Verified: skills-check-test 5 passed / 0 failed, `skills-check check` exit 0
with regen a no-op, and the regenerated table is byte-identical to the
committed one — so `in_list` agrees with what the piped form produced.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
@athvin
athvin merged commit 23195f9 into main Nov 6, 2026
39 checks passed
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