Migrate warehouse queries to effect-orm - #1258
Conversation
Imports move from @maple-dev/effect-clickhouse to @maple-dev/effect-orm (/clickhouse replaces the root and /types entries). Warehouse tables are external `CH.table` definitions, since their DDL stays in datasources.ts. OrgId columns are branded, so every tenant filter compares against the shared `orgIdParam` and warehouse query signatures take `OrgId`. Queries whose variant is chosen at runtime compile per branch, so each pairs with the params it actually needs. The dependency is a local `link:` until effect-orm is published.
|
Important Review skippedToo many files! This PR contains 154 files, which is 4 over the limit of 150. To get a review, reduce the PR to 150 files or fewer by splitting it into smaller PRs or changing its base branch. Upgrade to a paid plan to raise the limit. This review couldn't start because sufficient usage credits or metered capacity aren't available. Add credits or update usage-based reviews in the billing tab, then retry. ⚙️ Run configuration
⛔ Files ignored due to path filters (1)
📒 Files selected for processing (154)
You can disable this status message by setting the
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
…khouse-migration-16dcd5 # Conflicts: # apps/api/src/routes/queries.ts # apps/clickhouse-builder-docs/package.json # apps/clickhouse-builder-docs/scripts/sync-content.ts # bun.lock # packages/query-engine/src/ch/queries/infra.ts # packages/query-engine/src/registry/queries.ts
Maple review🟡 Confidence 3/5 · needs attention Warning This review ended early; what follows is what it established. Mechanical migration of the ClickHouse query layer to
What was checked
Files not reviewed (78)The review ended before it read these diffs, so nothing above vouches for them.
|
There was a problem hiding this comment.
🔍 Devin Review: 2 flags
Not posted on this PR by your GitHub settings — view them in Devin Review. (Configure)
Moves Maple's ClickHouse query layer from
@maple-dev/effect-clickhouseto@maple-dev/effect-orm0.2.0.What changed
/typesimports are now@maple-dev/effect-orm/clickhouse./expr,/sqland/benchmarkkeep their subpaths.CH.table(name, { external: true, columns, tenantColumn: "OrgId" }). The DDL still lives indatasources.ts, so effect-orm's migrations don't manage them.OrgIdcolumn is branded, and effect-orm compares branded columns strictly.orgIdParamfrom@maple/query-engine/ch/tables.orgId: OrgId.LOCAL_ORG_IDfrom@maple/query-engine/local.compilenow checks params against the query's type. Queries whose variant is chosen at runtime compile per branch, so each pairs with its own params:traceTimeProbeQuery/recentTraceTimeProbeQuerycond ? $.X.eq(param…) : undefinednow useCH.whenTrue, so the builder knows the param is conditional.The emitted SQL is unchanged: the SQL catalog baseline test passes.
Verification
bun typecheck: 49/49 tasks plustsconfig.alchemy.json.bun testcli server: 19 pass.bun run ch:testpasses (424 catalog queries execute and decode, plus 88 service tests). All 9 backend*.clickhouse.e2efiles pass (182 tests).maple startfrom this branch, fed by theexamples/effect-todoservices. All 20 CLI query commands work. local-ui loads every page with data and no console errors: traces, trace and span detail, logs, metrics, services, service map, errors.🤖 Generated with Claude Code