Repository navigation
fix(knowledge-turso): a scoped search reads its passage table once a statement; a request past its bound answers TIMEOUT - #38693
Conversation
…statement; a request past its bound answers TIMEOUT A search with a record scope or a metadata filter read its WHERE row by row in the vector leg, the keyword candidates and the keyword count, and the keyword candidates were computed twice in one statement. Each was a pass over the passage table; on a remote libSQL database a scoped statement went past the 10 s request bound. The WHERE is now read once a statement into a materialized scope set that every other read looks up by chunk id, and the keyword candidates are materialized. A request past requestTimeoutMs answers TIMEOUT (504), "did not answer in time", instead of SERVICE_UNAVAILABLE "is not ready". Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01JQwxbaAVoqUQiPmxMVpLst
📓 Docs Drift Check4 anchor(s) derived from 1 changed package(s); no hand-written page names any of them. 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 4f8b8213ca7dacd8269add1491eb7a6c97ebbea9 && git checkout 4f8b8213ca7dacd8269add1491eb7a6c97ebbea9
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin 5ac1ee0bc8a79ab2238ded80123ba91623ad6081 d3c750a86e0e50b389bab5fb4a782217c44da965 && git checkout -B drift-repro 5ac1ee0bc8a79ab2238ded80123ba91623ad6081 && git merge --no-ff d3c750a86e0e50b389bab5fb4a782217c44da965
node scripts/docs-audit/affected-docs.mjs --json 5ac1ee0bc8a79ab2238ded80123ba91623ad6081 |
…UT too Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01JQwxbaAVoqUQiPmxMVpLst
|
repo:objectstack#2 · os-warren · session_01JQwxbXyLoBzNYY1U8SNPFu 维护者速读
席位核对ACCEPT · L1 · area o2-A · Head-sha
|
|
repo:objectstack#2 · os-warren · session_01JQwxbXyLoBzNYY1U8SNPFu 2026-11-30T07:09Z · Landing · seat ACCEPT 7269924689 at
|
…scope too narrow for the approximate pass straight to the exact scan (objectstack-ai#38697) <!-- claude-projects-attribution: {"github_login":"os-warren"} --> _Requested by **Warren** · [project thread](https://claude.ai/code/project/chan_01U5RdnAAmkSQmZbqh6FtqZ8?thread=cmsg_01U5RdnAAmkSQmZbqh6FtqZ8Es8AjkqFCZ7RyXPBkdgAD3)_ Part of objectstack-ai#38676 **Stacked on objectstack-ai#38693.** The base is that PR's branch, so this diff shows only objectstack-ai#38676's commit. After objectstack-ai#38693 lands, main is merged in and the PR is retargeted to `main`. ## What changes `packages/plugins/knowledge-turso` only (`turso-adapter.ts`, `sql.ts`, tests, README). 1. **The keyword leg is computed once a search.** The first statement of a search computes it, as before. When the approximate pass falls short and a wider pass or the exact scan follows, that statement binds the keyword ranks the first one answered (`kw AS (SELECT … FROM json_each(?n))`) instead of matching up to 16 terms again. A statement binds only the shared values (query vector, scope and filter values, `topK`), the ranks, and its candidate count. 2. **A scope too narrow for the approximate pass goes straight to the exact scan, judged by its share of the rows.** Before, only a scope of record terms alone was checked (through the record index). Now a scope with a parent (metadata) term, or a metadata `filter`, has its share estimated by `scopeSampleSql`: 256 rows at evenly spread rowids, with `min(rowid)`/`max(rowid)` seeks for the bounds, so no pass over the table. The cut is the record scope's (`VECTOR_RECORD_SCOPE_POOL`: 25% of the passages at the default over-fetch of 40). **Not built here: cause 3, the question embedded again on the second round.** The adapter embeds once per `search()` call. The repeat comes from `service-knowledge`'s second `searchRound` calling `adapter.search` again. That file is held by objectstack-ai#38660 and is outside this order's surface, so objectstack-ai#38676 stays open for it (see the os-dev report on the card). ## Why Re-measured on objectstack-ai#38693's head (d3c750a), on the same local corpus as objectstack-ai#38693: a `file:` libSQL with 59,621 one-passage records, 1,024 dimensions, approximate index built, and the 16-term Chinese question. Total per search (statements): | Search, `topK` 40 | objectstack-ai#38693 head | This PR | |---|---|---| | 3 policies (0.15%) | 190 ms (approx+kw 120, exact+kw 74) | 80 ms (sample 5, exact+kw 75) | | Leaf unit (1.7%) | 310–680 ms (approx+kw, wide+kw, exact+kw) | 150 ms (sample 5, exact+kw 145) | | Division (10%) | 570–700 ms (approx+kw 240, wide+kw 330–440) | 230–280 ms (sample 5, exact+kw 225–274) | | Root (100%) | 810–900 ms (approx+kw) | 820–880 ms (sample 5, approx+kw) | | No scope | 620–690 ms | 620–660 ms (unchanged path) | `topK` 8 shows the same pattern: the leaf unit went from 318–372 to 143–147 ms and the division from 227–507 to 210–214 ms. - Cause 1 held: every vector statement of one search carried the keyword CTE. - Cause 2 held: under a parent-term scope of 1.7% or 10%, the search ran 2–3 statements where 1 exact scan answered. - Cause 3: the adapter embedded once per call (31 embeds for 31 searches), so the repeat lives in the caller. ## Verification - **Pins**, all from plans and statement shape, none on wall-clock. With `turso-adapter.ts` and `sql.ts` reverted to objectstack-ai#38693's head, 10 of 301 tests fail: - `scope-plan.test.ts`: across one search's statements, `MATERIALIZE cand` appears once, in the first. - `acceptance.test.ts` retry case, rewritten for the new routing: the wide pass and the exact scan after a short first pass bind the keyword ranks (`computed: 1, bound: 1`); a 1% scope goes exact alone; the sample's plan reads the table by `SEARCH` only, never `SCAN`; each pass binds exactly what it reads. - Filter, record-cut and termless cases: a parent term or filter under the cut now runs `{approximate: 0, exact: 1}`, and a parent-term scope over the cut still takes the first pass. - Hits still equal the exact-scan adapter's in every routed case (the existing `exact` twin comparisons). - `pnpm --filter @objectstack/knowledge-turso test`: 5 files, 301 tests pass. `pnpm typecheck` passes. eslint on the changed files is clean. `check:issue-citations`, `check:doc-authoring`, `check:objectql-double-limit`, `check:where-matcher` and `check:empty-changeset` exit 0. Clause-②: no Metadata-protocol: none ## Human Minimum - [x] 1. Schemas start as Zod; `packages/spec` holds no runtime logic. (not touched) - [x] 2. Every name I added uses the casing for its kind. - [x] 3. No formatter ran. eslint is clean on the changed files; the repo-wide `pnpm lint` was not run locally. - [x] 4. One issue, one branch, one pull request. It is stacked on objectstack-ai#38693 by the seat's order. - [x] 5. A change that publishes carries a changeset, and both declaration lines are filled in here and in the changeset. - [x] 6. `packages/spec` touched: not touched. - [x] 7. No hand edits to `content/docs/references/`, `packages/*/CHANGELOG.md` or `content/docs/releases/`. - [x] 8. Title, body and comments are in English. - [ ] The *Before Submitting* list in CONTRIBUTING.md is done. The full repo-wide suite was not run; CI runs it. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01JQwxbaAVoqUQiPmxMVpLst --------- Co-authored-by: Claude <noreply@anthropic.com>
…ement has a time limit, and its pool size is a setting (objectstack-ai#38726) <!-- claude-projects-attribution: {"github_login":"os-warren"} --> _Requested by **Warren** · [project thread](https://claude.ai/code/project/chan_01U5RdnAAmkSQmZbqh6FtqZ8?thread=cmsg_01U5RdnAAmkSQmZbqh6FtqZ8VZtjriPRDBMFWChF2eLFkE)_ Fixes objectstack-ai#38718 Clause-②: yes Metadata-protocol: none ## 维护者速读 - 用户能看到什么变化:私有部署企业版在 PostgreSQL 上检索知识时,数据库忙、连接等不到或语句超时,助手会收到明确的「超时 / 暂不可用」拒绝,不再拿到「0 条命中」;检索语句默认最多跑 10 秒;连接池大小可以由运维通过设置调整。 - 为什么做:属于「私有部署企业版知识检索 10 人同时提问不超时」专题第一期,目标之一是出错不能变成空结果,首个用户是 BrightRule 制度问询。 - 出错会怎样:最坏情况是本来能跑完的超长检索(超过 10 秒)现在被拒绝为超时,运维可调大时限设置;改动只在知识检索的 PostgreSQL 适配器内,撤回即恢复原样。 - 要你做什么:无。 ## What changes Topic objectstack-ai#38703 row B2, in `@objectstack/knowledge-pgvector` only (no change to `service-knowledge` or `core`). 1. **Coded refusals.** `search()` now answers every failure of the store's database as an ADR-0112 refusal, judged by SQLSTATE (never by the server's message, which `lc_messages` translates): `57014` (statement past its limit, or cancelled) is `TIMEOUT` 504; class `53` (`too_many_connections`, out of memory, disk full) is `SERVICE_UNAVAILABLE` 503; no connection (the pool's wait timed out, class `08`, `57P01`–`57P05`, a socket error) is `SERVICE_UNAVAILABLE` 503; any other SQLSTATE is `DATABASE_ERROR` 500. The message is one sentence naming the source; the SQLSTATE, the driver text and the setting to change go to `remedy` (operator text the service logs). An already-coded error (the adapter's own refusals) and a non-database error (the embedder's) pass through unchanged. New module `src/errors.ts`. - The pool's wait timeout carries no code at all, so `poolFromPg` now marks every error its pool and connections throw (a non-enumerable symbol; message, code and keys untouched, so write paths read exactly what `pg` threw), and the classifier treats a marked uncoded error as "no connection". - Placement: the translation is one `try/catch` in `search()` around the attempts loop (moved into a private `searchAttempts`); the ranking statement's body is untouched (the objectstack-ai#38692 phase-1a pgvector PR follows this one). 2. **Statement time limit.** The ranking statement runs through a new `searchStatement` helper: its own transaction, `SET LOCAL statement_timeout = N` first. Chosen form: `SET LOCAL` in a transaction, so the limit lasts exactly one statement, touches no session state and holds behind a transaction-mode pooler (the builder lock still needs session mode; README says so). Default 10000 ms, the same bound the Turso store uses for a remote request (objectstack-ai#38693); `statementTimeoutMs` plugin/adapter option, else the setting `OS_KNOWLEDGE_STATEMENT_TIMEOUT_MS`. Only the ranking statement is limited; catalog reads, writes and builds are not. 3. **Pool size from a named setting.** `OS_KNOWLEDGE_POOL_MAX` (plugin option `poolMax` wins), default **20** (raised from 4 in Rework 2 below, on os-bob's measurement). Strict like `OS_DATABASE_POOL_MAX`: a value that is not a positive integer stops the boot naming the setting; blank reads as unset. The plugin reads it (as it already reads the URL from the environment), so a composed boot (`os serve` hands `process.env`) and a host that mounts the plugin directly read the same setting; `resolveKnowledgeStore` in `core` needed no change. The boot line now says the pool size, the limit and where each was read from. - **Ratio to `max_connections = 200`** (README, "Pool size and time limit"): `replicas × (OS_DATABASE_POOL_MAX + OS_KNOWLEDGE_POOL_MAX + builds running at once) + headroom ≤ max_connections`. With 20 kept as headroom, platform pool at its default 5 and one build running, the default of 20 fits up to 6 replicas (3 replicas = 60 store connections); the ceiling is 84 with 2 replicas, 54 with 3, 39 with 4. A larger pool moves waiting from the pool into the database; it does not make one search faster. This is the setting key and ratio B12 (the delivery note) carries. ## Why Premise re-read on `origin/main` d2caaec before code: `codedRefusalOf` (`knowledge-service.ts:4974`) accepts only a SCREAMING_SNAKE `code` with an integer `status` 400–599; `searchRound` (`:3237-3249`) logs an uncoded throw at `error` and `continue`s, and `search()` throws `wholeRefusal` only when `refused` is non-empty (`:2561`). A `pg` error's `code` is a SQLSTATE (`57014`) or absent, so a single-source search answered `{ hits: [] }`. The ablation below reproduces exactly that. ## Tests - `src/__tests__/search-refusals.test.ts` (unit, runs everywhere, 14 cases): the statement shape (`BEGIN`, `SET LOCAL statement_timeout = 10000`, the ranking, `COMMIT`; the ranking never on a bare pooled query; a given limit; a bad limit refused at construction); one case per error class (statement timeout `57014`, cancel `57014` with a translated server message, pool wait through `poolFromPg` at the ranking's connect and at a pooled read, `53300`, `57P01`, `42P01`), each pinned on `code` + `status`; the embedder's uncoded error passed through by identity; **through `KnowledgeService.search`: the caller is refused `TIMEOUT` 504 instead of an empty list**; the settings reader (precedence, blank, strict refusals). - `src/__tests__/search-refusals.live-postgres.test.ts` (live, `OS_TEST_POSTGRES_URL`, no pgvector needed): a real `pg_sleep` past `SET LOCAL statement_timeout` answers `57014` and classifies `TIMEOUT` 504, and `SHOW statement_timeout` on the same pooled connection after the transaction reads the session's own value; a real full pool (`max: 1`) times out through `poolFromPg` and classifies `SERVICE_UNAVAILABLE` 503 on both `query` and `connect`. Pins codes, never durations. <details><summary>Local readings at head 9a39db7</summary> - `pnpm --filter @objectstack/knowledge-pgvector test`: exit 0, Test Files 6 passed / 9 skipped (live files, no URL), Tests 38 passed / 95 skipped. - `vitest run src/__tests__/search-refusals.live-postgres.test.ts` with `OS_TEST_POSTGRES_URL` at a local PostgreSQL 16.15: exit 0, 2/2. - `pnpm --filter @objectstack/knowledge-pgvector typecheck`: exit 0 (incl. `check:test-typecheck`, 0 debt). - `eslint --no-inline-config` on the five changed source/test files: exit 0. `scripts/check-nul-bytes.mjs`: exit 0. - `dispatch-gates.mjs --commands` (7 paths, 694 changed lines): 26 of 27 commands exit 0; `check-plugin-teardown-shape.mjs --self-test` exit 3 — NOT MEASURED locally, reason: shallow clone cannot reach its pinned fixture commit (the script says so); CI runs it. - **Ablation** (fix committed first, restored with `git checkout HEAD --`): with `search()` rethrowing the raw error, 8 of 14 cases go red, and the `KnowledgeService` case receives `{ hits: [] }` — the defect as filed. With `poolFromPg`'s marking removed, the two pool-wait cases go red. </details> ## Acceptance notes - `Clause-②: yes` is copied from the claim. Behaviour that changes for a caller: a database failure that used to read as zero hits from that source is now a refusal (`refused[]`, or a whole-search refusal when it was the only source); a search statement over 10 s is now stopped where it used to run to completion. - Out of scope, noted, not filed: an uncoded throw from something other than the database (the embedder failing, a mis-sized query vector) is still logged and skipped by `searchRound`, so it still reads as zero hits for that source. The general fix sits in `service-knowledge` (`searchRound` treating any uncoded throw as a refusal), which this card was told not to touch (held by objectstack-ai#38700). carrier: objectstack-ai#38703 (topic owner) · noted, not filed. - `connectTimeoutMs` (also the pool's wait) stays a plugin option only, default 5000; the card asked for the pool size and the time limit, not this. ## Verification Two-minute check: `pnpm --filter @objectstack/knowledge-pgvector exec vitest run src/__tests__/search-refusals.test.ts` — expect 14 passed, among them "through KnowledgeService: the caller is refused TIMEOUT, not answered an empty hit list". Read first, by risk: `src/errors.ts` (the SQLSTATE table), `src/pgvector-adapter.ts` `search()` / `searchStatement()`, `src/plugin.ts` `poolFromPg` and `resolveStoreSettings`. ## Rework (L1 7272964718, docs only) Head `4340f85d` adds the two should-fix doc edits and nothing else; nits N1–N3 not taken this round. - `content/docs/deployment/environment-variables.mdx` (Database & Storage, beside `OS_DATABASE_POOL_MAX`): `OS_KNOWLEDGE_POOL_MAX` (integer, `4`, per replica, plugin option wins, the sizing formula with a link to the README section, a non-integer refuses the boot) and `OS_KNOWLEDGE_STATEMENT_TIMEOUT_MS` (integer, `10000`, per search statement, `SET LOCAL`, refused `TIMEOUT` past it, plugin option wins, a non-integer refuses the boot). - `content/docs/protocol/knowledge.mdx` §4.1: one sentence each for the pool precedence (`poolMax`, else `OS_KNOWLEDGE_POOL_MAX`, else 4), the ranking statement under `SET LOCAL statement_timeout` (default 10000 ms), and the three refusals by SQLSTATE. Regen-provenance: 7272956301 · 9a39db7 → 4340f85 · `git diff --name-only 9a39db7 4340f85` → content/docs/deployment/environment-variables.mdx, content/docs/protocol/knowledge.mdx (prose faces only, no code path moved) ## Rework 2 (pool default 4 → 20, on new data) Head `4f6b7d85`. The only behaviour change is `DEFAULT_POOL_MAX` 4 → 20 in `src/plugin.ts`; the rest is its pins and prose. Nits N1–N3 not taken. `statement_timeout` stays 10000 ms. Evidence (not this PR's bench reading): os-bob's measurement on the card, objectstack-ai#38718 comment 7273601824 — local PostgreSQL 17 + pgvector 0.8.7, 59,949 indexed BrightRule clauses, end to end over MCP `search_knowledge`, scoped, 15 questions in rotation: > | 配置 | 20 并发:空结果 | 40 并发:空结果 | > |---|---|---| > | 混合检索 · 连接池 4(现默认) | 15 / 45 | 52 / 90 | > | 混合检索 · 连接池 20 | 0 / 45 | 8 / 90 | > | 只用向量 · 连接池 20 | 0 / 45 | 0 / 90 | > > 空结果全部来自等连接超时:平台日志里有 225 次 `timeout exceeded when trying to connect` … **建议默认值从 4 改为 20**(不只是可配置)。… 语句时限 10 秒:单人串行时,只用向量的主语句 234–445 ms,混合检索 1.1–1.7 s,都远低于 10 秒。 (Those empty results are what this PR turns into `SERVICE_UNAVAILABLE` refusals; the larger pool is what keeps them from happening at 20 concurrent callers.) - `src/plugin.ts`: `DEFAULT_POOL_MAX = 20`; its docblock rewritten to justify the move (the measurement, a lazy ceiling rather than a count opened at boot, fits up to 6 replicas at `max_connections=200`, class 53 refusals past that), replacing the old "not moved" note. The two option docblocks say 20. - **Upgrade effect, stated in the changeset and README:** a deployment with `OS_KNOWLEDGE_POOL_MAX` unset may now open up to 20 store connections per replica under load instead of 4. With the README's formula (platform pool 5, one build, 20 kept as headroom, `max_connections=200`) a replica reaches up to 26, so up to 6 replicas fit (6 × 26 = 156 ≤ 180; 7 × 26 = 182 does not); 3 replicas take 60 store connections. More replicas or a smaller server must set it lower (`4` keeps the old size) or raise `max_connections`, otherwise the server refuses connections (`too_many_connections`, class 53) and those searches are refused `SERVICE_UNAVAILABLE`. - Every pin of 4 moved together: `search-refusals.test.ts` (`DEFAULT_POOL_MAX` and the blank-setting case), the README options and settings tables, `environment-variables.mdx`'s `OS_KNOWLEDGE_POOL_MAX` row, `knowledge.mdx` §4.1, the changeset. - Local at `4f6b7d85`: `search-refusals.test.ts` 14/14, `tsc --noEmit` exit 0. Regen-provenance: 7272956301 · 4340f85 → 4f6b7d8 · `git diff --name-only 4340f85 4f6b7d8` → .changeset/knowledge-pgvector-coded-search-refusals.md, content/docs/deployment/environment-variables.mdx, content/docs/protocol/knowledge.mdx, packages/plugins/knowledge-pgvector/README.md, packages/plugins/knowledge-pgvector/src/__tests__/search-refusals.test.ts, packages/plugins/knowledge-pgvector/src/plugin.ts (NOT prose-only: one constant and its docblock in `plugin.ts`, one test pin; the record does not carry across this hop by itself) ## Human Minimum - [x] 1. Schemas start as Zod; `packages/spec` holds no runtime logic. (not touched) - [x] 2. Every name I added uses the casing for its kind. - [x] 3. No formatter ran; eslint passes on the changed files. - [x] 4. One issue, one branch off an up-to-date `main`, one pull request. - [x] 5. A change that publishes carries a changeset, and both declaration lines are filled in here and in the changeset. - [x] 6. `packages/spec` touched: n/a. - [x] 7. No hand edits to `content/docs/references/`, `packages/*/CHANGELOG.md` or `content/docs/releases/`. - [x] 8. Title, body and comments are in English (the 维护者速读 block excepted by AGENTS.md's Communication rule). --- _Generated by [Claude Code](https://claude.ai/code/session_01JQwxbYVKM5Jf2J5JbHJ8Aj)_ <!-- signed: repo:objectstack@os-warren · os-warren · session_01JQwxbYVKM5Jf2J5JbHJ8Aj --> --------- Co-authored-by: Claude <noreply@anthropic.com>
Requested by Warren · project thread
Fixes #38675
What changes
packages/plugins/knowledge-tursoonly.filter, the statement now opens withscope AS MATERIALIZED (SELECT chunk_id FROM <table> WHERE <the same WHERE>). The vector leg (exact and approximate), the keyword candidates and the keyword count of passages in scope read from that set bychunk_id, a primary-key lookup. Before, each of those three ran theWHERErow by row over the whole table, and a metadata scope term parses each row's JSON (json_each(metadata)). A search with only the organization filter is unchanged (no scope set).candbecomescand AS MATERIALIZED. Bothstatsandkwread it, and SQLite inlined it into each, so every term was matched twice per statement. The fix applies to scoped and unscoped searches.requestTimeoutMsanswersTIMEOUT(504). The message is "The knowledge store (libSQL) did not answer in time: a request to its database took longer than N ms." Before, the refusal wasSERVICE_UNAVAILABLE(503) with "The knowledge store (libSQL) is not ready: its database did not answer in time." That told the model and the employee the store was down when one statement was slow.remedy(operator text) still namesrequestTimeoutMsand keeps the commit warning.TIMEOUT/504 is the ADR-0112 code for an operation that timed out. Nothing inservice-knowledgebranches on the old code; it passes any coded refusal through (codedRefusalOf).Docs: the README
requestTimeoutMsrow and the Search section, therequestTimeoutMsoption doc inplugin.ts, and the adapter's class comment.Why
The premise, read on
mainat 5ac1ee0 and measured.Why a scoped statement is slower than an unscoped one. In the plan of a scoped statement, the passage table is read in full three times: by the vector leg, by the keyword candidates (twice, since
candis inlined intostatsandkw) and by the count instats. Each read evaluates the metadata scope term per row. An unscoped statement reads it twice: the count instatsis a covering-index count, andcandis still inlined twice. A narrow scope also fails the approximate leg's pool floor, so a scoped search runs two or three such statements (approximate, maybe wide, then exact). An unscoped search runs one.Reproduced locally (no remote Turso here). A
file:libSQL store was built through the adapter: 59,621 one-passage records, 1,024 dimensions, clustered vectors, one organization, Chinese clause text, metadata{business_unit: [root, division, leaf], policy, clause_hash}, approximate index built (completeBuild, threshold 20,000). The search wastopK40 (the service's first round) with the card's question 「我在集团干了12年了,一年有几天年假?」 (16 terms). Times are per statement, before → after:The card's hosted timings (25.6 s for an unscoped search, a scoped statement over 10 s) are about 8 to 10 times these local ones. On that ratio, a scoped statement now lands well under the bound. That is an inference from the ratio, not a remote measurement: the remote store was not reachable from here.
Responsibility. The cause is in this plugin's search SQL (
turso-adapter.ts), not inservice-knowledge. The approximate index (the card's second suspicion) is not the cause in the reproduction: the slow statements are slow with the index built and used. Whether the hosted table has its index was not readable from here.Out of scope, left to the cards the seat named: the keyword leg recomputed across the approximate → wide → exact statements, the approximate pass under a narrow scope, and the query embedded twice per refill (#38676); the keyword leg's ranking quality (#38671).
Verification
src/__tests__/scope-plan.test.ts(new) pins the plan, not a clock. For a metadata scope term, a record scope term, both terms together, and a metadata filter, each on the exact and the approximate vector leg, every search statement'sEXPLAIN QUERY PLANreads the passage table once outside a chunk-id lookup, underMATERIALIZE scope, and holds oneMATERIALIZE cand. A search with no scope makes no scope set. Scoped hits equal the terms' row-by-row meaning. A stalled search statement answersTIMEOUT/504 with the new sentence and no "not ready". With the adapter change stashed, 9 of the 11 cases fail: the 8 plan pins and the timeout pin. The 2 behaviour-equivalence cases pass on both.acceptance.test.ts: the stalled-write case now expectsTIMEOUT/504.pnpm --filter @objectstack/knowledge-turso test: 5 files, 301 tests pass.pnpm typecheckpasses for the package. eslint on the changed files is clean.dispatch-gates.mjsthat pass:check:issue-citations,check:doc-authoring,check:keyed-text-bounds,check:closed-ceremony-text,check:objectql-double-limit,check:where-matcher,check:duration-unit-keys,check:changeset-fixedandcheck:empty-changeset.Clause-②: no
Metadata-protocol: none
Human Minimum
packages/specholds no runtime logic. (not touched)pnpm lintwas not run locally.main, one pull request.packages/spectouched: not touched.content/docs/references/,packages/*/CHANGELOG.mdorcontent/docs/releases/.🤖 Generated with Claude Code
https://claude.ai/code/session_01JQwxbaAVoqUQiPmxMVpLst