Skip to content

fix(skills): infra-platform's stale NodePool count, and two one-way routes - #685

Merged
athvin merged 1 commit into
mainfrom
fix/infra-platform-audit
Nov 6, 2026
Merged

athvin merged 1 commit into
mainfrom
fix/infra-platform-audit

Conversation

@athvin

@athvin athvin commented Nov 6, 2026

Copy link
Copy Markdown
Owner

A /skill-audit of infra-platform against docs/agent-skills.md, with the six findings applied.

The count was already wrong

SKILL.md said "The three manifests in infra/k8s/nodepools/". There are four karpenter.sh/v1 NodePool manifests under that path — the three deployed pools plus measure/runner-probe.yaml. evals.md asserted the same three in a must line, so the eval would have scored a correct answer wrong.

The number is deleted rather than corrected, per the standard's no-counts rule. What replaces it is the fact a session actually needs: a new pool goes beside the deployed ones, not into measure/, which make nodepools deliberately does not apply and which is the only pool in the tree carrying limits.

Routing went one way in two places

infra-platform names ci-and-supply-chain and ducklake-lakehouse; neither named it back. Per the standard, one-way routing loses the trigger to the incumbent:

Prompt Fired Should also fire
"why is the infra plan job not blocking this PR?" ci-and-supply-chain infra-platform owns infra.yml's tiers, roles and destroy guard
"the pod gets AccessDenied on the lake bucket" ducklake-lakehouse ("object-store or S3 credentials") infra-platform owns the Pod Identity association

Both descriptions now route back. ci-and-supply-chain's verbose project-board tail was trimmed to fit under the 1,024-character cap (989 now). Neither first em-dash clause changed, so the generated inventory tables in CLAUDE.md and docs/agent-skills.md do not move.

The rest

  • The Terraform-only rule was missing from the authoring skill. CLAUDE.md says "the infra-platform skill carries the authoring ones", yet the never-author-CDK/CloudFormation/SAM rule sat only on aws-account-operations — the operations skill. Authoring CDK is an authoring mistake.
  • Counts out of prose: "All five stacks" (twice) and "Five rules". A job display name now defers to ci-and-supply-chain's generated required-checks block, which derives names from the workflows.
  • Duplication pinned: the dev-resume three-way-merge trap and the BFF-boundary topology were each stated twice across SKILL.md and references/clusters-and-charts.md with nothing canonical. SKILL.md is now the source; the reference defers.
  • Two eval scenarios added. The plan/apply section is the body's longest and had no scenario — the new one is the #358/#350 failure (a stack and its plan leg in one PR). And nothing tested selection, the signal the standard calls most valuable, so scenario 8 poses the lake-bucket prompt with no skill named and records which of the three skills fires.

Verification

make skills-check → ok (regen + drift + lint + overrides). Touches no Rust, frontend or infra file, so rust.yml/frontend.yml detect should skip their compile jobs.

Note docs/agent-skills.md's own caution: a .claude-only PR's green does not prove the generated references are current, because agent skills (lint + drift) is not yet a required check. Regen + drift were run locally instead, and the post-merge push-to-main run is the one to watch.

🤖 Generated with Claude Code

@athvin

athvin commented Nov 6, 2026

Copy link
Copy Markdown
Owner Author

Heads-up from #683 (just merged, ca401b8a): it edits the same line — ducklake-lakehouse's description — so this PR will go DIRTY on the next refresh. Zero CI runs on a conflicted PR here, so it needs a rebase and a full pass rather than a re-poll.

The two edits are compatible; #683 replaced the ducklake-performance tail (it routed on "analysing profiling campaigns", vocabulary for the retired harness) with a mechanism-versus-decision split. Keeping both, the reconciled tail is:

For whether a partition or sort change is justified at all — the measurements a layout proposal must carry, and reading a profiling artifact — see ducklake-performance; for declaring a lake table or statement see entity-framework; for running pipeline stages see er-engine-ops; for the lake bucket itself and the IAM a pod needs to reach it see infra-platform.

That is your clause appended to the merged line, so git rebase origin/main + take both sides.

…outes

A /skill-audit of infra-platform against docs/agent-skills.md. Six findings,
all applied here.

The count was already wrong. "The three manifests in infra/k8s/nodepools/"
counted the deployed pools and missed measure/runner-probe.yaml, which is also
apiVersion: karpenter.sh/v1, kind: NodePool — and evals.md asserted the same
three, so the eval would have scored a correct answer wrong. The number is gone
rather than corrected: what a session actually needs is that a new pool goes
beside the deployed ones and not into measure/, which `make nodepools`
deliberately does not apply and which is the one pool carrying `limits`.

Routing went one way in two places. infra-platform names ci-and-supply-chain
and ducklake-lakehouse; neither named it back, so on "why is my infra plan job
not blocking the PR?" or "the pod gets AccessDenied on the lake bucket" the
incumbent wins and this skill never loads. Both descriptions now route back.
ci-and-supply-chain's project-board tail was trimmed to pay for it (its first
em-dash clause is untouched, so the generated inventory tables do not move).

Also: the Terraform-only rule now appears in the skill CLAUDE.md names as the
carrier of the authoring rules — it sat only on aws-account-operations, the
operations skill, while authoring CDK is an authoring mistake. "All five
stacks" (twice) and "Five rules" lost their counts, and a job display name now
defers to ci-and-supply-chain's generated required-checks block. The dev-resume
and BFF-boundary explanations were stated twice across SKILL.md and the
reference with nothing canonical; SKILL.md is now the source and the reference
defers. Two eval scenarios added: the plan/apply section was the body's longest
and had none, and nothing tested selection at all.

make skills-check: ok (regen + drift + lint + overrides). No Rust, frontend or
infra files change.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
@athvin
athvin force-pushed the fix/infra-platform-audit branch from d95b103 to d766901 Compare November 6, 2026 05:04
@athvin
athvin merged commit d8768a6 into main Nov 6, 2026
33 checks passed
@athvin
athvin deleted the fix/infra-platform-audit branch November 6, 2026 05:08
athvin added a commit that referenced this pull request Nov 6, 2026
…ng them exposed (#708)

* fix(skills): the new-stack rule was imprecise, and an eval demanded the 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]>

* feat(skills): derive infra coverage, because the gap is what nobody maintains

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]>

* fix(skills): a spliced file missing from generated_files was never drift-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]>

* docs(skills): the manifest table omitted a directory and miscounted another

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]>

* fix(skills): the generator piped a writer into grep -q, which CI forbids 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]>

---------

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