Skip to content

feat: every builder that emits SQL can be compiled - #193

Merged
productdevbook merged 1 commit into
mainfrom
feat/compile-every-builder
Aug 21, 2026
Merged

productdevbook merged 1 commit into
mainfrom
feat/compile-every-builder

Conversation

@productdevbook

Copy link
Copy Markdown
Owner

Follow-on to #192, closing the last of the gaps between the two phases.

Six builders could produce SQL and not a compiled query, so their callers were left on the path that runs the whole pipeline per request:

TypedInsertReturningBuilder
TypedUpdateReturningBuilder
TypedDeleteReturningBuilder
TypedMergeBuilder
TypedMergeReturningBuilder
ExplainBuilder

insertInto(...).returning(...) is the one that matters most — write a row, get its id back is what a request does, and it was the shape with no way to prepare.

The RETURNING forms carry their row type through and run themselves, the same as SELECT. MERGE and EXPLAIN have no executor behind them, so their compiled queries hold the SQL and fill parameters but say so if asked to run.

The check that keeps it closed

test/builder/every-builder-compiles.test.ts reads src/builder and fails on any exported class with a toSQL and no toCompiled. The hole appears when somebody adds a builder, not when they add a test, so the check reads the source rather than a list someone has to remember to update.

pnpm test green: 3311 tests, lint clean, types clean, build clean.

Six could produce SQL and not a compiled query, so their callers were left
on the path that runs the whole pipeline per request — including
`insertInto(...).returning(...)`, which is the shape a request uses most:
write a row, get its id back.

    TypedInsertReturningBuilder
    TypedUpdateReturningBuilder
    TypedDeleteReturningBuilder
    TypedMergeBuilder
    TypedMergeReturningBuilder
    ExplainBuilder

The RETURNING forms carry their row type through and run themselves, like
SELECT. MERGE and EXPLAIN have no executor behind them, so their compiled
queries hold the SQL and fill parameters but say so if asked to run.

`test/builder/every-builder-compiles.test.ts` reads `src/builder` and fails
on any class with a `toSQL` and no `toCompiled`. The hole appears when
somebody adds a builder, not when they add a test, so the check has to come
from the source rather than from a list someone remembers to update.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HAwiBVhLmNhWjC9Ro6UMpb
@productdevbook
productdevbook merged commit f9ccb40 into main Aug 21, 2026
1 check passed
@productdevbook
productdevbook deleted the feat/compile-every-builder branch August 21, 2026 13:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant