feat(session-query): ship full-text session search opt-in via openAt never

The shipped bundles keep ctx.sessionQuery mounted but set the new
session-query-sqlite `openAt: never` phase: searchSessions/searchEvents
fail with the typed SESSION_QUERY_SEARCH_DISABLED code before any request
normalization, node:sqlite is never imported or opened, and no source
observation or reconciliation runs. Every inherited exact read, filter,
and trace — session export descendants, subagent-fork Workspace
inheritance, title reads — keeps working, and the Web sidebar search
degrades to its designed local title/workspace matching. Enabling content
search is a one-line openAt override in a later patch layer; the web e2e
scaffold keeps it enabled as the assembled opt-in coverage.
This commit is contained in:
Hypatia May
2026-08-13 11:38:38 +08:00
parent 137c3c9254
commit b6b6a72df7
23 changed files with 207 additions and 41 deletions

View File

@@ -2,5 +2,5 @@
# side as of the last confirmed-consistent state. Both languages carry equal authority;
# after editing either side, bring the other along and re-record with:
# pnpm run verify-translation-pairing --write docs/config-catalog.md
config-catalog.md: 6b60fad7395ba4de28921390641a332ea9667217
config-catalog.zh.md: b4378b32b925adce221ca0bac837a6630eb30a24
config-catalog.md: 19bfa6d1fb847de4a7207f42dabd67d43f288361
config-catalog.zh.md: fda208e8fcd2ff6dd697efed84a4073ecbd5a912

View File

@@ -1558,7 +1558,13 @@ export interface Config extends SessionQueryConfig {
* POSIX filesystems; existing modes are preserved.
*/
path: string
/** Open the SQLite module and handle at service activation or the first search. Defaults to `startup`. */
/**
* Open the SQLite module and handle at service activation or the first
* search, or `never` to disable full-text search: the inherited exact
* reads, filters, and traces stay available, while `searchSessions` and
* `searchEvents` fail with `SESSION_QUERY_SEARCH_DISABLED` and SQLite is
* never imported or opened. Defaults to `startup`.
*/
openAt?: OpenAt
/** SQLite journal mode. Defaults to `wal`. */
journalMode?: JournalMode
@@ -1572,8 +1578,8 @@ export interface Config extends SessionQueryConfig {
persistedInspectConcurrency?: number
}
/** SQLite module/handle opening phase. */
export type OpenAt = 'startup' | 'first-search'
/** SQLite module/handle opening phase; `never` disables full-text search entirely. */
export type OpenAt = 'startup' | 'first-search' | 'never'
/** Supported SQLite journal modes. */
export type JournalMode = 'wal' | 'delete' | 'truncate' | 'persist'

View File

@@ -1560,7 +1560,13 @@ export interface Config extends SessionQueryConfig {
* POSIX filesystems; existing modes are preserved.
*/
path: string
/** Open the SQLite module and handle at service activation or the first search. Defaults to `startup`. */
/**
* Open the SQLite module and handle at service activation or the first
* search, or `never` to disable full-text search: the inherited exact
* reads, filters, and traces stay available, while `searchSessions` and
* `searchEvents` fail with `SESSION_QUERY_SEARCH_DISABLED` and SQLite is
* never imported or opened. Defaults to `startup`.
*/
openAt?: OpenAt
/** SQLite journal mode. Defaults to `wal`. */
journalMode?: JournalMode
@@ -1574,8 +1580,8 @@ export interface Config extends SessionQueryConfig {
persistedInspectConcurrency?: number
}
/** SQLite module/handle opening phase. */
export type OpenAt = 'startup' | 'first-search'
/** SQLite module/handle opening phase; `never` disables full-text search entirely. */
export type OpenAt = 'startup' | 'first-search' | 'never'
/** Supported SQLite journal modes. */
export type JournalMode = 'wal' | 'delete' | 'truncate' | 'persist'

View File

@@ -2,5 +2,5 @@
# side as of the last confirmed-consistent state. Both languages carry equal authority;
# after editing either side, bring the other along and re-record with:
# pnpm run verify-translation-pairing --write docs/subsystems/session-query.md
session-query.md: 647b50a297a434308769ab3c5f1af0af7480b937
session-query.zh.md: 7b03f8515501abe5e1ab35d50f6a6a230a96cf0c
session-query.md: 6ddde5b8a19ebc65952b5a24003c48f55ff5a244
session-query.zh.md: b7d4ab4910c99c9f77c17f0279f2d4fd3c336659

View File

@@ -332,7 +332,7 @@ interface SessionEventTraceObservation extends SessionEventTrace {
## Errors
The closed code union distinguishes request validation, missing targets, malformed surface logs, optional-backend failure, and contradictory source metadata.
The closed code union distinguishes request validation, missing targets, malformed surface logs, optional-backend failure, deployment-disabled search, and contradictory source metadata.
```ts type-equiv
/** Stable machine-routable failure taxonomy for session reads, traces, and search. */
@@ -350,6 +350,7 @@ type SessionQueryErrorCode =
| 'SESSION_QUERY_INVALID_SURFACE'
| 'SESSION_QUERY_INVALID_WINDOW'
| 'SESSION_QUERY_PERSISTENCE_FAILED'
| 'SESSION_QUERY_SEARCH_DISABLED'
| 'SESSION_QUERY_SESSION_NOT_FOUND'
| 'SESSION_QUERY_STALE_CURSOR'
| 'SESSION_QUERY_SOURCE_CONFLICT'

View File

@@ -332,7 +332,7 @@ interface SessionEventTraceObservation extends SessionEventTrace {
## 错误
封闭的 code 联合类型区分请求校验、目标缺失、surface 日志格式错误、可选后端故障与矛盾的源元数据。
封闭的 code 联合类型区分请求校验、目标缺失、surface 日志格式错误、可选后端故障、部署关闭搜索与矛盾的源元数据。
```ts type-equiv
/** Stable machine-routable failure taxonomy for session reads, traces, and search. */
@@ -350,6 +350,7 @@ type SessionQueryErrorCode =
| 'SESSION_QUERY_INVALID_SURFACE'
| 'SESSION_QUERY_INVALID_WINDOW'
| 'SESSION_QUERY_PERSISTENCE_FAILED'
| 'SESSION_QUERY_SEARCH_DISABLED'
| 'SESSION_QUERY_SESSION_NOT_FOUND'
| 'SESSION_QUERY_STALE_CURSOR'
| 'SESSION_QUERY_SOURCE_CONFLICT'