feat: wire altimate-core 0.5.1 equivalence dialect + decidable into dbt review
What does this PR do?
Wires altimate-core 0.5.1's net-new equivalence surface into the dbt PR review pipeline. 0.5.1 (#925) added an optional dialect parameter to checkEquivalence and a decidable flag on EquivalenceResult.
- Forward the
dialecthint to the engine in the native equivalence handler (native/altimate-core.ts) and thesql.diffhandler (native/sql/register.ts). The reviewer already resolves and threads a dialect end-to-end (orchestrate → runner → dispatcher), but commit89f77a75cahad to drop it at the boundary because 0.4.0 only accepted 3 params. Now it actually reachescore.checkEquivalence, so dialect-specific compiled warehouse SQL (e.g. Snowflakecol:field) parses instead of abstaining on a syntax error. - Honor the engine's authoritative
decidableflag in the review runner (review/runner.ts) —data.decidable !== false. Previously the runner guessed decidability viavalidation_errors. Strictly safer (only ever abstains more), backward-compatible when the field is absent (0.4.0 shape). - Declare
dialect?onSqlDiffParams.
Empty-string handling: ReviewConfig.dialect defaults to "", and the engine throws unknown dialect ''. The handlers use || undefined (not ??) so the default empty string coerces to "no hint" — caught by a regression test (fails on ??, passes on ||).
Type of change
- New feature / wiring (non-breaking)
Issue for this PR
Closes #926
How did you verify your code works?
- Real-engine native tests (
altimate-core-native.test.ts): dialect forwarding flips the parse outcome (Snowflakepayload:fsyntax-errors without the hint, parses with it),decidablesurfaced true/false, empty-string coercion does not throw,sql.diffthreads the dialect. - Full-pipeline E2E (
review-equivalence-e2e.test.ts): drives the completerunReview→ real engine path (no mocks) with a real dbt manifest — a non-equivalent rewrite is caught, an equivalent refactor stays silent (no false positive), identical SQL is skipped, a column-drop is decided non-equivalent, and the default empty-string dialect path still decides (regression guard). - Runner unit tests (
review-runner.test.ts): honorsdecidable=false,decidable=true, and absent (legacy). bun run typecheckclean; upstream marker check clean; full new-test suite 185 pass / 0 fail. Confirmed the 2 pre-existing failures invalidators/e2e-real-dbt-5.test.tsare environmental (spawn-dependent) and present on cleanmain.- Multi-model consensus review (Claude + Gemini + GLM-5): GLM-5 → READY TO MERGE; Gemini independently reproduced the empty-string dialect throw (now fixed + guarded).
Notes / follow-up
The pre-existing sibling handlers (columnLineage, formatSql, extractMetadata, compareQueries, importDdl, Schema.fromDdl) share the same empty-string-dialect fragility but are protected in production by run.ts resolving the dialect first. Kept out of scope here; tracked in #927.
Checklist
- My code follows the style guidelines of this project
- I have performed a self-review of my own code
- I have added tests that prove my fix/feature works
- New and existing unit tests pass locally
Summary by cubic
Wires altimate-core@0.5.1 into the dbt review pipeline by forwarding the new dialect hint to equivalence checks and honoring the engine’s decidable flag for safe abstentions. Closes Linear #926 and enables warehouse-specific SQL to parse (e.g., Snowflake) instead of abstaining.
-
New Features
- Forward
dialecttocheckEquivalenceinaltimate_core.equivalenceandsql.diff. - Honor
decidablein the runner (data.decidable !== false) to avoid unsafe guesses; remains backward compatible when absent. - Add
dialect?toSqlDiffParams.
- Forward
-
Bug Fixes
- Coerce empty-string dialect to no hint (
|| undefined) to avoid engine error onunknown dialect ''in equivalence andsql.diff.
- Coerce empty-string dialect to no hint (
Summary by CodeRabbit
Release Notes
-
New Features
- SQL dialect parameter now supported across equivalence checking, migration analysis, and formatting operations
- Equivalence engine now signals whether comparisons are definitive or undecidable
-
Tests
- Added test coverage for dialect parameter handling and edge cases
- Added end-to-end tests validating equivalence engine decidability behavior