Repository navigation
fix(service-datasource): Test connection answers ok:false when the driver's health check answers false (#30407) - #30566
Conversation
…swer The probe awaited the handle's ping (the driver's checkHealth()) and dropped its boolean, so a connect that resolved and then reported itself unhealthy answered Test connection ok: true. A literal false now answers ok: false with a refusal sentence; the thrown-error path is unchanged. Claude-Session: https://claude.ai/code/session_01Utp6CXKK9SECcrtZHzxjTK Co-authored-by: Claude <noreply@anthropic.com>
|
domain:server#3 · os-bill · session_01Utp6CbPxYq1wQmUNWvMZkC Contract reviewServed-tier: ① Derived judgments
② Semver level
③ Boundary flagsNone. Implemented-by: VERDICT: PASS |
📓 Docs Drift Check1 anchor(s) derived from 1 changed package(s); no hand-written page names any of them, so this run has nothing to list — not a clean bill of health. This check sees only pages that NAME a derived anchor: one that documents this change in prose, or enumerates it in an authoring dialect, names none and stays invisible to it on every run. What this run could not see
Coarse fallback — 3 page(s) merely mention a changed package (the pre-#9192 predicate, kept for the deliberately-wide backstop): Which tree this was computed onThis run read A worktree cut from an older # while this PR is open — GitHub drops the merge commit once it closes
git fetch origin 6a3729bbd497c2ac78924d783d70c745c626ccd0 && git checkout 6a3729bbd497c2ac78924d783d70c745c626ccd0
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin a4c3e738b5b18d265f89a84a2dc003cedc31ed1b 2808696072495b9eaf6309bdfc592fefdeee31c6 && git checkout -B drift-repro a4c3e738b5b18d265f89a84a2dc003cedc31ed1b && git merge --no-ff 2808696072495b9eaf6309bdfc592fefdeee31c6
node scripts/docs-audit/affected-docs.mjs --json a4c3e738b5b18d265f89a84a2dc003cedc31ed1b |
|
domain:server#3 · os-bill · session_01Utp6CbPxYq1wQmUNWvMZkC 维护者速读(席位终稿)
席位意见:同意落地。只在驱动明说不健康时改答,范围窄,有对照组守住。 席位核对ACCEPT · head
|
domain:server#3 · os-bill · session_01Utp6CXKK9SECcrtZHzxjTK
Requested by Bill · project thread
Fixes #30407
Clause-②: no — a served answer comes to match the driver's own health answer; no accept set changes.
Metadata-protocol: none
维护者速读
ok: false并给出一句说明,不再答成功。ping(即驱动的checkHealth())却丢掉了它的布尔值,一个只告警不抛错、随后自报不健康的连接会被报成「连接成功」。datasource-admin-plugin.ts的 probe 一处判断;只有字面量false才拒,抛错路径与 ping 无返回值的句柄行为不变;回滚即 revert 本 PR。packages/services/service-datasource/src/datasource-admin-plugin.ts的 probe(health === false那一行);其测试文件末尾新增的 describe。pnpm --filter @objectstack/service-datasource exec vitest run src/__tests__/datasource-admin-plugin.test.ts -t "probe reads the health answer",预期 4 条全绿。What changes
DatasourceAdminServicePlugin.probeawaited the handle'sping(or thecheckHealthfallback) and dropped the answer. Both the shared factory'stoHandleandcreatePrebuiltDriverFactorymappingto the driver's owncheckHealth(), which reports an unhealthy connection by answeringfalserather than throwing, so a connect that resolved and then reported itself unhealthy answered Test connectionok: true.The probe now keeps that answer and, when it is a literal
false, returnsok: falsewith the sentence "The driver connected, but its health check reported the database as unhealthy, so this connection is not usable. Check that the database exists and accepts these settings, then test again." The teardown infinallystill runs. Onlyfalserefuses:pingis typed as a promise ofunknownon the handle contract, and a host-built handle whose ping answers nothing keeps answeringok: true(the existingfakeFactoryprobe test pins that). The thrown-error path is unchanged.Other callers of the handle's
ping: none.git grepoverpackages/**andui/**(non-test) finds the probe as the only reader of aDatasourceDriverHandle.ping. The neighbours read the boolean already:ExternalDatasourceService.testConnection(saved-datasource Test) checksawait driver.checkHealth()and answersok: falseonfalse;engine-lifecycle-health.tsmapsfalsetohealthy: false.packages/runtime/src/turso-driver-factory.tsandprebuilt-driver-factory.tsare producers ofping, not readers.Serial hold: the card was serial after PR #30395 (same package). Seat 3 lifted the hold at 15:00Z because this diff shares no file with #30395; #30395 then merged (22f0d65) and
origin/mainis merged into this branch before opening, so the PR is measured against a tree that already contains it.Tests
New top-level
describe('DatasourceAdminServicePlugin: probe reads the health answer')in the existing harnesssrc/__tests__/datasource-admin-plugin.test.ts:checkHealth()answersfalse) wrapped throughcreatePrebuiltDriverFactory, the producer that mirrorstoHandle:ok: false, the error names the health check, nolatencyMs, and connect / checkHealth / disconnect each ran once;checkHealth(noping) answeringfalse:ok: false;checkHealth()answeringtrue:ok: truewith a latency;{ ok: false, error: THROWN_MESSAGE }), health never asked, teardown still ran.Measured first, on
fa9c0aa2before any source edit: the twofalsepins red (expected true to be false), both controls green.Ablation (one, on the committed fix
2cc82972):scripts/ablation-replace.mjs --deleteon theif (health === false) return …line, anchor x1 → x0, blob 9c49cde4 → ae6fa722; the file run went2 failed | 33 passed (35)(exactly the twofalsepins), then restored to blob == HEAD withgit diff HEADempty. The suite imports the plugin by relativesrcpath, so nodistleg applies.Acceptance notes
resolveSqliteDriverhanding back a native driver whoseconnect()swallows a code-less error) is latent after PR fix(service-datasource)!: Test connection and Save refuse a SQLite filename that is neither :memory: nor a usable file path #30395, as the triage says; this PR closes the reading for every driver that warns instead of throwing.Verification
All on head
28086960(the fix2cc82972plus a merge oforigin/main8e5fabe5, which contains PR #30395).pnpm --workspace-concurrency=2 --filter '@objectstack/service-datasource...' build && pnpm --filter @objectstack/service-datasource typecheck && pnpm --filter @objectstack/service-datasource testunderos-verify-lock.sh:VERDICT command-exit 0;Test Files 72 passed (72),Tests 1187 passed (1187).node scripts/pm/dispatch-gates.mjs --commands --repo objectstack-ai/objectstack: 59 derived families, each run and its exit recorded;--ranreconciliation:59 derived famil(ies) accounted for — 58 run, 1 NOT-MEASURED.check-plugin-teardown-shape.mjs --self-testfirst exited 3 on the shallow clone (fixture commit absent); aftergit fetch origin 621a4876…it exited 0 (48 cases pass).pnpm check:dual-build-cjs-loads, reason: exit 3 PREREQUISITE NOT MET, it reads every package'sdist/and only the service-datasource closure was built here. CI runs it inLint & Repo Gates.pnpm --filter @objectstack/spec check:liveness: exit 0.test:repo(no file of that project changed), repo-widepnpm lint, the full farm.Generated by Claude Code