Skip to content

Commit 4bb92bf

Browse files
committed
fix(governance): scan a clean caller tree — don't scan the .standards-checkout tooling
Follow-up to #455/#464. The baseline gate checks out standards' scripts/ into `.standards-checkout/` (to get apply-baseline.sh), but that directory lives INSIDE the caller's working tree — so `hypatia-cli.sh scan .` scanned it too and reported standards' OWN files as the caller's findings. On neurophone#172 this surfaced 4 phantom findings from the tooling checkout: a banned-language `.ts` (critical) and three `shell_download` bootstrap.sh scripts (high), none of which are the caller's code. Every adopting repo would inherit these. Fix: copy apply-baseline.sh to $RUNNER_TEMP and `rm -rf .standards-checkout` BEFORE the scan, then run the filter from $RUNNER_TEMP. hypatia now only ever sees the caller's own tree; the tooling checkout can't pollute the finding set. Completes the estate-wide gate: with #455 (baseline consulted) + #464 (filter actually runs) + this (clean scan tree), validate-hypatia-baseline finally behaves as intended — suppress a repo's acknowledged baseline entries, fail on genuinely-new findings, and never conflate the tooling with the repo under audit. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0172RBMz3qYjb1ttzD2i7RNh
1 parent f81bb04 commit 4bb92bf

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

.github/workflows/governance-reusable.yml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,14 @@ jobs:
128128
BLOCKING_THRESHOLD: info
129129
run: |
130130
echo "Scanning repository: ${{ github.repository }} (checking baseline)"
131+
# Move the baseline filter OUT of the scanned tree, then delete the
132+
# standards checkout, so `hypatia scan .` only ever sees the CALLER's
133+
# own files. Without this, `.standards-checkout/` (the tooling we
134+
# checked out to get apply-baseline.sh) is itself scanned, and
135+
# standards' own files get reported as the caller's findings (a banned
136+
# `.ts`, `shell_download` bootstrap.sh scripts, etc.).
137+
cp .standards-checkout/scripts/apply-baseline.sh "$RUNNER_TEMP/apply-baseline.sh"
138+
rm -rf .standards-checkout
131139
# hypatia's `scan` exits non-zero whenever it finds anything — that is
132140
# by design, and under `bash -e` it would abort this step at this line,
133141
# before the baseline filter (the real gate) ever runs. Tolerate the
@@ -160,7 +168,7 @@ jobs:
160168
# suppresses only exact matches. Exits non-zero iff a kept finding is at
161169
# or above BLOCKING_THRESHOLD. (Validated against synthetic fixtures;
162170
# see the PR description.)
163-
bash .standards-checkout/scripts/apply-baseline.sh \
171+
bash "$RUNNER_TEMP/apply-baseline.sh" \
164172
hypatia-findings.json .hypatia-baseline.json blocking
165173
language-policy:
166174
name: Language / package anti-pattern policy

0 commit comments

Comments
 (0)