linter: scope cross-migration SET NOT NULL suppression#1033
Open
reteps wants to merge 4 commits intosbdchd:masterfrom
Open
linter: scope cross-migration SET NOT NULL suppression#1033reteps wants to merge 4 commits intosbdchd:masterfrom
reteps wants to merge 4 commits intosbdchd:masterfrom
Conversation
…op pairs Previously, an external VALIDATE CONSTRAINT (without a matching ADD CONSTRAINT in the same file) blanket-marked the entire table as safe, suppressing SET NOT NULL warnings for all columns. This caused false negatives when the validated constraint was unrelated to the column being tightened. Now, only constraints that are both validated AND dropped in the same file are treated as NOT NULL helpers. Each validate+drop pair can suppress one SET NOT NULL violation on that table. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
👷 Deploy request for squawkhq pending review.Visit the deploys page to approve it
|
sbdchd
reviewed
Apr 2, 2026
Bundle the related hash sets/maps used for cross-migration NOT NULL suppression behind a NotNullValidation struct with named methods (record_validate, is_column_validated, has_external_validate_for, etc.) so callers don't have to know about the internal representation. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
reteps
commented
May 1, 2026
|
|
||
| ### cross-migration suppression and constraint naming | ||
|
|
||
| When the `ADD CONSTRAINT ... NOT VALID` lives in an earlier migration file, the rule looks for a `VALIDATE CONSTRAINT` paired with a `DROP CONSTRAINT` of the same name in the migration that runs `SET NOT NULL` to recognize the safe pattern. |
Contributor
Author
There was a problem hiding this comment.
I had to explain an edge case here: We can't associate the constraint with a column easily, so we tell the user to use a conventional format for the constraint.
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.
Summary
VALIDATE CONSTRAINT(without a matchingADD CONSTRAINTin the same file) blanket-marked the entire table as safe, suppressingSET NOT NULLwarnings for all columns — even unrelated onesSET NOT NULLviolationTest plan
cargo test --package squawk-linter -- adding_not_null_field— all 16 tests pass./s/lintpasses./s/testpasses🤖 Generated with Claude Code