Skip to content

fix(ci): run the drift check where .claude-only PRs can see it, and stop it passing silently - #279

Merged
athvin merged 1 commit into
mainfrom
fix/skills-drift-runs-unconditionally
Oct 22, 2026
Merged

athvin merged 1 commit into
mainfrom
fix/skills-drift-runs-unconditionally

Conversation

@athvin

@athvin athvin commented Oct 22, 2026

Copy link
Copy Markdown
Owner

Two defects. The second is mine, from #271, about an hour old.

1. The drift check did not run on the PRs that change skills

detect skips every compile job for a PR touching nothing but .claude/**, and the drift check rode the cargo lint job — so it did not run on exactly those PRs.

That reasoning was sound when it was written: every generator derived from code outside .claude/, and a code change always runs the full gate. gen_skill_inventory broke it. That generator derives from SKILL.md descriptions, so a one-line description edit makes the inventory tables stale.

Demonstrated — changing landing-page's first clause to "the PROBE route group":

FAIL generated skill references are stale
  docs/agent-skills.md
+| `landing-page` | the PROBE route group that prerenders statically …

A PR carrying only that change reports three green checks, none of which looks at staleness. It merges green, and the push-to-main run turns main red. That exact sequence is already in this repo's history from 2026-10-21.

Fix: the skills job runs all instead of lint. It still needs no toolchain — verified by running the whole script in a bare ubuntu:24.04 with no cargo, node, pnpm, docker, terraform or aws. Every generator is grep/awk/sed over checked-in files.

The check stays in the cargo job as well, deliberately: skills is not a required context, so on its own it cannot block a merge. Promoting it would make the pair redundant — worth doing now that both halves have been observed failing, but that's a branch-protection change and yours to make.

Renamed to agent skills (lint + drift), safe because it is not among the eight required contexts. The generated required-checks.md picked the rename up by itself.

2. The drift check passed silently when git was unavailable

I introduced this in #271. The per-file comparison skips anything it cannot read out of HEAD (git cat-file -e … || continue) — correct for a newly added file, but outside a git repository every file is skipped, the stale list comes back empty, and the check reports "generated references are current" and exits 0 having compared nothing.

That is the failure this repo keeps a rule about: success and never-ran are indistinguishable from outside. It is the same shape as the pipefail-killed-the-script and semgrep-parse-error cases already in docs/frontend-testing.md.

Fix: two liveness guards, mirroring lint's zero-skills exit and check-bff-authz.mjs's zero-routes exit — HEAD must resolve, and the comparison must have examined at least one file.

Case Before After
no git repo ok, exit 0 FAIL … cannot resolve HEAD, exit 1
every generated_files path wrong caught by the splice guard also caught here
normal repo, clean pass pass
normal repo, stale fail fail

🤖 Generated with Claude Code

…top it passing silently

Two defects, the second of my own making an hour ago.

## The drift check did not run on the PRs that change skills

`detect` skips every compile job for a PR touching nothing but `.claude/**`,
and the drift check rode the cargo `lint` job — so it did not run on exactly
those PRs. That was sound while every generator derived from code OUTSIDE
`.claude/`, because a code change always ran the full gate.

`gen_skill_inventory` broke it. It derives from SKILL.md descriptions, so a
one-line description edit makes the inventory tables in docs/agent-skills.md
and CLAUDE.md stale. Demonstrated: changing landing-page's first clause to
"the PROBE route group" leaves both tables stale, and a PR carrying only that
change reports three green checks, none of which looks at staleness. It merges
green and turns main red on the push-to-main run.

The `skills` job now runs `all` rather than `lint`. It still needs no
toolchain — verified by running the whole script in a bare ubuntu container
with no cargo, node, pnpm, docker, terraform or aws. The check stays in the
cargo job as well, because `skills` is not a required status check and so
cannot block a merge on its own; promoting it would make the pair redundant,
and both halves have now been observed failing.

The job is renamed to `agent skills (lint + drift)`, which is safe because it
is not among the eight required contexts.

## The drift check passed silently when git was unavailable

Introduced in #271. The per-file comparison skips anything it cannot read out
of HEAD (`git cat-file -e … || continue`), which is right for a newly added
file — but outside a git repository EVERY file is skipped, the stale list comes
back empty, and the check reports "generated references are current" and exits
0 having compared nothing.

That is the failure this repo keeps a rule about: success and never-ran are
indistinguishable from outside. Two guards now, mirroring `lint`'s zero-skills
exit and check-bff-authz.mjs's zero-routes exit — HEAD must resolve, and the
comparison must have examined at least one file. Verified: outside a repo the
check now exits 1 with a named reason.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
@athvin
athvin merged commit cce0ceb into main Oct 22, 2026
17 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