Repository navigation
Commit f522e95
`AnalyticsServicePlugin`'s `executeRawSql` auto-bridge received the object name
and dropped it: `engine.execute(knexSql, { args: params })`. `ObjectQL.execute()`
selects its driver in the order `options.object` -> `getDriver(object)`, then
`options.datasource`, then the default driver, so rule 1 could never fire and
every dataset raw-SQL read landed on the DEFAULT datasource. Any object routed
elsewhere (ADR-0057 3.6 telemetry split, an explicit `object.datasource`, a
`datasourceMapping` rule) raised `no such table`, which the widget-level
graceful degradation turned into a confident `0` over live rows. Measured on the
showcase: `sys_audit_log` returned 49 records object-routed and `{"rows":[]}`
through the dataset raw-SQL path, on one running kernel.
The bridge now passes `{ args: params, object: objectName }`, matching the
`executeAggregate` bridge beside it, so both dataset execution paths give one
answer to "which datasource is this object in". `DataEngineLike.execute`'s
options bag is spelled out instead of `Record<string, unknown>` so the
load-bearing key is visible at the call site.
Accepted behaviour change: a dataset whose SQL joins across datasources now runs
on the base object's own datasource and fails there rather than silently reading
the wrong database. It must fail as ITSELF -- reporting it as "backing object is
unavailable" would keep the confident `0` alive under a new cause -- so the
missing-source triage now asks WHICH relation the driver named:
- the dataset's own object -> degrade to an empty result + WARN (unchanged)
- a joined table whose object -> degrade (genuine absence, unchanged shape)
is not registered here
- a joined table whose object -> throw, naming table X, the datasource its
IS registered base object lives on, where X actually is,
and the remedy
`AnalyticsServiceConfig` gains one optional diagnostics-only hook,
`getObjectDatasource(objectName)`, wired in `plugin.ts` from the engine's schema
registry. It never selects a driver.
Tests: `src/__tests__/raw-sql-object-routing.test.ts` drives the real plugin
wiring against an engine double that resolves its driver the way `execute()`
documents -- the defect was invisible to every test that stubbed `executeRawSql`
directly. Covers the issue's exact shape (raw SQL == object-routed rows, no
degradation WARN), default-datasource objects unchanged, the cross-datasource
loud failure and its wording, and both surviving degradation paths.
Compile-time rejection of cross-datasource dataset joins is deliberately not in
this PR; filed as #5115.
Fixes #5033
Claude-Session: https://claude.ai/code/session_01NrmBxj8rK2uGCnh9aipjwX
Co-authored-by: Claude <noreply@anthropic.com>
1 parent 78adc2e commit f522e95
4 files changed
Lines changed: 528 additions & 4 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 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
0 commit comments