Skip to content

feat(review): Thread EffectiveDialect through run_rules and stub lock-risk checks#123

Merged
mhiro2 merged 2 commits intomainfrom
feat/review-run-rules-dialect
May 1, 2026
Merged

feat(review): Thread EffectiveDialect through run_rules and stub lock-risk checks#123
mhiro2 merged 2 commits intomainfrom
feat/review-run-rules-dialect

Conversation

@mhiro2
Copy link
Copy Markdown
Owner

@mhiro2 mhiro2 commented May 1, 2026

Summary

  • Extend run_rules to accept EffectiveDialect so dialect-scoped rules can gate themselves at evaluation time.
  • Plumb the dialect into RuleContext and add a rule_active helper that consults ReviewRuleId::dialect_scope() instead of raw selected.contains(...) checks.
  • Stub the four lock-risk rule check functions and wire them into the per-table / per-column / per-index / per-fk dispatch loops, leaving bodies empty for the upcoming detection work.

Changes

  • 19f244d : feat(review): thread EffectiveDialect through run_rules
    • Add a dialect: EffectiveDialect parameter to run_rules and propagate it into RuleContext so rule dispatch can honor the active SQL dialect.
    • Replace direct selected.contains(...) predicates with a new RuleContext::rule_active helper that defers to ReviewRuleId::dialect_scope() for dialect-scoped rules.
    • Update the relune-app review usecase callsite and the in-crate test helper to pass EffectiveDialect::Auto, drop the now-redundant dead_code allow on DialectScope, and scrub stale roadmap-task references from doc comments / tests / action/review.sh.
  • da56d8b : feat(review): wire stub check functions for lock-risk rules
    • Add empty-body stubs for check_add_index_on_large_table, check_add_fk_on_existing, check_alter_column_type_lock, and check_rewrite_table so the four lock-risk rule ids dispatch through run_rules ahead of their detection logic.
    • Invoke each stub from the appropriate dispatch site (table-level for rewrites, per-index/per-fk/per-column for the rest) gated by RuleContext::rule_active, keeping the call graph ready for the upcoming rule implementations.

@github-actions

This comment has been minimized.

@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 added 2 commits May 1, 2026 19:53
run_rules now takes an EffectiveDialect argument so the dispatcher can
gate per-rule evaluation against the dialect resolved by the caller.
RuleContext carries the dialect through the pass and exposes a new
rule_active(rule, selected) helper that combines the existing selected
set check with ReviewRuleId::dialect_scope; every existing dispatch
site now goes through it instead of reaching for selected.contains
directly. Phase 4 lock-risk rules with DialectScope::OneOf will plug
into the same helper, but for now Phase 1-3 rules keep their previous
behavior because they all carry DialectScope::Any.

The relune-app review use case hard-codes EffectiveDialect::Auto for
this commit; Phase 4 task 3 introduces ReviewRequest.dialect and swaps
the hard-coded value for request.dialect.into(). The dead_code allows
on DialectScope and dialect_scope come off now that they have a real
caller.
Add empty stub bodies for the four Phase 4 lock-risk rule checks
(check_add_index_on_large_table, check_add_fk_on_existing,
check_alter_column_type_lock, check_rewrite_table) and dispatch them
from run_rules through the existing context.rule_active gate. The
stubs return zero findings, so behavior is unchanged for every dialect
and every rule selection; the value of this commit is locking down the
function signatures, parameter shapes, and dispatch sites that Phase 4
task 4 will fill in. AlterColumnType deliberately runs alongside
check_type_narrow on the same ColumnDiff::Modified because the two
rules cover lock and data-correctness angles independently, and
check_rewrite_table dispatches once per modified table since its
trigger conditions are table-level.

The missing_const_for_fn allow on each stub and too_many_lines on
run_rules are local; they come off naturally when task 4 lands the
finding-construction logic.
@mhiro2 mhiro2 force-pushed the feat/review-run-rules-dialect branch from 2d724d6 to da56d8b Compare May 1, 2026 10:55
@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 1, 2026

Code Metrics Report

main (3a88bcf) #123 (7675645) +/-
Coverage 94.6% 94.5% -0.2%
Test Execution Time 1m49s 1m25s -24s
Details
  |                     | main (3a88bcf) | #123 (7675645) |  +/-  |
  |---------------------|----------------|----------------|-------|
- | Coverage            |          94.6% |          94.5% | -0.2% |
  |   Files             |             81 |             81 |     0 |
  |   Lines             |          37420 |          37510 |   +90 |
+ |   Covered           |          35431 |          35464 |   +33 |
+ | Test Execution Time |          1m49s |          1m25s |  -24s |

Code coverage of files in pull request scope (93.1% → 91.0%)

Files Coverage +/- Status
crates/relune-app/src/usecases/review.rs 93.8% +0.0% modified
crates/relune-core/src/review.rs 93.6% 0.0% modified
crates/relune-core/src/review/rules.rs 89.6% -3.2% modified

Reported by octocov

@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 9e06a63 into main May 1, 2026
6 checks passed
@mhiro2 mhiro2 deleted the feat/review-run-rules-dialect branch May 1, 2026 12:45
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