Commit adabaa8
engine.aggregate() has no join — it never expands a lookup and the SQL
driver's aggregate emits no JOIN. A dotted dimension/measure like
account.region reaching ObjectQLStrategy (the fallback NativeSQL declines
on: date-granularity bucketing, in-memory driver, federated objects)
failed SILENTLY: the in-memory path bucketed every row under one (null)
group and summed the whole table into it — a plausible number that is
actually a mislabelled full-table total; the native path errored on the
unresolved column.
ObjectQLStrategy now rejects any cross-object reference outright, with a
clear message, before the query reaches the engine. This generalizes the
#3597 guard (assertJoinedScopesEnforceable), which only rejected when the
joined object carried a read scope AND early-returned when no read-scope
provider was configured — so the silent (null) bucket still shipped on
unsecured / in-memory setups. The new guard is unconditional and subsumes
#3597: a rejected query never loads the joined object, so nothing is left
unscoped.
Cross-object datasets are unaffected on NativeSQLStrategy, which
hand-compiles the LEFT JOINs (and scopes each). This only changes the
fallback path — a silent wrong answer becomes a loud, actionable error.
Full lookup-traversal in the aggregate path is left as follow-up (#3654).
Tests: three cross-object cases (joined-object scope / base-only scope /
NO provider — the #3654 silent-(null) case) now reject; reverting the
guard turns all three red. The engine-level in-memory repro is in #3654.
Co-authored-by: Jack Zhuang <277994282+os-zhuang@users.noreply.github.com>
Co-authored-by: Claude <noreply@anthropic.com>
1 parent 1659072 commit adabaa8
3 files changed
Lines changed: 101 additions & 49 deletions
File tree
- .changeset
- packages/services/service-analytics/src
- __tests__
- strategies
| 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 | + | |
Lines changed: 27 additions & 17 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
218 | 218 | | |
219 | 219 | | |
220 | 220 | | |
221 | | - | |
| 221 | + | |
222 | 222 | | |
223 | 223 | | |
224 | 224 | | |
| |||
228 | 228 | | |
229 | 229 | | |
230 | 230 | | |
231 | | - | |
| 231 | + | |
232 | 232 | | |
233 | | - | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
234 | 237 | | |
235 | 238 | | |
236 | | - | |
237 | | - | |
| 239 | + | |
| 240 | + | |
238 | 241 | | |
239 | 242 | | |
| 243 | + | |
240 | 244 | | |
241 | 245 | | |
242 | | - | |
243 | | - | |
| 246 | + | |
244 | 247 | | |
245 | | - | |
246 | | - | |
247 | | - | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
248 | 254 | | |
249 | 255 | | |
250 | | - | |
251 | | - | |
252 | | - | |
253 | | - | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
254 | 260 | | |
255 | | - | |
256 | | - | |
257 | | - | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
258 | 268 | | |
259 | 269 | | |
Lines changed: 48 additions & 32 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
79 | 79 | | |
80 | 80 | | |
81 | 81 | | |
82 | | - | |
83 | | - | |
84 | | - | |
85 | | - | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
86 | 93 | | |
87 | 94 | | |
88 | 95 | | |
| |||
270 | 277 | | |
271 | 278 | | |
272 | 279 | | |
273 | | - | |
| 280 | + | |
| 281 | + | |
274 | 282 | | |
275 | | - | |
276 | | - | |
277 | | - | |
278 | | - | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
279 | 292 | | |
280 | | - | |
281 | | - | |
282 | | - | |
283 | | - | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
284 | 300 | | |
285 | | - | |
286 | | - | |
287 | | - | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
288 | 304 | | |
289 | | - | |
| 305 | + | |
290 | 306 | | |
291 | 307 | | |
292 | 308 | | |
293 | 309 | | |
294 | | - | |
295 | 310 | | |
296 | | - | |
297 | | - | |
298 | | - | |
299 | | - | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
300 | 314 | | |
301 | 315 | | |
302 | 316 | | |
303 | 317 | | |
304 | 318 | | |
305 | 319 | | |
| 320 | + | |
306 | 321 | | |
307 | 322 | | |
308 | 323 | | |
309 | 324 | | |
310 | 325 | | |
311 | | - | |
312 | | - | |
313 | | - | |
| 326 | + | |
| 327 | + | |
314 | 328 | | |
315 | 329 | | |
316 | 330 | | |
317 | 331 | | |
318 | | - | |
319 | | - | |
320 | | - | |
321 | | - | |
322 | | - | |
323 | | - | |
324 | | - | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
325 | 341 | | |
326 | 342 | | |
327 | 343 | | |
| |||
0 commit comments