feat(review): Implement lock-risk rule bodies and golden fixtures#125
Merged
feat(review): Implement lock-risk rule bodies and golden fixtures#125
Conversation
Wire the four lock-risk checks (add-index-on-large-table, add-fk-on-existing, alter-column-type, rewrite-table) on top of the dialect-gated dispatcher. Findings are caution-severity and emit dialect-tailored messages plus mitigation hints; new tables and same-migration FK targets are filtered out so the rules only fire on changes against pre-existing schema state.
Sort the rotated primary-key column list before joining so risk/rewrite-table emits the same message text regardless of column_diffs iteration order. Required for golden fixtures to remain stable across runs.
Cover positive and negative cases for the four lock-risk rules under postgres and mysql, plus REVIEW001 skip diagnostic fixtures for auto dialect and dialect mismatch.
Cover positive and negative cases for the four lock-risk rules: dialect gating (auto vs postgres vs mysql), new-table exemptions, nullability-only changes, and PK rotation column ordering.
Code Metrics Report
Details | | main (4bd67a8) | #125 (34665e1) | +/- |
|---------------------|----------------|----------------|-------|
+ | Coverage | 94.5% | 94.7% | +0.1% |
| Files | 81 | 81 | 0 |
| Lines | 37678 | 38181 | +503 |
+ | Covered | 35629 | 36177 | +548 |
- | Test Execution Time | 2m2s | 2m29s | +27s |Code coverage of files in pull request scope (90.7% → 94.3%)
Reported by octocov |
Schema reviewTip ✅ No risk findings — schema changes look safe to merge. |
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
risk/add-index-on-large-table,risk/add-fk-on-existing,risk/alter-column-type,risk/rewrite-table) under their declared dialect scopes.fixtures/review/lock-risk/) covering positive and negative cases per rule and dialect, plus REVIEW001 skip diagnostics for the auto-dialect and dialect-mismatch paths.risk/rewrite-tablePK rotation column ordering and add focused unit tests for the four rules.Changes
crates/relune-core/src/review/rules.rswith full implementations that emit caution-severity findings only onModifiedtable diffs (lock-risk applies to existing tables, not newly created ones).dialect_wordhelper so per-dialect message and mitigation text stays consistent.risk/rewrite-tableemits the same message text regardless ofcolumn_diffsiteration order, keeping golden fixtures deterministic.fixtures/review/lock-risk/covering positive cases under postgres and mysql, new-table negative cases, thealter-column-typenullability-only no-op, and REVIEW001 skip diagnostics forautodialect and a postgres-vs-risk/rewrite-tablemismatch.crates/relune-core/src/review/rules.rs::testsexercising dialect gating (auto vs postgres vs mysql), modified-vs-added table gating, thealter-column-typenullability-only suppression, and PK rotation column-ordering stability.