Skip to content

ci: verify compiled rules version - #913

Merged
nc9 merged 3 commits into
squirrelscan:mainfrom
WilliamK112:codex/compiled-rules-hash-542
Oct 17, 2026
Merged

nc9 merged 3 commits into
squirrelscan:mainfrom
WilliamK112:codex/compiled-rules-hash-542

Conversation

@WilliamK112

Copy link
Copy Markdown
Contributor

Summary

  • compute the expected rules fingerprint from the checked-out source tree after the CLI build
  • assert that the compiled squirrelscan binary contains that exact fingerprint
  • fail the Compile CLI job with the expected value when macro inlining regresses

The existing rules-fingerprint.test.ts coverage already proves that changing a rule source file changes the computed fingerprint.

Testing

  • bun run build
  • local compiled-binary fingerprint check (embedded 16d38a47aca127415e841b17cd9318c1a214aa48b557ef050bffcf82659c5c25)
  • bun test apps/cli/tests/audit/rules-fingerprint.test.ts (7 passed)

Closes #542

@WilliamK112
WilliamK112 requested a review from nc9 as a code owner October 17, 2026 05:25
@nc9

nc9 commented Oct 17, 2026

Copy link
Copy Markdown
Contributor

Thanks. I checked the Compile CLI run on this PR: the new step printed the embedded fingerprint and passed. The root also matches what the macro uses (apps/cli/src/audit/rules-fingerprint.ts resolves the repo root, and the step runs from it).

One small robustness fix: if expected ever comes out empty, grep -aFq "" matches any file. The check would then pass without proving anything. Please assert the shape before the grep:

if ! [[ "$expected" =~ ^[0-9a-f]{64}$ ]]; then
  echo "Could not compute the rules fingerprint for this checkout: '$expected'" >&2
  exit 1
fi

WilliamK112 and others added 2 commits October 17, 2026 22:34
An empty value would make grep -F match any file, so the check would pass
without proving anything.

Signed-off-by: Nik Cubrilovic <[email protected]>
@nc9
nc9 force-pushed the codex/compiled-rules-hash-542 branch from aa9e7a9 to 2aaa3f3 Compare October 17, 2026 11:35
@nc9
nc9 merged commit 5a06359 into squirrelscan:main Oct 17, 2026
15 checks passed
@nc9

nc9 commented Oct 17, 2026

Copy link
Copy Markdown
Contributor

Merged, thanks @WilliamK112! CI now proves the compiled CLI carries the rules version for the exact source it was built from, so a macro inlining regression fails the build instead of shipping. I added one small guard on top (an empty fingerprint now fails the step rather than matching anything).

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.

ci: smoke-test that the compiled CLI embeds the rules-version hash

2 participants