Skip to content

Commit 5ceec11

Browse files
committed
refactor(driver-sql): move the filter compiler's leaf predicate emitters out of sql-driver.ts into sql-driver-predicate-emitters.ts (#25521 cut 16)
applyNormalizedComparison, applyNullSafeNegative, applyEmptyOperator, applyJsonMembership, applyLike and applyLikePattern, with the module-level dialect constructs only they read, move unedited into a new seam module reached through PredicateEmitterHost. The class keeps every method as a stub. The compile-refusal seam test reads the new module. The four staying links to unresolvableColumnNameOf resolve again through a type-only import. Claude-Session: https://claude.ai/code/session_01FEkQ5ncyQ2HYfpr45hwrPU Co-authored-by: Claude <noreply@anthropic.com>
1 parent f986702 commit 5ceec11

3 files changed

Lines changed: 898 additions & 747 deletions

File tree

‎packages/drivers/driver-sql/src/sql-driver-compile-refusal-seam.test.ts‎

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,9 @@
2929
*
3030
* 1. **The enumeration** reads `sql-driver.ts` and its cross-field seam module
3131
* `sql-driver-cross-field-comparison.ts` (#25521 cut 13), plus the read-exit
32-
* fault module `sql-driver-read-exit-fault.ts` (#25521 cut 15), and lists every
33-
* function that builds an `INVALID_FILTER` error. Only three may call
32+
* fault module `sql-driver-read-exit-fault.ts` (#25521 cut 15) and the
33+
* predicate-emitter module `sql-driver-predicate-emitters.ts` (#25521 cut 16),
34+
* and lists every function that builds an `INVALID_FILTER` error. Only three may call
3435
* `unsupportedFilterError` directly (the seam itself, the `'author'`
3536
* re-issue, and the column refusal raised from a dialect error AFTER the
3637
* statement ran), and every caller of `withheldFilterError` must have a row
@@ -66,7 +67,7 @@ const SECRET_NUM = 7770123;
6667
const UNDECLARED_KEY = '$psecret_combinator';
6768

6869
type Door = {
69-
/** The builder in `sql-driver.ts` or its cross-field seam module this row drives — asserted by the error's stack. */
70+
/** The builder in `sql-driver.ts` or one of its seam modules this row drives — asserted by the error's stack. */
7071
readonly builder: string;
7172
readonly where: () => Record<string, unknown> | unknown[];
7273
readonly secrets: readonly string[];
@@ -273,8 +274,8 @@ const DOORS: readonly Door[] = [
273274
// ── Half 1: the enumeration ───────────────────────────────────────────────────
274275

275276
/**
276-
* Every function in `sql-driver.ts`, `sql-driver-cross-field-comparison.ts` and
277-
* `sql-driver-read-exit-fault.ts` that builds an `INVALID_FILTER` error, by the route it takes. Read with the TypeScript parser, not a regex, so a call
277+
* Every function in `sql-driver.ts`, `sql-driver-cross-field-comparison.ts`,
278+
* `sql-driver-read-exit-fault.ts` and `sql-driver-predicate-emitters.ts` that builds an `INVALID_FILTER` error, by the route it takes. Read with the TypeScript parser, not a regex, so a call
278279
* split across lines, an inline `throw`, or a builder written as a method or an
279280
* arrow cannot slip past the count.
280281
*/
@@ -287,10 +288,13 @@ function enumerateRefusalBuilders(): {
287288
// its own seam module with two of the builders below; the scan reads both.
288289
// [#25521 cut 15] The read exits' fault terminals moved to a third, with
289290
// `unresolvableFilterColumnError`; the scan reads it too.
291+
// [#25521 cut 16] The leaf predicate emitters moved to a fourth, with the two
292+
// `$empty` refusals; the scan reads it too.
290293
const sources = [
291294
['sql-driver.ts', readFileSync(new URL('./sql-driver.ts', import.meta.url), 'utf8')],
292295
['sql-driver-cross-field-comparison.ts', readFileSync(new URL('./sql-driver-cross-field-comparison.ts', import.meta.url), 'utf8')],
293296
['sql-driver-read-exit-fault.ts', readFileSync(new URL('./sql-driver-read-exit-fault.ts', import.meta.url), 'utf8')],
297+
['sql-driver-predicate-emitters.ts', readFileSync(new URL('./sql-driver-predicate-emitters.ts', import.meta.url), 'utf8')],
294298
] as const;
295299
const directCallers = new Set<string>();
296300
const seamCallers = new Set<string>();

0 commit comments

Comments
 (0)