diff --git a/apps/api/src/services/warehouse/sql-catalog.clickhouse.e2e.test.ts b/apps/api/src/services/warehouse/sql-catalog.clickhouse.e2e.test.ts index d0121e7ec..ef4c11a2f 100644 --- a/apps/api/src/services/warehouse/sql-catalog.clickhouse.e2e.test.ts +++ b/apps/api/src/services/warehouse/sql-catalog.clickhouse.e2e.test.ts @@ -9,11 +9,18 @@ // `DESCRIBE (SELECT …)` type-checks without reading a row, so this is cheap: // ~80 unique shapes, a few seconds on top of a job that already boots the // server and replays the migrations. +// +// Covers both catalogs: `@maple/query-engine`'s own (pipes, query specs, core +// builders) and `@maple/query-engine-integrations`' (Cloudflare, PlanetScale, +// AI builders), which lives with those builders because the core package must +// not depend on the integrations package. import { afterAll, assert, beforeAll, describe, it } from "@effect/vitest" import { Effect } from "effect" +import type { CompiledQuery } from "@maple/query-engine/ch" import { collectSqlCatalog, dedupeByFingerprint } from "@maple/query-engine/sql-catalog" import { normalizeSqlForClickHouseClient } from "@maple/query-engine/execution" +import { collectIntegrationCatalog } from "@maple/query-engine-integrations/catalog" import { applyRealMigrations, clickhouseE2eEnabled, @@ -35,8 +42,23 @@ const IDENTITY_COLUMN_ALLOWLIST: ReadonlySet = new Set([]) const database = uniqueDatabase("maple_sql_catalog_e2e") -/** Deduped so N fixtures over one shape cost one analyzer round trip. */ -const catalog = dedupeByFingerprint(collectSqlCatalog()) +/** The subset of a catalog entry the sweep reads — the core and integration + * catalogs are separate types (`@maple/query-engine` must not import the + * integrations package), but both satisfy this shape. */ +interface SweepEntry { + readonly id: string + readonly sql: string + readonly compiled?: CompiledQuery + readonly sampleValues?: Readonly> +} + +/** Core catalog deduped so N fixtures over one shape cost one analyzer round + * trip; the integration catalog has no fingerprints and every fixture is a + * distinct shape, so it is appended as-is. */ +const catalog: ReadonlyArray = [ + ...dedupeByFingerprint(collectSqlCatalog()), + ...collectIntegrationCatalog(), +] describe.skipIf(!clickhouseE2eEnabled)("SQL catalog analyzer sweep", () => { beforeAll(async () => { diff --git a/packages/query-engine-integrations/src/catalog.ts b/packages/query-engine-integrations/src/catalog.ts index 1f6483313..069fea60a 100644 --- a/packages/query-engine-integrations/src/catalog.ts +++ b/packages/query-engine-integrations/src/catalog.ts @@ -4,7 +4,9 @@ // import this package (the dependency runs one way), so the fixtures live with // the builders instead. Same contract as the core catalog — compile the REAL // exported builder with production-shaped params, so every SQL shape the -// product can emit is enumerated and snapshotted. +// product can emit is enumerated and snapshotted. The ClickHouse e2e sweep in +// apps/api (`sql-catalog.clickhouse.e2e.test.ts`) analyzes these fixtures +// against the real migrations alongside the core catalog. import { compile, compileUnion, type CompiledQuery } from "@maple/query-engine/ch" import * as CH from "./index"