Skip to content

Commit 1175fd8

Browse files
committed
fix(ci): source-pin scanner cache in governance baseline job too
The `validate-hypatia-baseline` job carried the same keyless `hypatia-scanner-v2-${{ runner.os }}-build` cache + `if [ ! -d ]` / `if [ ! -x ]` guards as the standalone scan workflow, so baseline validation ran against whatever scanner was first cached — a stale ruleset that never picked up rule changes. Apply the same source-pinned key (resolve hypatia HEAD via git ls-remote, fold the SHA into the key) so the scanner rebuilds when hypatia main advances. Note: this makes the baseline job use the *current* scanner; it does not by itself resolve the separate pre-existing self-scan finding count on standards (tracked separately). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017wGTeLwiBGJ5rETC3QT4Pm
1 parent ba973c4 commit 1175fd8

1 file changed

Lines changed: 22 additions & 1 deletion

File tree

.github/workflows/governance-reusable.yml

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,14 +63,35 @@ jobs:
6363
elixir-version: '1.19.4'
6464
otp-version: '28.3'
6565

66+
- name: Resolve Hypatia HEAD commit
67+
id: hypatia-rev
68+
run: |
69+
# Pin the cache to the *current* Hypatia main tip. Resolved before the
70+
# cache step because cache restore happens before the clone, so the key
71+
# cannot hash a not-yet-cloned tree — it must hash the remote ref.
72+
sha=$(git ls-remote https://github.com/hyperpolymath/hypatia.git HEAD | cut -f1)
73+
if [ -z "$sha" ]; then
74+
echo "ERROR: could not resolve hypatia HEAD via git ls-remote" >&2
75+
exit 1
76+
fi
77+
echo "sha=$sha" >> "$GITHUB_OUTPUT"
78+
echo "Resolved hypatia HEAD: $sha"
79+
6680
- name: Cache Hex/Mix and Scanner Build
6781
uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
6882
with:
6983
path: |
7084
~/.mix
7185
~/.hex
7286
~/hypatia
73-
key: hypatia-scanner-v2-${{ runner.os }}-build
87+
# Source-pinned key: when Hypatia main advances, the SHA changes, the
88+
# cache misses, and the clone + escript build below re-run instead of
89+
# restoring a stale binary. The old keyless `...-build` key meant the
90+
# first scanner ever cached was reused forever, so baseline validation
91+
# ran against a stale ruleset. No restore-keys on purpose — a partial
92+
# restore would repopulate ~/hypatia and the guards below would skip
93+
# the rebuild, reintroducing the staleness.
94+
key: hypatia-scanner-v3-${{ runner.os }}-${{ steps.hypatia-rev.outputs.sha }}
7495

7596
- name: Clone Hypatia
7697
run: |

0 commit comments

Comments
 (0)