Repository navigation
Closed
Labels
domain:serverDomain lane — seat card indexed by label:pm:seatpriority:p1High: required for production / M2
Description
director#1 · hotlong · session_f4c42f815d5e47b39de5e9fb0d6d7864
① Reproduced defect. reach: hosted staging environment os-2ph4c1.objectos.app, 2026-11-15, admin session, X-OS-Debug-Timing: json.
Reader: domain:server lane, one PR in packages/drivers/driver-turso.
What happens
On a hosted environment, every answer reports zero database work, even when the request plainly reads the database:
| request | status | db member |
handler |
|---|---|---|---|
GET /api/v1/data/sys_user?top=1 |
200 | db;dur=0;desc="0 queries" |
367 ms |
GET /api/v1/data/sys_user?top=5 |
200 | db;dur=0;desc="0 queries" |
503 ms |
GET /api/v1/meta/object/sys_user |
200 | db;dur=0;desc="0 queries" |
201 ms |
The admin-only X-OS-Debug-Timing-Detail header is absent on all three, because there are no db detail samples to report.
Why
- The
dbmember and its detail are fed bySqlDriver.installQueryTiming()(packages/drivers/driver-sql/src/sql-driver-class-head.ts:500), which listens on knexquery/query-responseevents. - In remote mode,
TursoDriversends its statements throughRemoteTransport(packages/drivers/driver-turso/src/remote-transport.ts), which calls@libsql/clientdirectly:this.client.execute(…)(about 25 sites) andthis.client.batch(…)(lines 1348, 2193, 2245, 2272, 2723). Knex never sees these statements, so nothing is counted. - Every hosted environment runs on the remote transport, so the hosted plane has no per-request database timing at all.
Why it matters
- cloud#4369, reading 1 (in-container round trip to Turso, owed to the transactions topic [专题] 事务:远程 libSQL(Turso)上的真事务,让元数据提交在托管环境也不会半落地(暂停,libSQL 路线) #32500) cannot be read today without a one-off probe in the container. With this fixed, an admin request with
X-OS-Debug-Timing: jsongives per-statement durations measured inside the container, which is exactly that reading. - Hosted performance work (cloud#2914, cloud#3103) has had to infer database time from
handlertotals.
Expected
- Each
executeand eachbatchround trip inRemoteTransportis counted into the ambient collector:countServerTiming('db', dur, 'queries'), the same markdriver-sqlproduces. - When detail capture is on, it records the parametrized SQL shape (for a batch, one sample per round trip, labelled e.g.
batch(<n>): <first statement shape>). Bindings are never recorded. - Simplest seam: one private helper wrapping
client.execute/client.batch, used at every call site, or a wrapper installed whereensureConnected()creates the client.
Acceptance
- A unit test in
driver-tursowith a stubbed client and an activePerfTiming: oneexecuteand onebatchgivedbcount 2, and detail samples carry SQL shapes without bindings. - After the pin reaches staging: the three requests above report a non-zero
dbcount, andX-OS-Debug-Timing: jsonfrom an admin returnsX-OS-Debug-Timing-Detail.
Not in scope
- No change to the disclosure gate (admin-only per request, global mode via
OS_SERVER_TIMING). - No change to transactions ([专题] 事务:远程 libSQL(Turso)上的真事务,让元数据提交在托管环境也不会半落地(暂停,libSQL 路线) #32500 stays on hold).
Dedupe:
repo:objectstack-ai/objectstack "Server-Timing" turso→ 14 hits;repo:objectstack-ai/objectstack RemoteTransport timing→ 11 hits;repo:objectstack-ai/objectstack Server-Timing db remote→ 14 hits (open and closed).
The closest is #32500 (the transactions topic, which needs the reading, not this fix). #24523 (closed) is about an extra authz read, not the timing seam. None covers the remote transport missing from db timing.
Related: cloud#4369, #32500.
Metadata
Metadata
Assignees
Labels
domain:serverDomain lane — seat card indexed by label:pm:seatpriority:p1High: required for production / M2
Activity
objectstack-fleet commentedon Nov 15, 2026
triage#1 · hotlong · session_01Q4EjjMnyLqJdzuktEmRPXH
Path: none
Triage: first touch →
domain:server·lease:A3· p2 · 2026-11-15T13:47Z⛔ Not a claim.
On a hosted (Turso remote) environment, Server-Timing always reports
db;dur=0;desc="0 queries", because the remote transport bypasses the knex query events thatinstallQueryTiming()listens on. Hosted SQL performance cannot be measured, which blocks epic #33631's measurements, so p2. One PR in driver-turso; A3 (drivers).objectstack-fleet commentedon Nov 15, 2026
triage#1 · hotlong · session_01Q4EjjMnyLqJdzuktEmRPXH
Path: none
Triage: raised → p1 · 2026-11-15T14:15Z
⛔ Not a claim.
The maintainer raised this to p1 on the triage thread (「33892 性能相关 p1」), for the same reason as epic #33631 (SQL performance, p1). A hosted environment reports
0 queriesin Server-Timingdb, so no SQL performance work can be measured where the customers run. The card is linked under epic #33631 as its hosted-measurement prerequisite. Lane and lease are unchanged: server · A3, one PR inpackages/drivers/driver-turso.objectstack-fleet commentedon Nov 15, 2026
domain:server#5 · zhuangjianguo · session_01QsR2jUg7BKfRBcTPyMxbLh
Claim: PM loop round 2 (area S2, #33751 §2; p1 takes the slot freed by #33745's build)
Session:
session_01QsR2jUg7BKfRBcTPyMxbLhAccount:
zhuangjianguoBranch:
claude/area-A3-33892Worktree:
/home/claude/wt/area-A3-33892Domain:
domain:serverSeat:
domain:server#5File surface:
packages/drivers/driver-turso/src/remote-transport.ts (one private helper wrapping client.execute / client.batch, used at every call site) · driver-turso package.json (an @objectstack/observability workspace dependency, if needed) · a new test file in driver-turso named by the card · .changeset/**(stop on breach; explain in the report)Container & model:
S,mode:subagent,model: TIER_DEFAULT(dispatch-gates --tier: no path-derived mandate),effort: mediumClause-②: no
Metadata-protocol: none
Responsibility: objectstack (
packages/drivers/driver-turso/src/remote-transport.ts, this repo) sends statements through @libsql/client directly, so knex's query events that feed Server-Timingdbnever fire · no platform path counts them today · every hosted environment (remote transport) and epic #33631's hosted measurementsThread-read: 6895837072
Premise: holds (reproduced on hosted staging by the reporter; the dev pins it red-first with a stubbed client)
Serial constraints cleared: #33695 (S2) also edits remote-transport.ts (buildDeclaredIndexDDL, the implicit index set); different sites, so per the 14:45Z rule the dev runs git merge-tree against #33695's branch and origin/main before push and queues only on a real textual overlap
Pre-claim lane: domain:server A3/A4 because the fix is packages/drivers/driver-turso/src/remote-transport.ts; no spec bit, no docs/adr/** or skills/, no cloud code (the staging re-check after release is the reporter's)
Pre-claim deps: none (no Blocked-by; #32500 transactions stays on hold and is out of scope)
Prior rulings read: docs/adr/ grep for Server-Timing: only ADR-0104 (acceptance wiring note) and ADR-0076 mention it, neither on driver timing; the disclosure gate (admin-only, OS_SERVER_TIMING) is unchanged by the card's own Not-in-scope; no test pins remote statements as uncounted
objectstack-fleet commentedon Nov 15, 2026
domain:server#5 · zhuangjianguo · session_01QsR2jUg7BKfRBcTPyMxbLh
os-dev-report
{ "issue": 33892, "status": "done", "branch": "claude/area-A3-33892", "pr": "https://github.com/objectstack-ai/objectstack/pull/34056", "head_sha": "8e32852283c4b3814b42780dabead6d22a0eaf7b", "session": "session_01QsR2jUg7BKfRBcTPyMxbLh", "premise_still_valid": true, "summary": "RemoteTransport now sends every statement through two private helpers, sendStatement and sendBatch, the only places it calls client.execute / client.batch. All 29 call sites (24 execute, 5 batch, census on origin/main b8ac0e24) are converted. Each round trip is folded into the ambient collector as count('db', dur, 'queries'), on success and on failure, so hosted environments no longer answer '0 queries'. With detail on, the samples carry the parametrized SQL (a batch is labelled 'batch(N): FIRST_SQL') and never the args. @objectstack/observability is now a direct dependency, and nothing new is exported.", "hypotheses": { "H1": "held, in part: driver-sql's installQueryTiming uses currentPerfTiming + perfNow + timing.count + timing.recordDetail from @objectstack/observability. The helpers call the same API the same way. There is no shape normaliser to reuse: knex's q.sql is already parametrized, and libSQL's InStatement.sql is the same thing (values travel in args).", "H2": "false as stated: the call sites read this.client, which setClient() sets as well as ensureConnected(). So a wrapper only in ensureConnected misses the supplied-client path, and a Proxy would change getClient() identity. I chose the card's other seam, one helper pair used at every site, held by a source-census test (ablation: one raw site makes it red, naming the line). Census before: 24 execute + 5 batch raw. After: 0 outside the helpers, 4 inside. Transactions: none on the remote face (refused).", "H3": "held: with no collector, each helper is one currentPerfTiming() lookup, then a direct return of client.execute / client.batch, with no closure and no allocation.", "H4": "held: a RemoteTransport exists only when mode === 'remote'. The remote face's knex is built without a connection (toKnexConfig, #20054 note) and runs nothing, and knex emits 'query' only after it acquires a connection. Local and replica modes have no transport. The end-to-end test confirms that the db count equals the client's received round trips." }, "tests": "Readings at f332481fd3, outside the verify lock at --maxWorkers=1 (the lock timed out 3 times, exit 99; holders were the issue-33791/33699/33695 bundles). (1) pnpm --filter @objectstack/driver-turso exec vitest run --maxWorkers=1: exit 0, Test Files 98 passed (98), Tests 2547 passed | 34 skipped (2581). (2) New file remote-transport-server-timing-33892.test.ts: exit 0, 6/6. (3) Ablations, committed first, through scripts/ablation-replace.mjs, each restored to the HEAD blob db5f5189 with git diff HEAD empty: removing timing.count (anchor 2 to 0) gives 4/6 red; recording the bindings (statementShape returns JSON.stringify) gives 3/6 red with the binding visible in the samples; routing dropTable back to the raw client gives 1/6 red (census, line 2291). No build or dist step was needed: the subject is imported by relative path. (4) typecheck: exit 0, and tsc --listFiles includes the new test. (5) eslint --no-inline-config on the 2 touched .ts files: exit 0. The repo-wide pnpm lint is left to CI.", "gates": "dispatch-gates --commands at 4083e80926 (main merged): 83 families. 79 exit 0. check:test-source-alias exit 1, a real red (an unaliased @objectstack/observability import from the new dependency), fixed with the gate's prescribed anchored alias in driver-turso/vitest.config.ts. 14 vitest-config and dist-reading families rerun at f332481fd3 after that commit, all exit 0. NOT MEASURED: check:lean-entry-closure (exit 3, objectql dist absent; an objectql build outside the lock failed on a missing metadata dist), check:type-check-debt (needs the lock), check:dual-build-cjs-loads (CI). --ran reconciliation: 83 derived, 80 run, 1 NOT-MEASURED, 2 UNRUN. PR-body gates on the final body: check-changeset-no-major 0, check-closing-keyword-parity 0, check-adr-0087-registration 0, check-empty-changeset 0, check-partof-closing-keyword 0. CI check-runs: in_progress at report time, not awaited. Hot file: git merge-tree --write-tree --name-only of this branch against origin/main and against origin/claude/area-A4-33695 is clean in both cases (exit 0). That branch adds no raw client call. Of 62 open PRs, none touches remote-transport.ts. Before pr_create, origin/main was merged again (29 commits, none on the diff's files, observability or the lockfile), and no parallel fix was found.", "dogfood_battery": "n/a — no ! in the PR title and no (narrowing) arm", "mcp_calls": "0", "api_writes": "2 — fleet-write relay pr_create (objectstack-ai/objectstack#34056) and post-stamped issue comment on #33892 (this report); plus git push (not REST)", "line_budget": "328 insertions / 31 deletions across 6 files, under the 3000 human-merge threshold; no skills/** touched", "files_changed": [ "packages/drivers/driver-turso/src/remote-transport.ts", "packages/drivers/driver-turso/src/remote-transport-server-timing-33892.test.ts", "packages/drivers/driver-turso/package.json", "packages/drivers/driver-turso/vitest.config.ts", "pnpm-lock.yaml", ".changeset/33892-remote-transport-server-timing-db.md" ], "deviations": [ "Two files outside the claim's surface, both mechanical consequences of the sanctioned observability dependency, and declared rather than stopped on: pnpm-lock.yaml (+3 importer lines, which frozen-lockfile CI needs) and driver-turso/vitest.config.ts (+1 anchored source alias, which check:test-source-alias demands for a new test-reachable workspace import; the registry is unchanged).", "The suites ran outside the verify lock at --maxWorkers=1, as the dispatch allows after a lock timeout. spec dist was built at b8ac0e24; the merges brought spec src changes in contracts/kernel files that driver-turso does not read, and spec was not rebuilt.", "Dependents' suites (runtime, service-datasource, cli, dogfood) were not run locally. This follows os-dev.md (public surface byte-unchanged: only the package's own tests are owed) over the dispatch line asking for them. A git grep census found no dependent test combining Turso with Server-Timing.", "The PR body opens with the dispatch-supplied attribution comment line (the HTML comment), kept as the harness-attribution exception." ], "open_questions": [], "security_findings": "none", "out_of_scope_findings": [ "carrier: none · noted, not filed: TursoDriver.reclaimSpace (executeMultiple) and the two remote backfills (via RemoteTransport.getClient()) send statements outside the transport and stay uncounted. They are maintenance paths in turso-driver.ts, outside the file surface, and are listed in the PR's Acceptance notes." ] }objectstack-fleet commentedon Nov 15, 2026
domain:server#5 · zhuangjianguo · session_01QsR2jUg7BKfRBcTPyMxbLh
Landed: PR #34056 merged;
Fixesclosed this card.8e328522· PASS 6898812985 · ACCEPT 6898853113374bad32232b4090643748b8e8d35dd6e340a04aat 2026-11-15T20:59Z; card closed (completed) by itState change:
pm:dispatchedandlease:A3removed, assignee cleared.fix(driver-turso): count remote-transport statements into Server-Timi…