Repository navigation
Commit bbd9733
fix(knowledge-turso)!: Test connection comes with the Turso fields it checks; the group text drops the cloud fallback (#37982)
repo:objectstack#1 · os-elon-musk · session_016WV4cwPhGV4g9p1BGQaZbP
Fixes #37907
Fixes #37680
Clause-②: yes (narrowing)
Metadata-protocol: none
Skills-docs: none — no skill under `skills/**` teaches the Knowledge
page's test action, `knowledgeTestActionHandler` or the Turso group's
text.
## 维护者速读
- 用户能看到什么变化:PostgreSQL 部署的知识设置页上不再有「测试连接」按钮;用 Turso 存储的部署里,按钮跟 Turso
字段放在一起,说明文字不再提云版按组织复用数据库,改为说明留空即用数据目录里的 knowledge.db。
- 为什么做:知识检索设置的复审收尾,让按钮只出现在它检查的字段旁边,并改正一句与实际不符的说明(云版事实已由云席位核实)。
- 出错会怎样:只影响设置页上的按钮和说明文字,不改任何已存数据;可直接撤回本次合并。
- 要你做什么:无。
## What changes
- **N1 (#37907).** The `test` action_button and
`knowledgeTestActionHandler` move from `@objectstack/service-settings`
(manifest declaration, handler, package export) and
`@objectstack/service-knowledge` (registration) into
`@objectstack/knowledge-turso`'s settings contribution. The button is
now the last entry of the Turso group, right after `turso_auth_token`,
and `contributeKnowledgeTursoSettings` registers the handler only where
it adds the group. So:
- no knowledge-turso, or knowledge-turso given its own `url`/`client`:
the page has no Test connection, and `POST /api/settings/knowledge/test`
answers `400 SETTINGS_ACTION_FAILED` (no handler registered), the same
envelope as an action no page declares;
- knowledge-turso reading its URL from settings: the action is on the
page and answers the Turso form check with `200`, as before.
- The label moved too: out of the eleven service-settings bundles
(`settings.knowledge.actions.test`), into
`knowledgeTursoSettingsTranslations`, same strings, all 11 locales in
step.
- `@objectstack/service-settings` no longer exports
`knowledgeTestActionHandler`; `@objectstack/knowledge-turso` does (plus
`KNOWLEDGE_TURSO_TEST_ACTION` and two structural types). The migration
line is in the changeset.
- **N2 (#37907).** `KnowledgeTursoPlugin.init()` warns once when
`contributeKnowledgeTursoSettings` returns false under
`opensFromSettings()`, naming the consequence (nothing can be saved
there, the store opens its default file, path given) and the fix. The
function now answers whether the page carries BOTH Turso keys, so a host
page declaring one group id without the keys also warns.
- **N3 (#37907).** `content/docs/ai/knowledge-rag.mdx` (the Settings →
Knowledge bullet) now gives the tidy-up for a PostgreSQL deployment that
saved the two Turso keys, naming the `sys_secret` row the
`turso_auth_token` row's handle points at. The card's else-branch: the
37678 note is no longer pending (see below).
- **#37680, folded.** The Turso group description: the English fallback
loses "In a cloud deployment with a database per organization, leave
blank to reuse that organization's own database connection." (no
deployment does that: cloud fact 7217205358 on #37680), and every locale
loses the "On PostgreSQL ... these fields are not read" clause (the
group is never shown on PostgreSQL). Each now says "Leave blank to use
knowledge.db in the data directory." in its language, 11 locales plus
the fallback, in step. Written without backticks around `knowledge.db`
because the page renders the string as plain text.
- `content/docs/ai/knowledge-rag.mdx` says Test connection comes with
the two fields.
### No changeset correction
The 37678 note (PR #37902) was consumed by main's version pass (#37661):
it now lives at `.changeset/pre/37678-knowledge-turso-settings-group.md`
and its text is published in the `19.0.0-next.1` CHANGELOG sections of
`@objectstack/knowledge-turso` and `@objectstack/service-settings`.
Earlier heads of this PR edited its tidy sentence as a DELIBERATE
CORRECTION of a pending note; contract record 7224029827 (S2) showed
that edit no longer reaches any reader before the stable cut and would
keep the whole `19.0.0-next.1` section at that cut. This head leaves the
consumed note byte-identical to main and puts the `sys_secret` clause on
the docs page instead, as card #37907 routes it for a note that is no
longer pending. The two published CHANGELOG entries are release-owned
and are not touched here. This PR's own note is
`.changeset/37907-knowledge-turso-test-connection.md` (patch on the
three packages, one ADR-0087 marker, BREAKING paragraph for three
readers).
## Tests
See the report on #37907 for the run log at the final head. New and
moved pins:
-
`packages/plugins/knowledge-turso/src/__tests__/settings-contribution.test.ts`
(real LiteKernel, real settings service and HTTP door, real knowledge
service): no-store page has no action_button and the test door answers
the undeclared-action envelope (control: `never_declared`);
store-from-settings page carries `turso, turso_url, turso_auth_token,
test` in front and the door answers 200 where the control is 400;
own-url page has no action; copy carries the action label in 11 locales
and the settings bundle no longer does; the description pin (PostgreSQL
named once, `knowledge.db` named, no cloud or "not read" clause, in the
fallback and 11 locales); the handler unit pins moved from
service-settings; the N2 pins (no settings service and a host page with
`test` but no keys each warn once; a contributed page and an own-url
store say nothing).
- service-settings: the manifest declares no action_button; the
retired-keys pin now asserts the no-handler envelope against an
undeclared control, and its re-registration case keeps a stub handler.
- service-knowledge: the mounted page has no `test` and its door answers
as an undeclared action.
## Acceptance notes
- `knowledgeTestActionHandler` leaving `@objectstack/service-settings`'
entry is a removed export of a published package; the dispatch order and
the card name the handler's move, and the changeset carries the FROM/TO
import line. Flagged for the seat with the narrowing.
- The manifest `version` stays 5: an action_button carries no key, and
the spec's bump rule is about keys.
## Verification
Two-minute check: `pnpm --filter @objectstack/knowledge-turso exec
vitest run src/__tests__/settings-contribution.test.ts` — every describe
green, including "has no Test connection" and "answers Test connection
with the Turso check".
Read first:
`packages/plugins/knowledge-turso/src/settings-contribution.ts`
(`contributeKnowledgeTursoSettings`: registration order and the new
both-keys return), `packages/plugins/knowledge-turso/src/plugin.ts`
(`init()` warn), `.changeset/37907-knowledge-turso-test-connection.md`.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
https://claude.ai/code/session_016WV4cwPhGV4g9p1BGQaZbP
---------
Co-authored-by: Claude <noreply@anthropic.com>1 parent f9c6f92 commit bbd9733
26 files changed
Lines changed: 507 additions & 303 deletions
File tree
- .changeset
- content/docs/ai
- packages
- plugins/knowledge-turso/src
- __tests__
- services
- service-knowledge/src
- __tests__
- service-settings/src
- manifests
- translations
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
36 | 36 | | |
37 | 37 | | |
38 | 38 | | |
39 | | - | |
| 39 | + | |
40 | 40 | | |
41 | 41 | | |
42 | 42 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
296 | 296 | | |
297 | 297 | | |
298 | 298 | | |
| 299 | + | |
| 300 | + | |
299 | 301 | | |
300 | 302 | | |
| 303 | + | |
301 | 304 | | |
302 | 305 | | |
303 | 306 | | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
304 | 310 | | |
305 | 311 | | |
306 | 312 | | |
| |||
0 commit comments