chore: drift-check generated artifacts in CI#83
Conversation
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
📝 WalkthroughWalkthroughA new step is added to the existing CI ChangesCI Artifact Drift Check
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~2 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In @.github/workflows/ci.yml:
- Around line 32-33: The git diff command used in the drift gate check ignores
untracked files, allowing new generated artifacts to bypass the validation.
Enhance the check by adding a test for untracked files in the monitored
directories (registry.json, public/r, tokens/design-tokens.json,
skill/democrito) using a command like git ls-files --others --exclude-standard
to detect any new files that haven't been committed, and fail the check if
untracked files are found alongside the existing git diff check.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
| git diff --exit-code -- registry.json "public/r" tokens/design-tokens.json skill/democrito \ | ||
| || (echo "::error::Generated artifacts are stale — run 'npm run build' and commit the result." && exit 1) |
There was a problem hiding this comment.
Untracked generated files can bypass this drift gate.
Line 32 uses git diff --exit-code, which ignores untracked files. If the build creates a new artifact (for example, a new file under public/r/) and it isn’t committed, this check can still pass.
Suggested hardening
- name: Check generated artifacts are committed (no drift)
run: |
- git diff --exit-code -- registry.json "public/r" tokens/design-tokens.json skill/democrito \
+ git diff --exit-code -- registry.json "public/r" tokens/design-tokens.json skill/democrito && \
+ test -z "$(git ls-files --others --exclude-standard -- public/r skill/democrito)" \
|| (echo "::error::Generated artifacts are stale — run 'npm run build' and commit the result." && exit 1)📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| git diff --exit-code -- registry.json "public/r" tokens/design-tokens.json skill/democrito \ | |
| || (echo "::error::Generated artifacts are stale — run 'npm run build' and commit the result." && exit 1) | |
| git diff --exit-code -- registry.json "public/r" tokens/design-tokens.json skill/democrito && \ | |
| test -z "$(git ls-files --others --exclude-standard -- public/r skill/democrito)" \ | |
| || (echo "::error::Generated artifacts are stale — run 'npm run build' and commit the result." && exit 1) |
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In @.github/workflows/ci.yml around lines 32 - 33, The git diff command used in
the drift gate check ignores untracked files, allowing new generated artifacts
to bypass the validation. Enhance the check by adding a test for untracked files
in the monitored directories (registry.json, public/r,
tokens/design-tokens.json, skill/democrito) using a command like git ls-files
--others --exclude-standard to detect any new files that haven't been committed,
and fail the check if untracked files are found alongside the existing git diff
check.
…or determinism Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Summary
git diff --exit-codegate immediately after so a forgotten rebuild can't ship a staleregistry.json,public/r/,tokens/design-tokens.json, orskill/democrito/to the published registry.DESIGN.mdis excluded —stamp-design-date.mjsrewrites its date on every build, so diffing it would permanently fail CI after the commit day.::error::annotation in the PR UI with a clear remediation message.Test plan
registry.jsonlocally without rebuilding, push a commit — the drift-check step should fail with::error::Generated artifacts are stale🤖 Generated with Claude Code
Summary by CodeRabbit