altimate-code icon indicating copy to clipboard operation
altimate-code copied to clipboard

fix: coerce empty-string dialect to no-hint across native handlers (unknown dialect '' throw)

Open anandgupta42 opened this issue 5 months ago • 2 comments

Description

Pre-existing latent bug surfaced while wiring core 0.5.1 (#925 follow-up). altimate-core throws unknown dialect '' on an empty-string dialect. Several native handlers forward params.dialect ?? undefined, so a literal "" is passed through (empty string is not nullish) and the engine throws:

  • packages/opencode/src/altimate/native/altimate-core.ts: Schema.fromDdl (migration), columnLineage, formatSql, extractMetadata, compareQueries, importDdl
  • packages/opencode/src/altimate/native/sql/register.ts: columnLineage

In the dbt review pipeline these are protected today because review/run.ts resolves config.dialect (auto-detect → fallback "snowflake") before runReview. But any direct caller using the documented default (ReviewConfig.dialect = "") would hit the throw → caught → silent degradation (e.g., column-breakage/PII-via-lineage lanes return empty).

Fix

Normalize these sites to params.dialect || undefined (coerce ""/null/undefined → undefined), matching the convention already used in sql/register.ts:433-434 and the checkEquivalence sites hardened in the parent PR. No valid dialect is falsy, so the change is behavior-neutral except for eliminating the "" throw.

Context

Independently flagged by a consensus code-review model (Gemini) during the parent PR. Kept out of the parent PR for scope discipline (those sites are not 0.5.1 functionality).

anandgupta42 avatar Jun 10 '26 18:06 anandgupta42

This looks fixed on main by #1090 (da952c1544). It added EngineCoerce.dialectHint() (dialect || undefined) in packages/opencode/src/altimate/native/engine-coerce.ts and routes every handler listed here through it:

  • native/altimate-core.ts: Schema.fromDdl (migration), columnLineage, formatSql, extractMetadata, compareQueries, importDdl (plus checkEquivalence)
  • native/sql/register.ts: columnLineage and formatSql

The remaining sql/register.ts equivalence and schema-diff calls already use params.dialect || undefined. An empty-string dialect now means auto-detect instead of throwing.

Suggest closing.

Written by Devin

Closing as fixed on main: #1090 added EngineCoerce.dialectHint, which maps an empty dialect to no hint across the native handlers. Please reopen if you still see this on v0.12.9 or later.

anandgupta42 avatar Nov 05 '26 21:11 anandgupta42