Dashboardopencode-loretracedDatabase query seam

tracedDatabase query seam

Category: gotcha
Confidence: 1.00
ID: 01a0a6e1-92f6-7e31-9713-948c416cbdf6
Project ID: 6f4be9ff-ed84-4cca-a9e7-732a0b0b8677
Cross-project: No
Recalled in other projects: 0
Source session: 0jqfAyzTbQiUgim4O
Created: 2026-08-21 08:11:20
Updated: 2026-09-15 21:03:16

Content

Trap: monkeypatching db().query or tracing prepare() appears to observe all SQL, but Lore’s tracedDatabase() Proxy hides query replacement and traces only .query() statement operations (get, run, and all); raw prepare, exec, migrations, and transaction control intentionally bypass tracing. Fix: SQL-count tests must use log.registerSink({ withDbSpan }), count spans at the actual tracing boundary, and execute through .query(). The wrapper must invoke each operation exactly once without changing arguments or return values, and core must remain free of Sentry dependencies.

Move to: