Repository navigation
CI: fail on drift between generated SQL and its fragments - #72
Merged
Merged
Conversation
The workflow ran `make` before `sudo make install`, and `make` regenerates sql/pg_git--0.4.0.sql in place. A hand edit to the generated file, or a fragment change committed without regenerating, was therefore repaired by the build itself and never reported. Add `make check-generated` and run it as the first step of test-core, before anything else invokes make. The target uses `make -B` rather than relying on the normal timestamp rule. In a fresh clone git writes every file at about the same moment, so make cannot reliably tell a stale artifact from a current one; forcing the rebuild makes the comparison against real output rather than against a guess. Verified both failure modes fail the check: a committed hand edit to sql/pg_git--0.4.0.sql, and a fragment edited without regenerating. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017nq3xZcPqSTKtskyP2DzkK
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 free
to 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.
The problem
The workflow ran
makebeforesudo make install, andmakeregeneratessql/pg_git--0.4.0.sqlin place. So a hand edit to the generated file, or a fragment change committed without regenerating, was repaired by the build itself and never reported.The fix
Add
make check-generatedand run it as the first step oftest-core, before anything else invokes make.The target uses
make -Brather than relying on the normal timestamp rule. In a fresh clone git writes every file at about the same moment, so make cannot reliably tell a stale artifact from a current one; forcing the rebuild makes the comparison against real output rather than against a guess.Also documents the generated-file rule in
CONTRIBUTING.md.Verification
Both failure modes now fail the check:
sql/pg_git--0.4.0.sql→is out of sync with the fragments it is generated fromAnd a clean tree passes:
sql/pg_git--0.4.0.sql matches its fragments.🤖 Generated with Claude Code
https://claude.ai/code/session_017nq3xZcPqSTKtskyP2DzkK
Generated by Claude Code