Repository navigation
test(driver-sql): sql-driver-connect-bound runs under the 10 s budget (#23182 row 6) - #23812
Merged
objectstack-fleet[bot] merged 2 commits intoOct 16, 2026
Merged
Conversation
…clock over its real socket The one slow test in sql-driver-connect-bound.test.ts waited out the driver's real 10s pg connectionTimeoutMillis against a loopback listener that accepts and never answers (10.01s of the file's 10.15s of test time, 3 runs alone). The listener stays real; only setTimeout/clearTimeout are faked, and the clock is moved in 500ms steps until the query settles, so the pg 10s bound, the tarn 15s backstop and an unbounded connect each still show in how far the clock had to move. Same message and elapsed-band assertions as before. Claude-Session: https://claude.ai/code/session_01ADzJtzYTLUfgrRZHxkagkX Co-authored-by: Claude <noreply@anthropic.com>
…so a resolved query is not read as pending The stepping loop stopped on a captured rejection only, so a query that RESOLVED (the "should have failed" case) would have been misreported as "still pending after 20s". Settlement is now one of two named outcomes, and each has its own assertion message. Claude-Session: https://claude.ai/code/session_01ADzJtzYTLUfgrRZHxkagkX Co-authored-by: Claude <noreply@anthropic.com>
Contributor
📓 Docs Drift CheckNothing in this diff resolved to a documentable surface (no symbol, route or SDK anchor derived from 0 changed package(s)), so this run has no opinion about the docs. What this run could not see
Coarse fallback — 0 page(s) merely mention a changed package (the pre-#9192 predicate, kept for the deliberately-wide backstop): |
objectstack-fleet
Bot
deleted the
claude/issue-23182-connect-bound-budget
branch
October 16, 2026 05:25
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Part of #23182 (row 6)
Row 6 of the test-budget card:
packages/drivers/driver-sql/src/sql-driver-connect-bound.test.ts, read at 10.5 s in the hourly full battery (run 38228297391). Test-only change, one file. The seat closes the card; this PR does not.Where the time went
One test of sixteen:
actually bounds a query against a black-holing endpointwaited out the driver's real 10 s pgconnectionTimeoutMillisagainst a loopback listener that accepts the socket and never answers. That is 10,014-10,015 ms of the file's 10.14-10.20 s of test time (3 runs, alone). The other fifteen tests total about 0.2 s.The 10 s is the production default (
DEFAULT_CONNECT_TIMEOUT_MS, a private static with no seam), and the card's limits forbid shortening the bound the test pins. PR #23730 (the sqlite connect fail-fast) changed only the sqlite connect path insql-driver.ts, not the pg bound this test waits on: re-measured on current main, the wait is unchanged. So the fix is the test's clock, not production.What changed
acceptedpromise settles when the server holds the first socket.setTimeoutandclearTimeoutare faked for the test body only (vi.useFakeTimerswith an explicittoFake;netI/O, microtasks andDatestay real). pg armsconnectionTimeoutMillisand tarn armscreateTimeoutMillison the fakedsetTimeout.finally, beforeafterEachdisconnects the driver.Every pinned behaviour stays pinned
Same assertions on the black-hole test: message contains
timeout expired, message does not containpool is probably full, elapsed greater than 8,000 and less than 20,000. Elapsed is now the fake clock's advance, which is exact: it read 10,000 in 3 probe runs against the unmodified driver (a scratch copy printing it, deleted after). Two assertions are added: one that the query settled within 20 s of fake time (what an unbounded connect fails), one that it did not resolve. The other fifteen tests are byte-identical. Tests 16 to 16;expect(calls 26 to 28. No test deleted, no.skip/.todo, no project change.Before and after
Method: the file alone,
pnpm exec vitest run --maxWorkers=2 --reporter=verbose, throughscripts/pm/os-verify-lock.sh, 3 runs each, dependency closure built first. A shared box, so read the ratios.testsfigure)Duration9d4fb3c306470d1ad3a1The remaining
Durationis vitest's cold module-graph load, not test time:import8.8-9.0 s andtransform7.2-7.4 s on this box (not attributed further here). It cannot be what the card's 10.5 s reading counts (that reading is the 10.01 s black-hole test plus about 0.5 s), so it is outside this row.Ablation
Mutations land on
sql-driver.tsthroughscripts/ablation-replace.mjs(WRAP mode; each leg proved on disk: anchor 1 to 0, blob changed, then restored with blob equal to HEAD andgit diff HEADempty). The subject is imported as./sql-driver.js, which resolves to source, so there is nodist/leg. Each ablation was run against the base test (a scratch copy, deleted after) and this branch's test in one run; failures below are the black-hole test's.DEFAULT_CONNECT_TIMEOUT_MS10_000 to 5_000expected 5007 to be greater than 8000(5.0 s)expected 5000 to be greater than 8000(32 ms)dialectforced undefined)expected 'Knex: Timeout acquiring a connection.…' to contain 'timeout expired'(15.0 s)withConnectBoundbypassed (no bound at all)still pending after 20s of fake time — the connect is unbounded(46 ms)Whole-file counts under each: A 5 failed of 16, B 5 of 16, C 8 of 16 on this branch (the extra failures are the config-shape pins in the same file, identical on base). Control, unmutated: 32 of 32 across both files. Not ablated: the
resolved but should have failedguard (no cheap production mutation makes a connect to a silent socket succeed).Verification (head
470d1ad3a1)pnpm --filter @objectstack/driver-sql typecheck: exit 0;tsc --noEmit --listFileslists the test file once (the package has no test-typecheck ledger).--no-inline-config, on the changed file: 1 file, 0 errors, 0 warnings.node scripts/pm/dispatch-gates.mjs --commands(51) plus every artifact-roster family (53) plus every declared wide-population family (11): 114 unique commands, run at this head, recorded with exit codes. 108 exit 0. Two exited 3 on a missingdist/(check:dual-build-cjs-loads,check:lean-entry-closure); afterturbo run build(75 tasks, 74 cached) both re-ran exit 0. Four roster gates need pull-request context and answered NOT MEASURED locally:check-closing-target-claim.mjs(exit 2),pm/check-governed-queue-guard.mjs(exit 1, no event payload),check-partof-closing-keyword.mjs(exit 2; re-run below with this body),check-single-claim-paths.mjs(exit 2). Their workflows run on the PR.dispatch-gates.mjs --ranover the coded record: 51 derived families accounted for, 51 run, 0 NOT-MEASURED (a derived zero: all 51 recorded an exit code, none is 3).files[]isdist,README.md,CHANGELOG.md, and the builtdist/index.jsanddist/index.mjscarry none of the test's identifiers.skip-changesetis applied throughscripts/pm/label-write.mjsafter opening.Acceptance notes
importshare of about 9 s per driver-sql test file locally. Carrier: none.Generated by Claude Code