Skip to content

feat(review): Implement lock-risk rule bodies and golden fixtures#125

Merged
mhiro2 merged 4 commits intomainfrom
feat/review-lock-risk-rules
May 1, 2026
Merged

feat(review): Implement lock-risk rule bodies and golden fixtures#125
mhiro2 merged 4 commits intomainfrom
feat/review-lock-risk-rules

Conversation

@mhiro2
Copy link
Copy Markdown
Owner

@mhiro2 mhiro2 commented May 1, 2026

Summary

  • Implement the four lock-risk review rule bodies (risk/add-index-on-large-table, risk/add-fk-on-existing, risk/alter-column-type, risk/rewrite-table) under their declared dialect scopes.
  • Add 14 golden fixtures (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.
  • Stabilize risk/rewrite-table PK rotation column ordering and add focused unit tests for the four rules.

Changes

  • e5d4480 : feat(review): implement lock-risk rule bodies
    • Replace the four placeholder lock-risk dispatchers in crates/relune-core/src/review/rules.rs with full implementations that emit caution-severity findings only on Modified table diffs (lock-risk applies to existing tables, not newly created ones).
    • Add a dialect_word helper so per-dialect message and mitigation text stays consistent.
  • 37588d1 : fix(review): stabilize rewrite-table PK rotation column order
    • Sort the rotated primary-key column list before joining so risk/rewrite-table emits the same message text regardless of column_diffs iteration order, keeping golden fixtures deterministic.
  • 76fa4c5 : test(review): add golden fixtures for lock-risk rules
    • Add 14 fixtures under fixtures/review/lock-risk/ covering positive cases under postgres and mysql, new-table negative cases, the alter-column-type nullability-only no-op, and REVIEW001 skip diagnostics for auto dialect and a postgres-vs-risk/rewrite-table mismatch.
  • 369b25e : test(review): add unit tests for lock-risk rules
    • Add 10 unit tests in crates/relune-core/src/review/rules.rs::tests exercising dialect gating (auto vs postgres vs mysql), modified-vs-added table gating, the alter-column-type nullability-only suppression, and PK rotation column-ordering stability.

mhiro2 added 4 commits May 1, 2026 22:50
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.
@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 1, 2026

Code Metrics Report

main (4bd67a8) #125 (34665e1) +/-
Coverage 94.5% 94.7% +0.1%
Test Execution Time 2m2s 2m29s +27s
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%)

Files Coverage +/- Status
crates/relune-core/src/review.rs 94.5% +0.2% affected
crates/relune-core/src/review/rules.rs 94.2% +4.5% modified

Reported by octocov

@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 1, 2026

Schema review

Tip

✅ No risk findings — schema changes look safe to merge.

@mhiro2 mhiro2 self-assigned this May 1, 2026
@mhiro2 mhiro2 added the enhancement New feature or request label May 1, 2026
@mhiro2 mhiro2 merged commit f46b13d into main May 1, 2026
6 checks passed
@mhiro2 mhiro2 deleted the feat/review-lock-risk-rules branch May 1, 2026 21:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant