Uh oh!
There was an error while loading. Please reload this page.
ci: run .claude/hooks/*.selftest.sh on every PR touching the hooks - #6022
Merged
Conversation
Adds .github/workflows/hook-selftests.yml, a required check that runs the guard-main-checkout-bash and guard-shared-stash self-test matrices whenever .claude/hooks/** changes, and fails the build the moment either goes red. Neither self-test's own instruction to "run after touching the hook" had a gate behind it before this. Paired writes (PR #5984 shape): content/docs/guide/ci-cd-pipeline.md gets the workflow's inventory row + section, and scripts/dependabot-merge-gate.mjs classifies the new "Hook Self-Tests" check as OPTIONAL_CONTEXTS (path-filtered, same as Changeset Bump Policy). Does not modify the hooks or their self-tests — .claude/** stays untouched. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019b5UBNMtTzKbVtZZGvFuxe
yinlianghui-tw
marked this pull request as ready for review
August 24, 2026 14:13
Uh oh!
There was an error while loading. Please reload this page.
This was referenced Aug 24, 2026
Merged
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 freeto 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.
Fixes#5754
What
Adds
.github/workflows/hook-selftests.yml: a required check that runs.claude/hooks/guard-main-checkout-bash.selftest.shand.claude/hooks/guard-shared-stash.selftest.shon every PR (and push tomain)that touches
.claude/hooks/**or the workflow file itself, and fails thebuild the moment either self-test matrix reports a failing case. This is a
runner only —
.claude/**(the hooks and their self-tests) is untouched, perthis card's ruling.
Measured before wiring anything (Zone 2)
On
origin/main@53dc89db8, both self-tests were already green:Both need only
jqandgit(both preinstalled onubuntu-latest) — noinstall, no build. Runtime cost of the new job is therefore ~4s of self-test
execution plus a checkout.
Paired writes (PR #5984 shape)
content/docs/guide/ci-cd-pipeline.md— workflow-inventory table row +a new
### Hook Self-Tests (hook-selftests.yml)section, plus theOPTIONAL_CONTEXTSenumeration in the Dependabot Auto-Merge prose.scripts/dependabot-merge-gate.mjs— classifies the new HookSelf-Tests check as
OPTIONAL_CONTEXTS(path-filtered likeChangeset Bump Policy/Bundle Analysis: present → must besuccess; absent → aDependabot bump never touches
.claude/hooks/**, so it is never waitedfor).
scripts/__tests__/ci-cd-pipeline-doc.test.tsandscripts/__tests__/dependabot-merge-gate.test.tswent red before these twowrites (undocumented workflow / unclassified produced check) and pass now —
that is them working correctly.
Why path-filtered, unlike
control-bytes.ymlcontrol-bytes.ymlcarries nopathsfilter because a raw control byte canland in a markdown-only PR as easily as a TypeScript one. That does not
transfer here: both self-tests assert the current hook script's behaviour
against a fixture they build themselves — nothing about a docs-only PR can
move the result. So this workflow mirrors
changeset-guard.yml'spath-filtered shape instead (see the workflow's own header for the full
reasoning and cost note).
Tests
pnpm exec vitest run scripts/__tests__/ci-cd-pipeline-doc.test.ts scripts/__tests__/dependabot-merge-gate.test.ts— 2 files, 67 tests, allpassed.
pnpm exec vitest run scripts/__tests__/(full suite) — 64 files, 1703tests, all passed.
pnpm lint— see report comment for the verdict captured at head SHA.node scripts/check-changeset-presence.mjs— no changeset owed (CI-onlychange, no released package's
src/changed); an empty-frontmatterchangeset was added anyway, matching this repo's convention (no
skip-changesetlabel exists here — objectui#4912 /.github/WORKFLOWS.mddocuments 5 workflows that do not exist and omits 9 that do — including a changeset gate and askip-changesetlabel neither of which is real #3724).Generated by Claude Code