You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 796b204
Browse filesBrowse the repository at this point in the historyBrowse files
fix(knowledge-turso): review round 2 — the request bound per request, never per page; a write stopped is rolled back
- requestTimeoutMs bounds each request on its own (a statement, a batch,
opening a transaction, a commit or rollback) through a bounded view of the
client, no longer a whole queue turn; the queue stays keyed by the client
as given. A write sends each document's statements as one batch, so a page
of 100 documents is ~100 requests. A request that times out inside a
write is followed by a rollback, never a commit; only a commit that times
out may still land, and its remedy says so. The remedy names
requestTimeoutMs. Pinned with a slow client (40 documents, 2 passages
each) and a write whose second batch hangs (nothing of it lands).
- search's retry count is a private method's, not a third public parameter.
- A table the store did not make under a generation name answers
SERVICE_UNAVAILABLE with the table in the remedy.
- The platform-file refusal compares the file a link resolves to, and reads
SQLite's -wal, -shm and -journal side files as their database.
- Pinned: the vector-type half of the legacy shape, the VALIDATION_ERROR
code (and a long source id accepted), the search retry bound, the remote
default bound (requestBoundFor).
Co-authored-by: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JQwxbaMuehXzctoWq7iRsV
-**`@objectstack/knowledge-turso` now ships from this repository**, Apache-2.0 (its `LICENSE` file is the Apache-2.0 text). `KnowledgeTursoPlugin` registers a `TursoKnowledgeAdapter` (adapter id `turso`) that keeps passages and vectors in a libSQL database of its own with libSQL's native vectors: the `url` option (`file:`, `:memory:`, `libsql://`), else `knowledge.db` under the project's `.objectstack/data/` (`defaultStoreUrl`). A URL naming the platform's own database file (`objectstack.db`, `dev.db`, `standalone.db`, or the file `OS_DATABASE_URL` names) is refused: two engines writing one SQLite file lose rows. On a file the store sets WAL and a busy timeout (`busyTimeoutMs`, default 5000), and in one process every call of the store runs its database work one at a time. On a remote database (`libsql://`) one turn of that work is bounded (`requestTimeoutMs`, default 10000): past it the call answers `SERVICE_UNAVAILABLE` and the queue moves on.
14
+
- **`@objectstack/knowledge-turso` now ships from this repository**, Apache-2.0 (its `LICENSE` file is the Apache-2.0 text). `KnowledgeTursoPlugin` registers a `TursoKnowledgeAdapter` (adapter id `turso`) that keeps passages and vectors in a libSQL database of its own with libSQL's native vectors: the `url` option (`file:`, `:memory:`, `libsql://`), else `knowledge.db` under the project's `.objectstack/data/` (`defaultStoreUrl`). A URL naming the platform's own database file (`objectstack.db`, `dev.db`, `standalone.db`, or the file `OS_DATABASE_URL` names) is refused: two engines writing one SQLite file lose rows. On a file the store sets WAL and a busy timeout (`busyTimeoutMs`, default 5000), and in one process every call of the store runs its database work one at a time. On a remote database (`libsql://`) each request is bounded (`requestTimeoutMs`, default 10000; a write sends one request per document): past it the call answers `SERVICE_UNAVAILABLE`, a write stopped before its commit is rolled back, and the queue moves on.
15
15
-**The platform embedder and splitter.** The package's own OpenAI embedding provider, hash embedder and chunker are gone: it embeds with the kernel's `embedder` service, read at each call (or the `embedder` option), reports `embedding` (model, dimensions, input limit), and declares `capabilities.chunks`, indexing the service's passages as given. Removed exports of the cloud-repo releases: `HashEmbedder`, `HashEmbeddingProvider`, `EmbeddingProvider`, `TursoAdapterOptions` and the default export; removed options: `embedding` (now `embedder`), `chunkTarget`, `overFetch`, and `adapterConfig.tableName` / `dimensions` on a source.
16
16
- **Generations under the index fingerprint (ADR-0161 K7; K8, item 8).** A generation table `knowledge_generation` and one passage table per source and generation, `knowledge_<source>_g<n>`. A write or a search under another fingerprint is refused `409 KNOWLEDGE_REBUILD_REQUIRED` (registered in the error-code ledger for this package). `beginBuild` under a new fingerprint opens a generation beside the active one, which keeps answering its own fingerprint; `completeBuild` switches to it, records the recipe hash and drops the old table; `indexStatus` answers the fingerprint, the recipe hash and whether a build is under way. The unique index keeps one generation under construction per source; it does not refuse a second builder: a second `beginBuild` under the same fingerprint joins the build, and one under another fingerprint replaces it, after which the first builder's writes are refused `KNOWLEDGE_REBUILD_REQUIRED`. Either way no generation mixes two fingerprints. A table of the cloud-repo releases (`knowledge_<source>` with exactly their columns) is never served: a search answers `KNOWLEDGE_REBUILD_REQUIRED`, and the table is dropped when the first complete reindex finishes.
17
17
-**Listing, hashes, organizations.**`listDocuments` pages the generation the writes go to, each document's `docHash` as stored; hits carry `docHash` and the passage's `headingPath`; the organization filter, the record scope (`scope`, ADR-0161 K8 item 17) and the metadata `filter` run in SQL before ranking, by an exact cosine scan (no DiskANN index, which ranks before it filters). A passage whose text is unchanged is not embedded again.
|`authToken`| — | The token of a `libsql://` URL. |
25
25
|`client`| — | A libSQL client to use as it is (not configured, not closed by the plugin). |
26
26
|`busyTimeoutMs`|`5000`| How long a write waits for another process's lock on a `file:` store. |
27
-
|`requestTimeoutMs`|`10000` for a remote URL | The longest one turn of database work may take on a remote database before the call answers `SERVICE_UNAVAILABLE`. None for a file or `:memory:`; for a `client` given as it is, only when set. |
27
+
|`requestTimeoutMs`|`10000` for a remote URL | The longest one request to a remote database may take (each statement, each document's batch of a write, each commit) before the call answers `SERVICE_UNAVAILABLE`. A write stopped before its commit is rolled back, never committed. None for a file or `:memory:`; for a `client` given as it is, only when set. |
28
28
|`projectRoot`|`process.cwd()`| The directory the default file is under. |
29
29
|`queryPrefix`|`''`| Text put before every query before it is embedded. Passages are embedded as they are. |
30
30
|`embedder`| the kernel's `embedder` service | The embedder to call, read at each call. |
31
31
32
32
## Its own file, never the platform's
33
33
34
-
The store opens a libSQL file of its own. Two engines writing one SQLite file in one process lose rows (measured: a row lost silently under WAL, a failed commit in delete mode), so a URL that names the platform's database — `objectstack.db`, `dev.db`, `standalone.db`, or the file `OS_DATABASE_URL` names — is refused: the plugin registers, warns, and every call answers `SERVICE_UNAVAILABLE`.
34
+
The store opens a libSQL file of its own. Two engines writing one SQLite file in one process lose rows (measured: a row lost silently under WAL, a failed commit in delete mode), so a URL that names the platform's database — `objectstack.db`, `dev.db`, `standalone.db`, or the file `OS_DATABASE_URL` names, compared as the file a link resolves to and with SQLite's `-wal`, `-shm` and `-journal` side files read as their database — is refused: the plugin registers, warns, and every call answers `SERVICE_UNAVAILABLE`.
35
35
36
36
On a file the store sets WAL and a busy timeout: without them a second process writing the same file lost most of its writes in measurement. Within one process every call of the store runs its database work one at a time.
0 commit comments