Commit e15bf7e
`compileScopedFilterToSql` compiled a comparand-position `undefined` into legal
SQL with `undefined` in the bind list. The driver renders that as NULL, every
comparison against NULL is UNKNOWN, and the read scope matched ZERO rows with no
log line — indistinguishable from a scope that worked. Re-measured on d8e8d9c
with the refusal disabled, alias `t`:
{ d: undefined } -> "t"."d" = ? [undefined]
{ d: { $gt: undefined } } -> "t"."d" > ? [undefined]
{ d: { $in: [undefined] } } -> "t"."d" IN (?) [undefined]
{ $not: { d: undefined } } -> NOT (("t"."d" IS NOT NULL AND "t"."d" = ?)) [undefined]
One gate at the top of `compileField` — after `quoteIdent`, before any `bind()`
— refuses all four positions with ONE wording that varies only by path (#5240).
The envelope is this module's existing `READ_SCOPE_COMPILE_FAILED` / 500, not
#6050's `INVALID_FILTER` / 400: a read scope is compiled by the platform from
CEL and stored metadata, so a 400 would bill the caller for something they
neither wrote nor can change.
`null` is untouched — SQL and binds byte for byte, pinned as its own control
group, because refusing it alongside `undefined` is the way this change could
do harm.
Per the #6125 ruling, `@objectstack/formula` (a third semantics, #5299),
`driver-memory` / `driver-mongodb` (#5499 freeze) and `driver-sql` /
`driver-turso` (#6050, already landed) are deliberately not touched.
Fixes #6125
Claude-Session: https://claude.ai/code/session_01WyvqvKMG6asi9aXjKE6xtx
Co-authored-by: Claude <noreply@anthropic.com>
1 parent cb3b6cd commit e15bf7e
5 files changed
Lines changed: 527 additions & 11 deletions
File tree
- .changeset
- packages/services/service-analytics/src
- __tests__
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
Lines changed: 32 additions & 11 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
41 | 41 | | |
42 | 42 | | |
43 | 43 | | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
44 | 56 | | |
45 | 57 | | |
46 | 58 | | |
| |||
69 | 81 | | |
70 | 82 | | |
71 | 83 | | |
72 | | - | |
| 84 | + | |
73 | 85 | | |
74 | 86 | | |
75 | 87 | | |
| |||
129 | 141 | | |
130 | 142 | | |
131 | 143 | | |
132 | | - | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
133 | 152 | | |
134 | 153 | | |
135 | 154 | | |
136 | 155 | | |
137 | 156 | | |
138 | 157 | | |
139 | | - | |
| 158 | + | |
140 | 159 | | |
141 | 160 | | |
142 | 161 | | |
143 | 162 | | |
144 | 163 | | |
145 | 164 | | |
146 | | - | |
| 165 | + | |
147 | 166 | | |
148 | 167 | | |
149 | 168 | | |
150 | 169 | | |
151 | 170 | | |
152 | 171 | | |
153 | | - | |
| 172 | + | |
154 | 173 | | |
155 | 174 | | |
156 | 175 | | |
157 | 176 | | |
158 | 177 | | |
159 | 178 | | |
160 | | - | |
| 179 | + | |
161 | 180 | | |
162 | 181 | | |
163 | 182 | | |
164 | 183 | | |
165 | 184 | | |
166 | 185 | | |
167 | | - | |
| 186 | + | |
168 | 187 | | |
169 | 188 | | |
170 | 189 | | |
| |||
255 | 274 | | |
256 | 275 | | |
257 | 276 | | |
258 | | - | |
259 | | - | |
260 | | - | |
261 | | - | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
262 | 283 | | |
263 | 284 | | |
264 | 285 | | |
| |||
0 commit comments