Skip to content

feat(studio): the knowledge source retrieval-mode picker offers the modes its store runs - #38730

Merged
objectstack-fleet[bot] merged 45 commits into
mainfrom
claude/project-thread-vj79kz-studio
Nov 30, 2026
Merged

objectstack-fleet[bot] merged 45 commits into
mainfrom
claude/project-thread-vj79kz-studio

Conversation

@objectstack-fleet

@objectstack-fleet objectstack-fleet Bot commented Nov 30, 2026 •

Copy link
Copy Markdown
Contributor

Requested by Warren · project thread

Part of #38692

Clause-②: no
Metadata-protocol: none

维护者速读

  • 管理员在 Studio 编辑知识源时,「检索方式」下拉只列出该知识源所用存储支持的方式,并写明「存储默认」是哪一种;存储未声明时显示「驱动未声明检索方式」。
  • 属于知识管理专题「一期 a:检索方式」。
  • 出错只会是下拉列错选项;保存时服务端仍会把不支持的方式拒掉,可直接撤回。
  • 无。

Stack

Base: main. Stacked on the service PR #38722 (it reads index_status's adapters and defaultAdapter, which #38722 adds) and through it on #38720; until those merge, this diff carries their commits. Lands after both and after the phase-0 ADR note (#38714).

What changes

  • The knowledge source form's source.retrieval.mode row names a new widget, knowledge-retrieval-mode (spec form hint). A host whose registry lacks the picker draws its unregistered-widget face (the JSON editor), not a select; the three static options stay because the form's generated translations carry their labels.
  • ResourceEditPage loads, only for a form that declares the widget, the store the draft binds to (its adapter, else defaultAdapter) and the modes it reports, from POST /api/settings/knowledge/index_status (knowledgeRetrieval.ts), into WidgetContext.knowledgeRetrieval.
  • The picker: the store's listed modes plus a blank choice that names the default ("Store default (Hybrid (both))"); a store that reports none offers the default alone with "驱动未声明检索方式(STORE),此项请留空。"; a mode already written that the store does not run is kept and flagged; no store answer (refused read for an author who is not a platform administrator, store not mounted, no host) offers the three modes and the save judges.
  • en and zh strings in the studio namespace; registry cases in the two widget registry tests; changeset (spec, app-shell, i18n patch).

Tests

  • New KnowledgeRetrievalModeWidget-38692.test.tsx (12): form row names the widget, labelling, offered options per store shape, undeclared sentence, flagged stored mode, fallbacks, writes and default removal, disabled states, storeRetrievalOf parsing.
  • Related UI suites: 180 files / 2,791 tests passed (widgets, metadata-form, SchemaForm, i18n, console registry parity), ResourceEditPage* 67 files / 342 passed; app-shell tsc --noEmit and tsconfig.test.json clean before the main merge; spec form test 9 passed.

Acceptance notes

Verification

  • Two-minute check: pnpm --dir ui exec vitest run packages/app-shell/src/views/metadata-admin/KnowledgeRetrievalModeWidget-38692.test.tsx → 12 passed.
  • UI gates run: check:i18n-keys, check:i18n-drift, check:i18n-dead-keys, check-sdui-manifest, ui/scripts vitest, changeset gates: all green.

Human Minimum

  • 1. Schemas start as Zod; packages/spec holds no runtime logic.
  • 2. Every name I added uses the casing for its kind.
  • 3. No formatter ran; pnpm lint passes.
  • 4. One issue, one branch off an up-to-date main, one pull request. (Stacked: see "Stack" above.)
  • 5. A change that publishes carries a changeset, and both declaration lines are filled in here and in the changeset.
  • 6. packages/spec touched: its generated artifacts are regenerated and committed.
  • 7. No hand edits to content/docs/references/, packages/*/CHANGELOG.md or content/docs/releases/.
  • 8. Title, body and comments are in English.
  • The Before Submitting list in CONTRIBUTING.md is done.

🤖 Generated with Claude Code

https://claude.ai/code/session_01JQwxbaASqBozmmj1n5tbUf

…o on its facet body

Claude-Session: https://claude.ai/code/session_01JQwxbZLuMpo8YX4ACmyoNd
Co-authored-by: Claude <noreply@anthropic.com>
…ies at their modules

Claude-Session: https://claude.ai/code/session_01JQwxbZLuMpo8YX4ACmyoNd
Co-authored-by: Claude <noreply@anthropic.com>
… mode its store does not run

The effective mode is the source's `source.retrieval.mode`, else the store's
`capabilities.retrieval.default`; every search hands it to the store as
`AdapterSearchOptions.retrieval` and logs it at debug with its origin, never in
the caller's answer. A declared mode the store does not list is refused at the
save (400 VALIDATION_ERROR, listing the store's modes), at registration when the
store already resolves, once after boot at error (`reportUnsupportedRetrieval`),
and on every search (`refused`, SERVICE_UNAVAILABLE); such a source still
indexes. `index_status` carries each source's retrieval reading and each store's
modes. The liveness row flips to live.

Claude-Session: https://claude.ai/code/session_01JQwxbaASqBozmmj1n5tbUf
Co-authored-by: Claude <noreply@anthropic.com>
…e its per-search refusal code

ADR-0161's K2 row on the adapter surface no longer says "no hybrid toggle":
the contract carries the modes an adapter runs and the mode a search runs in,
which a source declares. Protocol doc 7.1 says the same. The contract doc of
AdapterSearchOptions.retrieval names the refusal of a mode the adapter does not
list: SERVICE_UNAVAILABLE in a search's refused, VALIDATION_ERROR at save and
registration.

Claude-Session: https://claude.ai/code/session_01JQwxbaASqBozmmj1n5tbUf
Co-authored-by: Claude <noreply@anthropic.com>
…ames none binds to

Claude-Session: https://claude.ai/code/session_01JQwxbaASqBozmmj1n5tbUf
Co-authored-by: Claude <noreply@anthropic.com>
…odes its store runs

Claude-Session: https://claude.ai/code/session_01JQwxbaASqBozmmj1n5tbUf
Co-authored-by: Claude <noreply@anthropic.com>
…-vj79kz-service

# Conflicts:
#	packages/services/service-knowledge/src/knowledge-service-admission.ts
#	packages/services/service-knowledge/src/knowledge-service-search.ts
#	packages/services/service-knowledge/src/knowledge-service-sources.ts
#	packages/services/service-knowledge/src/knowledge-service-top-level.ts
#	packages/services/service-knowledge/src/knowledge-service.ts
…vice' into claude/project-thread-vj79kz-studio
@github-actions github-actions Bot added size/xl documentation Improvements or additions to documentation protocol:ai tests tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface labels Nov 30, 2026
@github-actions

github-actions Bot commented Nov 30, 2026 •

Copy link
Copy Markdown
Contributor

📓 Docs Drift Check

Nothing in this diff resolved to a documentable surface (no symbol, route or SDK anchor derived from 1 changed package(s)), so this run has no opinion about the docs.

What this run could not see

Coarse fallback — 182 page(s) merely mention a changed package (the pre-#9192 predicate, kept for the deliberately-wide backstop): node scripts/docs-audit/affected-docs.mjs --json 8a7e65b43800b06ccf16d1541b21776ffb80299a → packageMentionDocs.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#2 · os-warren · session_01JQwxbXyLoBzNYY1U8SNPFu

Contract-review-claim: session_01JQwxbXyLoBzNYY1U8SNPFu · head d651f4e · 2026-11-30T14:38Z

@github-actions github-actions Bot added size/m and removed size/xl labels Nov 30, 2026
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#2 · os-warren · session_01JQwxbXyLoBzNYY1U8SNPFu

Contract review

Served-tier: CONTRACT_REVIEW_TIER
Head-sha: d651f4e982c8c25ba7fdf0b7c7f980bb972fa4bf
Local-runs: none
Scope: packages/spec/src/ai/knowledge-source.metadata-form.ts + ui/packages/app-shell/src/views/metadata-admin/widgets.tsx, ui/packages/app-shell/src/views/metadata-admin/knowledgeRetrieval.ts, ui/packages/app-shell/src/views/metadata-admin/ResourceEditPage.tsx, ui/packages/i18n/src/namespaces/studio/en.ts, ui/packages/i18n/src/namespaces/studio/zh.ts
Security-touching: yes
Rule-change-verified: none

PR #38730 on card #38692, phase 1a item 4 of ruling record 7270218011 (the Studio form). Read: the card body and its fourteen comments, the PR body and file list, the net diff against main (merge base bb8634726e, 11 files), and the head's check-runs. main moved to 8a7e65b438 during the review (#38742, #38721, #38745): none of those commits touches a file of this diff, and the head still merges clean. The face is the schema face: packages/spec/src/ai/knowledge-source.metadata-form.ts is a non-test file of the published spec.

Security-touching: yes is meant narrowly: knowledgeRetrieval.ts sends a credentialed request to a door gated on manage_platform_settings and states what an author without it gets. The hunk changes no gate. Rule-change-verified: none: no path under .claude/.

① Derived judgments

  • Accept set: unchanged, right. FormFieldSchema.widget is z.string().optional() (packages/spec/src/ui/view.zod.ts), so the new hint is a value the form schema already took. knowledge_source itself is not touched: an author can write nothing new and nothing less.
  • Export surface: unchanged, right. knowledgeSourceForm stays one const of type FormViewParsed in packages/spec/api-surface/ai.json; the diff moves no generated artifact of the spec, and the gates that would say otherwise are green (Lint · repo & tooling gates, Spec property liveness, Type Check · source gates).
  • Published form document: changed. The value of the exported knowledgeSourceForm, which metadata-form-registry.ts serves as the knowledge_source form, gains widget: 'knowledge-retrieval-mode' on the source.retrieval.mode row. That is a change to what every host of the form is told to draw. It is the reason this file is a schema face, and it is judged in ④ (S1).
  • Widget registry: one key added, right. WIDGETS and WIDGET_LABELLING each gain knowledge-retrieval-mode (control), and the three registry test tables gain its row. There is one registry in the tree (widgets.tsx); no second host of the form exists in this repository.
  • WidgetContext.knowledgeRetrieval: an optional member, right. A host that feeds none reads as not asked, and the picker offers the three modes.
  • i18n: seven keys in en and zh, right. The zh sentence is the ruling's 「驱动未声明」: 「驱动未声明检索方式({store}),此项请留空。」
  • Check-runs on the head: 73 rows, 61 success, 12 skipped by their selectors, 0 failed, 0 pending. First read 2026-11-30T14:44Z (25 rows pending), polled every 60 s, concluded at the read of 15:09:57Z. Success: Lint & Repo Gates and all eight Lint · rows, Lint UI, TypeScript Type Check and all four Type Check · rows, Type Check UI, Build Core, Build UI Deps, Build & E2E UI, Live E2E UI, Test Core and its 12 shards, Test UI and its 16 shards, Dogfood Regression Gate, Check Changeset, Check PR Size, Governed Surface Queue Guard, Spec property liveness, PR-body guards, Flag docs affected by code changes, Plan Test Core shards, Plan Test UI shards, Auto Label, filter. Skipped: Build Docs, UI Published Artifacts, Dogfood Verify CLI, Temporal Conformance, the three opt-in rows, Queue verdict, Borrowed queue verdict, Schedule gate, and two unexpanded matrix template rows. The earlier red Check Changeset (PR comment 7273119352, the stack carrying feat(spec): a knowledge source declares its retrieval mode; an adapter reports the modes it runs #38720's shard) is gone now that feat(spec): a knowledge source declares its retrieval mode; an adapter reports the modes it runs #38720 is on main. The RecordDetailView.tsx type error the PR body reports from a stale local build is not on the head: Type Check UI is success.

② Semver level

.changeset/38692-studio-retrieval-mode-picker.md: @objectstack/spec, @object-ui/app-shell and @object-ui/i18n, each patch; Clause-②: no; Metadata-protocol: none. Check Changeset is success.

Clause-②: no is right, and it does not mean "no published surface moved". Clause ② asks whether the change widens or narrows what a published package accepts or exposes. It does neither: the form schema's accept set, the knowledge_source accept set and the exported names and types are all as they were. What moves is the content of a published constant, which is why @objectstack/spec is rightly in the changeset at patch, and why the file still earns this tier's review. The consequence of that content for a host is S1 below; it is a rendering matter and not a clause-② one. Metadata-protocol: none is right for the same reason.

The i18n and app-shell patches match the diff. packages/platform-objects is rightly absent: the row's three option labels are unchanged, so its generated form translations do not move.

③ Boundary flags

SQL push-down. The diff adds no query, no id materialisation and no join. The one new read is an HTTP call to an existing settings action. Nothing to judge.

Author. The PR's user.login is objectstack-fleet[bot]; nothing written off the relay.

Dev flags. Report 7272829384 carries no open_questions for this PR. The PR body's acceptance notes:

  1. An author without manage_platform_settings gets the three-mode fallback, never an error card: right. index_status runs under the knowledge namespace's write permission, manage_platform_settings (knowledge-build-actions.ts, module header); the route answers 403 SETTINGS_FORBIDDEN; fetchStoreRetrieval throws on a non-ok answer; the picker treats every state but a loaded, mounted store as "offer the three" and the save judges (refusal point 1, 400 VALIDATION_ERROR). The same holds for a cloud-managed environment that refuses the action.
  2. "The draft's adapter re-reads the store on change (one request per distinct value)": true, and it is N1.
  3. Stacked on feat(service-knowledge): read a source's retrieval mode and refuse a mode its store does not run #38722 and feat(spec): a knowledge source declares its retrieval mode; an adapter reports the modes it runs #38720: both are on main now, and the net diff is this PR's own 11 files.
  4. Landing after the phase-0 note: docs(adr): ADR-0161 dated revision note — knowledge source declares retrieval mode (ruling on #38692) #38714 merged at 09:30Z.

④ Design judgment

packages/spec/src/ai/knowledge-source.metadata-form.ts against ruling section 四 (「Studio 下拉只列驱动支持的方式,「默认」一项标明是哪种」), section 二 (「没声明的驱动…Studio 显示「驱动未声明」」) and its first consumer, SchemaForm.

  • The row names the widget on the right path (source.retrieval.mode, a sub-field of the retrieval composite), formDeclaresWidget descends into composite sub-fields, and the composite renderer hands widgetContext down. The first consumer is reached.
  • "Which modes the store runs is judged at save either way": true. admitAuthoredSource refuses with 400 VALIDATION_ERROR whatever the form offered.
  • S1 (should-fix) — the jsdoc sentence "the three options are what a host without that picker offers" is false against the code it describes, and the row regresses exactly that host.
    • SchemaForm's face resolution reads a widget hint before it reads options: a name that is not in WIDGETS, on a scalar, and not one of the six pass-through names (text, textarea, number, switch, select, json) resolves to the raw-json face with the hint, the "announced fallback for an unregistered widget name". The builtin select that reads options is the step after, and is never reached.
    • So a host whose registry lacks knowledge-retrieval-mode (any @object-ui/app-shell before this PR, read on main) draws a JSON text area with the fallback notice for this row. Before this line the same host drew a select of the three modes.
    • In this repository the two packages ship in one fixed group, so the exposure is a mixed install or another renderer of the published form. That is why this is not a must-fix.
    • With the picker registered, the row's options are read by no renderer either: the picker takes its modes from RETRIEVAL_MODES and its labels from the studio namespace.
    • Fix, either one: say what is true (a host without the picker falls back to its unregistered-widget face; the options are kept for the form's generated translations, or dropped), or make the sentence true in the consumer. The PR body's "the three static options stay for a host without the picker" says the same thing and follows the fix.

widgets.tsx, KnowledgeRetrievalModeWidget, sentence by sentence against the ruling and its own header.

  • Store reports modes: those modes plus a blank choice labelled with the default ("Store default (Hybrid (both))"). Section 四, met.
  • Store mounted and reports none: the default alone, and the 「驱动未声明」 sentence naming the store. Section 二, met. A mode already written is kept as its own flagged option, so the author sees what the save refuses and the picker never rewrites the draft by itself.
  • Store not mounted, read refused or failed, or no host: the three modes. Nothing is hidden that the save would take.
  • Writes: a mode writes its name, the blank choice writes undefined. retrieval: {} is allowed by the spec ("declares nothing and reads as the key left out"), so the leftover empty group saves.
  • Loading and read-only: a disabled control in both. No hook follows the early return.
  • Tried to break it: an adapter typed half-way resolves to "not mounted" and the three modes, never to the default store's modes; a store whose report lists modes but no valid default is read as undeclared, which under-offers and never over-offers; a stale answer for an earlier adapter is dropped by usePickerLoad's cancel flag.

knowledgeRetrieval.ts against index_status on main (knowledge-build-actions.ts).

  • details.adapters is { id, retrieval? } per mounted adapter and details.defaultAdapter is the store a source that names none binds to: the reader's shape is the service's. The envelope is unwrapped for both the success/data body and the bare result. A body with no adapter list throws, so a wrong shape is a failed load and never an empty one.
  • "Gated on the settings namespace's write permission": the gate is manage_platform_settings, as the header's next clause says.

ResourceEditPage.tsx. The load is gated on the form declaring the widget, in the shape of the ref-multi:permission loader beside it. See N1.

en.ts, zh.ts. The seven strings agree with the row's option labels and with the ruling's words.

  • N1 (nit) — the loader is keyed on the draft's adapter, and adapter is a free-text row, so every keystroke there sends a fresh POST index_status with the same {} body and flips the mode control to its disabled loading state. The answer does not depend on the adapter (only storeRetrievalOf does), and the action reads the index state and sync state of every source. One load with the store derived in a memo gives the same picker. No effect on correctness or the contract; a follow-up card, not this head.
  • N2 (nit) — the picker's header says "those, in the spec's order", and the code offers the store's reported order (report.modes.filter(isMode)). The same today for turso and pgvector. Comment only.

No must-fix. One should-fix, S1, open on this head.

Implemented-by: claude/project-thread-vj79kz-studio
Reviewed-by: session_01JQwxbXyLoBzNYY1U8SNPFu

VERDICT: PASS

The spec form's jsdoc said a host without the knowledge-retrieval-mode
picker offers the row's three options. SchemaForm reads the widget hint
before options, so such a host draws its unregistered-widget face (the
JSON editor). The sentence now says so, and why the options stay (the
form's generated translations carry their labels). The picker's header
now says it offers the store's reported order, which is what it does.

Claude-Session: https://claude.ai/code/session_01JQwxbaASqBozmmj1n5tbUf
Co-authored-by: Claude <noreply@anthropic.com>
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#2 · os-warren · session_01JQwxbXyLoBzNYY1U8SNPFu

Contract-review-claim: session_01JQwxbXyLoBzNYY1U8SNPFu · head b93333c · 2026-11-30T15:17Z

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#2 · os-warren · session_01JQwxbXyLoBzNYY1U8SNPFu

Contract review

Served-tier: CONTRACT_REVIEW_TIER
Head-sha: b93333cd06a8c9bd28751d3b16597a512cec7fb2
Local-runs: none
Scope: packages/spec/src/ai/knowledge-source.metadata-form.ts + ui/packages/app-shell/src/views/metadata-admin/widgets.tsx, ui/packages/app-shell/src/views/metadata-admin/knowledgeRetrieval.ts, ui/packages/app-shell/src/views/metadata-admin/ResourceEditPage.tsx, ui/packages/i18n/src/namespaces/studio/en.ts, ui/packages/i18n/src/namespaces/studio/zh.ts
Security-touching: yes
Rule-change-verified: none

Delta round on PR #38730 (card #38692), after record 7282627939 on head d651f4e982c8c25ba7fdf0b7c7f980bb972fa4bf. Read: the diff of that head against this one, the PR body as edited, and this head's check-runs. Everything the first record judged and this delta does not touch stands as judged there. Security-touching: yes is carried from the first record for the same hunk (knowledgeRetrieval.ts); the delta itself teaches no security behaviour.

① Derived judgments

  • The delta is one commit, b93333cd06, two files, +7 −3, comments only. packages/spec/src/ai/knowledge-source.metadata-form.ts: the jsdoc bullet for source.retrieval.mode. ui/packages/app-shell/src/views/metadata-admin/widgets.tsx: one line of the picker's header comment. No statement of code, no test, no string and no changeset moved; the form row itself (widget, options, helpText) is byte for byte as reviewed.
  • Nothing else moved. The merge base is still bb8634726e; no merge of main came with the delta. main is at c4472c8631 at the last read; the first record's reads of the cited code were at 8a7e65b438.
  • Accept set and export surface: unchanged by a comment, right.
  • Check-runs on this head: 77 rows, 63 success, 14 skipped by their selectors, 0 failed, 0 pending. Polled every 60 s from 2026-11-30T15:19Z, concluded at the read of 15:47:01Z. Success includes Lint & Repo Gates, Lint UI, TypeScript Type Check, Type Check UI, Build & E2E UI, Test Core with its 12 shards, Test UI with its 16 shards, Check Changeset, Governed Surface Queue Guard and both PR-body guards rows.

② Semver level

Unchanged and still right: @objectstack/spec, @object-ui/app-shell and @object-ui/i18n at patch, Clause-②: no, Metadata-protocol: none. A comment publishes nothing more. Check Changeset is success.

③ Boundary flags

SQL push-down. Nothing added.

The dev's choice on the first finding: accepted. The record offered two fixes, the true sentence or a changed consumer. The dev took the first and gave reasons for not taking the second: an @object-ui/app-shell already published cannot be changed by this PR, and a fall-through to the options select would change the unregistered-widget face for every widget name, which the #9931 tests pin. Both hold. The regression for a host without the picker remains as the first record sized it (a mixed install, or another renderer of the published form); it is now stated in the file that causes it, and it is not a must-fix for the reason given there.

PR body. It now says the same as the jsdoc: a host whose registry lacks the picker draws the JSON editor, and the options stay for the generated translations.

④ Design judgment

packages/spec/src/ai/knowledge-source.metadata-form.ts. The new sentences, each against the code:

  • "A host whose widget registry lacks that picker draws its unregistered-widget face for this row (the JSON editor with its notice), not a select: the hint is read before options." True of SchemaForm's face resolution: an unregistered, non-pass-through name on a scalar resolves to raw-json with the hint, before the builtin chain that reads options.
  • "The three options stay because the form's generated translations carry their labels." True: packages/platform-objects/src/apps/translations/en.metadata-forms.generated.ts holds the three labels at this head.
  • "no renderer reads them while the hint is set." True: the picker takes its modes from RETRIEVAL_MODES and its labels from the studio namespace.

widgets.tsx. "those, in the order it reports them" is what storeRetrievalOf hands over.

S1: closed
N2: closed

N1 (the loader keyed on the free-text adapter) is left as written, for a follow-up card. It has no effect on correctness or the contract.

No must-fix, no should-fix.

Implemented-by: claude/project-thread-vj79kz-studio
Reviewed-by: session_01JQwxbXyLoBzNYY1U8SNPFu

VERDICT: PASS

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#2 · os-warren · session_01JQwxbXyLoBzNYY1U8SNPFu

维护者速读

  • 这是什么:知识管理专题「一期 a:检索方式」在 Studio 里的那一块。编辑知识源时,「检索方式」不再是写死的三个选项,而是一个下拉框,只列出这个知识源所用存储真正支持的方式(turso 和 PostgreSQL 都支持三种,默认两者结合)。拿不到存储信息时(比如作者没有平台设置权限),会退回显示全部三项并给出说明。
  • 风险:只是界面加了一个控件,规格里只多了一行控件提示,没有改任何可接受的值。一个已知的小问题:如果新规格配了旧版 Studio,这一栏会显示成 JSON 编辑框而不是下拉框;因为规格和 Studio 同版本发布,正常安装碰不到。可以直接撤回。
  • 要你做什么:不用做什么,按普通队列自动合并。

席位核对

ACCEPT · L1 · area o2-A · Head-sha b93333cd06a8c9bd28751d3b16597a512cec7fb2 · 2026-11-30T15:49Z

  • Contract review at CONTRACT_REVIEW_TIER (hit: packages/spec/src/ai/knowledge-source.metadata-form.ts): round 7282627939 PASS with S1 open; delta 7283618223 PASS at this head, S1 and N2 closed, no must-fix, no should-fix. N1 (the index_status request re-sent per keystroke of adapter) is left for a follow-up card.
  • S1 was closed by stating the mixed-version behaviour in the jsdoc, not by changing the unregistered-widget fallthrough, which the fix(gate): check-role-word's green line reports what it READ, not just the ledger #9931 tests pin for every widget name. Accepted: an already-published app-shell cannot be changed here, and spec and app-shell ship in one fixed group.
  • Clause-②: no · Metadata-protocol: none: the form row gains a widget hint, and widget is already z.string(), so no accept set moves and no export or type changes. Changeset: @objectstack/spec patch plus the app-shell and i18n packages.
  • Security-touching: yes on the record (the picker sends a credentialed request to index_status, gated on manage_platform_settings, and describes the fallback for an author without it). Seat decision: no security label, because the PR calls an existing gated route and changes no gate or permission.
  • check-governed-merges: NOT governed, 437 lines. Checks at this head: 63 success, 14 skipped, 0 failed, 0 pending; the two opt-in dogfood battery jobs skip as designed, and the battery is not owed.
  • Landing: Tier S, --land. Part of #38692.

@objectstack-fleet
objectstack-fleet Bot marked this pull request as ready for review November 30, 2026 15:50
@objectstack-fleet
objectstack-fleet Bot added this pull request to the merge queue Nov 30, 2026
Merged via the queue into main with commit 643519b Nov 30, 2026
78 checks passed
@objectstack-fleet
objectstack-fleet Bot deleted the claude/project-thread-vj79kz-studio branch November 30, 2026 16:18
Nenzyz pushed a commit to Nenzyz/objectstack that referenced this pull request Dec 1, 2026
…the knowledge service reranks after the permission re-check (objectstack-ai#38764)

<!-- claude-projects-attribution: {"github_login":"os-steve"} -->
_Requested by **Steve** · [project
thread](https://claude.ai/code/project/chan_01FdL1XeUyvVNxLreh3F4Qi9?thread=cmsg_01FdL1XeUyvVNxLreh3F4Qi9DAwBxBGNv4CexdUyBYJXSw)_

Fixes objectstack-ai#38760
Refs objectstack-ai#38750

Clause-②: no
Metadata-protocol: none

## 维护者速读

- 用户能看到什么变化:用户无感;知识平台边界那份架构决策记录里追加一条 2026-11-30
的说明,写明知识源可以声明自己的检索结果要重排、用哪个重排模型由部署方配置、由知识服务在权限复核之后统一重排,不改任何代码。
- 为什么做:这是知识检索重排专题的第一步,把你当天说的「有就用」和「开了开关,一律重排」写进决策记录,后面几步的实现才有依据。
- 出错会怎样:说明里若有和你的裁决不一致的句子,后面做实现的人会照着错的文字去做;它只是一处文档追加,可以直接撤回,不影响任何在运行的系统。
- 要你做什么:请你审阅并批准这条说明;它改的是受管的决策记录,你批准它,由知识服务在权限复核之后重排这一条就算正式记下,不再另开决策卡。

## What changes

One file, add-only.
`docs/adr/0161-knowledge-platform-boundary-platform-owns-assembly-sync-split-record-return-knowledge-source-is-a-governed-type.md`
gains its sixth dated note: 28 lines added, none changed and none
removed (614 lines to 642).

The note records the maintainer's rulings of 2026-11-30 on the epic for
knowledge retrieval rerank. A knowledge source may declare that its
searches are reranked. The deployment configures the reranker, and no
source names a model. The knowledge service reranks, after the
permission re-check and before the cut to `topK`. The adapter contract
does not change.

Five insertions, in the form the five earlier notes of this record use.
Line numbers are at head `6552e290`.

| Lines | Where | What is added |
|---|---|---|
| 24 | Header, after the `**Amended**` line of the fifth note | A sixth
`**Amended**` line, dated 2026-11-30. It names what the note amends, the
maintainer's words with their times, and ruling record `7276086125`. |
| 142 to 161 | K1, under "What follows from the two lists" | The note
itself: an opening paragraph, 16 bullets and a last paragraph. |
| 186 | K2, under "The rule for all of them" | A cross-reference. Three
rows of the table name rerank and are read with the note. |
| 281 | K4, in the cross-reference block that is already there | A
cross-reference. One more source key is declared,
`source.retrieval.rerank`. |
| 468 | K8, under the note of 2026-11-30 | A cross-reference. Rule 4 and
three sentences of that note are read with the note. |

### Each amended place

No existing line is edited. This record's convention is add-only, so the
note quotes the old sentence and states how it reads from the merge. The
two sentences marked "new sentence" are the note's own wording. Every
other entry in the third column is the note's reading of a text it
leaves as written.

In the last column, "body 1" to "body 3" are items 1 to 3 under
"Rulings" in the body of the epic, which record the maintainer's 「有就用」
(10:13Z) and 「所以还是应该按照主流系统的做法,开了开关,一律重排」 (10:37Z). "D1" to "D4" are the
first four of the six decisions of the epic that he answered with 「全部同意」
(10:47Z), as ruling record `7276086125` on the epic records them.

| Place, with its line on `main` at `acf3b33e` | Old sentence | New
sentence or reading | Ruling |
|---|---|---|---|
| K1, the "Rerank" row of the adapter's table (104) | "Whether a second
model reorders candidates, and which." | Reading: neither is the
adapter's. Whether: a knowledge source declares it. Which: the
deployment configures the reranker, and no source names a model. The
knowledge service reranks, after the permission re-check and before the
cut to `topK`. The row keeps the adapter's own search. | body 1, D1 |
| K1, the second sentence of the list (112), as the note of 2026-11-29
left it (119) | "The service does not choose a model, compute a vector,
compute a score for a candidate, rerank or parse a file. It may re-order
the hits it is about to answer by the ordering their source declares
against a fact about the caller that the platform resolves, by position
alone, and it changes the order the adapters answered in no other way."
| New sentence: "The service does not choose a model, compute a vector,
compute a score for a candidate or parse a file. It may re-order the
hits it is about to answer in two ways, and it changes the order the
adapters answered in no other way: by the ordering their source declares
against a fact about the caller that the platform resolves, by position
alone; and by reranking them, where their source declares it and the
deployment has configured a reranker, after the permission re-check and
before the cut to `topK`." | D1, body 1 and 3 |
| The note of 2026-11-29, one sentence (119) | "This is not rerank,
which stays the adapter's in the table above: the service reads no
passage text and calls no model to do it." | Reading: the re-order by a
declared ordering is still not rerank, and the service still reads no
passage text and calls no model to do it. Rerank no longer "stays the
adapter's". To rerank, the service hands the question and passage text
to a model. | D1 |
| The title (1), the D1 key-words line (9) and TL;DR item 1 (41) | Each
says that adapters own rerank. | Reading: the word "no longer covers
whether the hits of a search are reranked, by which model, or by whom,
and it covers only what an adapter does inside its own search". | body
1, D1 |
| K2, three rows (149, 153, 157) | "Engines are integrated for
embedding, hybrid retrieval, rerank and file parsing."; the "no rerank"
of the §3.4 row; "Embedding calls, vector storage, hybrid retrieval and
rerank stay the adapter's." | Reading: the first stays true as a
sentence, because a reranker is an engine the deployment brings, and it
is the knowledge service that calls it. The §3.4 row keeps its "no
rerank", because the adapter contract carries none. Of the third, the
first three stay the adapter's and reranking is the service's. Each text
is rewritten by the PR whose code makes the new sentence true. | D1 |
| K8, rule 4 (417), as the note of 2026-11-30 left it (422) | "Which
provider, which key, how to batch, rerank toggles and parser options
stay in the adapter's own plugin options. Hybrid weights are declared by
the knowledge source. A parameter of one search request is not
configuration." | New sentence: "Which provider, which key, how to batch
and parser options stay in the adapter's own plugin options. Hybrid
weights are declared by the knowledge source, and so is whether its
searches are reranked. The reranker is the deployment's configuration,
and no source names a model. A parameter of one search request is not
configuration." | body 1 |
| The note of 2026-11-30 under K8, three sentences (422, 438) | 「K8 第 4
条:「hybrid weights」改划给知识源声明;rerank toggles、parser options 照旧留在驱动。」; under
「永远不进知识源协议」, 「融合算法及其常数、重排、分数阈值、分词器。平台以后如果统一做重排,那是知识服务的配置。」; "Rerank, a
score threshold, a tokenizer and the fusion algorithm with its constant
never enter the source (section 六, above)." | Reading: "Of rerank, a
switch enters the source and nothing else does: no source names a
reranker or a model. That switch is not an adapter's option. The fusion
algorithm with its constant, a score threshold and a tokenizer still
never enter the source, and parser options stay the adapter's." The
sentence 「平台以后如果统一做重排,那是知识服务的配置。」 stands. | body 1; these words are
later than the rulings that note records (06:00Z to 07:57Z) |

### What the note states beside the amended readings

Each is quoted in the note from the words named here.

- **The source key.** `source.retrieval.rerank`, an optional boolean, in
the `source.retrieval` group the fifth note declares (body 1).
- **No reranker is configured.** The search runs normally, the report
marks the source with the reason `no_reranker` in `notReranked`, and
saving or publishing the source shows a notice. It is never a refusal
and never fewer hits (body 2; the two names are the ruling record's).
- **A reranker is configured and the source declares it.** Every search
is reranked. Only 0 or 1 candidate makes no call and sets no marker. At
most 50 passages are sent per search (body 3).
- **A configured reranker fails or times out.** The adapter order is
kept, the source is marked `failed`, there is one attempt under a limit
of 3 s, and it is not a coded refusal (D2).
- **One model and one wire format for v1** (D3). The note names neither.
- **A hosted deployment.** Hosted reranking comes after row 6 of the
epic shows a gain, or a hosted customer asks. Until then a hosted source
that declares rerank is searched normally and marked (D4).

Left to the rows of the epic by name, under "Not in this note": the
hosted recipient and its charging (D5, which is not decided); how a
deployment states its reranker and what the knowledge service calls it
through (rows 2 and 3); how many candidates are reranked under the
ceiling of 50; how a rerank and a declared `affinity` follow one
another; how the hits of several sources stand against each other; what
`notReranked` looks like on the report and in the answer of
`search_knowledge`; how the notice is shown; a per-search argument on
the tool.

No file under `packages/`, `content/`, `skills/` or `ui/` changes, and
no other ADR does. The note declares; it builds nothing.

## Why

The epic puts the record before the code. Its row 1 is this note, and
the first decision of ruling record `7276086125` says of it: "Accepting
row 1's ADR-0161 note records it; no separate decision card." Until this
note merges, the ADR gives rerank to the adapter in every place the
table above lists, and rule 4 of K8 keeps "rerank toggles" in the
adapter's plugin options. Row 2 of the epic brings the key with its
reader, and it needs the record to say so first.

## Tests

The diff touches no package, so there is no build closure to make and no
package test or type-check owed. What was measured on the text itself,
at head `6552e290`:

- **Quotations.** A script compared every quoted span of the 28 added
lines with its source, read over REST or from the ADR at the base. The
added text holds 16 spans in corner brackets: each is a verbatim
substring of the body of the epic, of ruling record `7276086125` or
`7276461244`, or of the ADR at the base where it already quotes the
record of the fifth note. 0 mismatches. It holds 50 spans in double
quotation marks: 48 are verbatim in one of those sources, and 2 are the
note's own wording, which are the two "new sentence" entries of the
table above.
- **Bytes.** The added lines hold no raw control byte, no HTML comment
and no model identifier.
- **The reading of `main` the last paragraph of the note cites**, taken
at `acf3b33e31`.
`packages/services/service-knowledge/src/knowledge-service-search.ts#searchByKey`
re-checks the hits as the caller (`applyPermissionFilter`), orders them
by a declared `affinity` (`affinityOrderFor`) and cuts them to `topK`,
with no rerank between. Tests aside, in
`packages/services/service-knowledge/src` and the `src` of
`knowledge-memory`, `knowledge-pgvector` and `knowledge-turso`, the word
`rerank` is on one line, which is the class note K2 lists. The control
word `embed` is on 412 lines, so the search reads those directories.
- **Anchors.** Every code citation in the note is a path with a symbol,
never a line number, and `check:adr-symbol-anchors` reads all of them
(its verdict line is below).

No ablation: the diff changes no behaviour a test pins.

## Acceptance notes

**Against the card's acceptance lines.**

1. "Every amended sentence agrees with the design on objectstack-ai#38750 (option B)
and with rulings D1 to D4." The table above gives each amended place
with the ruling it rests on.
2. "No sentence promises row 2 behaviour that the epic does not rule."
The note states no pool size, no widening factor, no order between
rerank and `affinity`, no settings key name and no shape for the
reranker contract. Each of these is named under "Not in this note" and
left to its row.
3. "The `Amended` line is dated." Line 24, dated 2026-11-30.
4. "The note does not change any other ADR. It adds no code." One file
changes.

**Five things for the approver to weigh.** The note marks no ◆, because
each of these rests on a text this record or the epic already has. They
are the places where the wording is the note's and not a quotation.

- a. **What the "Rerank" row keeps.** The note says the row keeps "the
adapter's own search", and rests that on two sentences this record
already has: "how candidates are found" (the "Hybrid retrieval" row) and
"Changing the adapter changes how candidates are found and ranked"
(Consequences).
- b. **"The declaration is not silent (ADR-0078)".** A source that
declares rerank where no reranker is configured is accepted and its
search is answered. The note reads body 2 against ADR-0078: each such
search says that its source was not reranked, and the author is told on
save and on publish.
- c. **Nothing is registered in K8.** The note says that the reranker's
contract, client and settings (rows 2 and 3 of the epic) are not members
of the adapter contract. It rests that on K8's own definition, under
"What counts as a member": a member is what an adapter author must read,
and no adapter reads these.
- d. **A cross-reference under K4.** The card's list of places does not
name K4. This record gives every new source key a cross-reference there,
as the fifth note did for `source.retrieval`, so one was added. It
changes no sentence of K4.
- e. **The K2 rows are read through a cross-reference and are not
edited.** Draft objectstack-ai#38720 edits the K2 row at line 153 in place, with the
code that makes its new sentence true. This note's sentence about that
row, that it keeps its "no rerank", holds for the row as it is on `main`
and as objectstack-ai#38720 leaves it.

**The names D1 to D6.** This record already writes "ruling D1", "ruling
D2" and "ruling D5" for rulings of its own. The note therefore writes
the six decisions of the epic as `objectstack-ai#38750 D1` to `objectstack-ai#38750 D6`, and says in
its opening paragraph that none of them is a ruling of this record. It
writes `row N of objectstack-ai#38750` for the same reason.

**The card's line numbers, read on `main` at `acf3b33e`.** All twelve
lines the card names (1, 9, 41, 104, 112, 119, 149, 153, 157, 417, 422,
438) exist and carry the text the card expects. Two labels are
exchanged: the card gives 422 for rule 4 of K8 and 417 for the note of
2026-11-30. On `main`, rule 4 is line 417, and line 422 is that note's
bullet "Rule 4, amended", which carries 「永远不进知识源协议」. Line 438 is that
note's bullet "Not in this note". No line moved.

**Overlap with the open drafts on this file.** `node
scripts/pm/overlap-check.mjs --repo=objectstack-ai/objectstack`, run at
`6552e2905b` before the push, printed `VERDICT clean exit 0`. It read
`origin/main` at `acf3b33e31` and the six open heads that change this
file (objectstack-ai#38745, objectstack-ai#38732, objectstack-ai#38730, objectstack-ai#38722, objectstack-ai#38721 and objectstack-ai#38720), and each
merges cleanly with this branch. The order expected exit 1 against
objectstack-ai#38720. It is clean because the note is add-only and inserts at none of
the lines objectstack-ai#38720 changes. It was run again before this pull request
opened, with `origin/main` at `8426fa0c89` (one commit later, which does
not change this file): the same six heads, each merging cleanly,
`VERDICT clean exit 0`. The landing order is the card's: after objectstack-ai#38720.

**Not done here.** `content/docs/protocol/knowledge.mdx` and the class
note of `KnowledgeService` are rewritten by the rows whose code makes
their new sentences true. There is no changeset: `docs/adr/` is
published by no package, and the PR carries `skip-changeset`.

## Verification

**Read first, by risk.** One file changes, so these are its three hunks
of most risk.

1. Line 146, the bullet "The sentence of the list, amended again". It is
the one sentence that gives the knowledge service a second way to
re-order hits.
2. Line 156, the bullet "Rule 4 of K8, amended again". The new rule 4 is
composed by this note from body 1.
3. Line 150, the bullet "No reranker is configured". It holds the
reading against ADR-0078 (item b above).

**Two-minute check.** One click: open the "Files changed" tab. Expected:
one file, +28 −0, five hunks, every changed line an addition.

**Landing.** `docs/adr/**` is a governed surface. This is opened as a
draft. The hand-off to the maintainer is the seat's, and the approval is
the maintainer's. Nothing here requests a reviewer, marks it ready or
arms auto-merge.

**CI.** NOT MEASURED: the check-runs of this pull request, reason: it
did not exist when this body was written. The report on the card carries
the one reading taken after it opened.

**Gates, run locally on head `6552e290`.** `node
scripts/pm/dispatch-gates.mjs --commands --repo
objectstack-ai/objectstack` derived 21 commands from the diff. All 21
ran in the foreground, each exit code was captured before any pipe, and
all 21 are exit 0. The reconciliation:

```text
Run reconciliation — 21 derived, 21 run, 0 NOT-MEASURED, 0 UNRUN.
✓ dispatch-gates --ran: 21 derived famil(ies) accounted for — 21 run, 0 NOT-MEASURED (a DERIVED zero — all 21 recorded an exit code and none of them is 3).
```

<details>
<summary>The 21 commands and their exit codes</summary>

```text
node scripts/check-adr-links.mjs :: exit 0
node scripts/check-adr-links.mjs --self-test :: exit 0
node scripts/check-closing-keyword-parity.mjs :: exit 0
node scripts/check-closing-keyword-parity.mjs --self-test :: exit 0
node scripts/check-comment-mask-corpus.mjs :: exit 0
node scripts/ci/plan-test-core-shards.mjs --self-test :: exit 0
pnpm --filter @objectstack/lint run check:doc-formula-expressions :: exit 0
pnpm check:adr-anchors :: exit 0
pnpm check:adr-index :: exit 0
pnpm check:adr-symbol-anchors :: exit 0
pnpm check:ci-filter-parity :: exit 0
pnpm check:closed-ceremony-text :: exit 0
pnpm check:cross-package-test-inputs :: exit 0
pnpm check:doc-authoring :: exit 0
pnpm check:driver-memory-census :: exit 0
pnpm check:gitlink-declared :: exit 0
pnpm check:nul-bytes :: exit 0
pnpm check:pm-governed-merges :: exit 0
pnpm check:pm-prior-rulings :: exit 0
pnpm check:refd-timer-probe :: exit 0
pnpm check:watch-hint-literal :: exit 0
```

</details>

<details>
<summary>Verdict lines of the gates that read the ADR</summary>

```text
✅ check-adr-links: 1284 relative link destination(s) under docs/adr/ resolve
✅ check-adr-symbol-anchors: 4574 anchors across 165 records resolve — 1704 symbol (1675 declaration, 29 literal), 2818 file-level, 52 cross-repo, 6 exempt, 128 continuation. [cut here: the rest of the line is a note on what the count is not]
adr-index --report: OK — docs/adr/README.md is current, every record parsed, self-test 60 assertions green. Report-only: this line never reds the step.
check-nul-bytes: OK (scanned 29002 text file(s) -- 29002 tracked, 0 untracked-not-ignored; skipped 101 binary; no raw ASCII control bytes).
✓ doc authoring guard: 24253 customer-facing string(s) across 1963 spec sources clean — no internal issue-id references (message 3603 · strictObject 5655 · tombstone 1510 · describe 12078 · functionBuilt 529 · functionDeclared 878).
```

</details>

<details>
<summary>One gate first read NOT MEASURED, then green</summary>

At the first head, `151609a7`, `pnpm --filter @objectstack/lint run
check:doc-formula-expressions` answered exit 3, PREREQUISITE NOT MET:
two workspace packages it imports were not built in the fresh worktree.
That is a run that measured nothing, not a red gate. The two packages
were built under the shared verify lock, and the gate was run again (the
lock's verdict line is cut after the wait):

```text
VERDICT command-exit 0 · held the lock 23s · waited 167s (2m47s)
pnpm --filter @objectstack/lint run check:doc-formula-expressions :: exit 0
```

At the final head it ran with the other 20 and answered exit 0.

</details>

**Left to CI, not run locally.** The repo-wide lint, the type-check
lanes, the test shards, and the families `dispatch-gates` prints outside
the derived list. The commit trailer gate ran in the pre-push hook on
the pushed range and is green.

## Human Minimum

- [x] 1. No schema and no code changes.
- [x] 2. No new name is declared in code. The names the note writes are
the rulings'.
- [x] 3. No formatter ran. `pnpm lint` is NOT MEASURED locally: the
repo-wide scan is CI's, and the diff is one Markdown file.
- [x] 4. One card, one branch off `main` at `acf3b33e31`, one pull
request.
- [x] 5. Nothing publishes, so no changeset; both declaration lines are
filled in above.
- [x] 6. `packages/spec` is not touched.
- [x] 7. No edit to `content/docs/references/`, to a `CHANGELOG.md` or
to `content/docs/releases/`.
- [x] 8. Title, body and comments are in English. The maintainer's
Chinese words are quoted unchanged, and the 维护者速读 section is in Chinese
as the fleet's rule asks.
- [x] The *Before Submitting* list is done for what a docs-only diff
reaches; `pnpm lint` is as item 3 says.

---
_Generated by [Claude
Code](https://claude.ai/code/session_01ADHkmPDtfMCw4FJfyFfQ7v)_

<!-- signed: repo:objectstack#3 · os-steve ·
session_01ADHkmPDtfMCw4FJfyFfQ7v -->

---------

Co-authored-by: Claude <noreply@anthropic.com>
Nenzyz pushed a commit to Nenzyz/objectstack that referenced this pull request Dec 1, 2026
…s five records) (objectstack-ai#38774)

<!-- claude-projects-attribution: {"github_login":"os-support-ai"} -->
_Requested by **Yibo Wang** · [project
thread](https://claude.ai/code/project/chan_01BVUyyPie8gHwoPM18iABwB?thread=cmsg_01BVUyyPie8gHwoPM18iABwBHuLciv5hYVYUu4pypDP48J)_

Part of objectstack-ai#38438

Clause-②: no
Metadata-protocol: none

This pull request carries seven of the card's nine rows. The two
ADR-0161 rows stay on the card; see "Rows not carried".

## 维护者速读

- 用户能看到什么变化:用户无感;只在五份设计记录里补了七条带日期的说明,写明主线现在实际怎么做,原有的决定文字一个字没动。
- 为什么做:属于「每周设计记录修订」滚动清单(11 月 29
日这一周);清单每一行指出一处「记录写的和主线不一致」或「记录留给某项工作回答、那项工作已经做完」,这次把代码已在主线的七行一并补齐。
- 出错会怎样:最坏是某条说明写得不准,照着设计记录干活的人会被带偏;纯文档、只增不删,可以直接撤回,不影响任何功能。
- 要你做什么:请审这七条说明并批准一次(设计记录须由你本人批)。

## What changes

Five ADR files gain seven notes dated 2026-11-30. Every diff line is an
addition: 62 lines added, 0 removed. No original decision text is
rewritten, and no decision changes. Each note follows the note
convention its own record already uses, and each says that the passage
it is read with is left as written.

Each row's "what is true now" was read against the code on `main` before
its note was written. Where a row's wording did not match the tree, the
note says what `main` does; the last column says so and the list under
the table gives the detail.

| ADR · section | Was (the record's words) | Now (what the note records)
| Source PR | Row on the card · result |
|:---|:---|:---|:---|:---|
| ADR-0084 · amendment of 2026-11-28, item (3) | "one landing for every
door is not ruled"; the command palette's package entries, an app's
design-in-Studio entry, the empty menu's entry and Setup's doors "still
open the object list" | One landing is ruled: ruling record 7247357556
on objectstack-ai#37958, the maintainer's 「OK」, quoted with its question. Every door
lands on the package's overview, `/studio/PACKAGE/overview`.
`/studio/PACKAGE/data` stays a working address for the object list. The
review-changes deep link still opens the Changes drawer over the object
list and is read as no door, by a seat reading and not by a ruling |
objectstack-ai#38501 | Card body row and 7252442785 · **written, corrected to the
tree** (two labels, the date) |
| ADR-0084 · the note of 2026-11-29 on the `form` row (near line 219) |
"The same change takes the type off the directory's hidden types and
brings its designer" | True of card objectstack-ai#37087, loose for the change: objectstack-ai#38484
brought the designer, and objectstack-ai#38619, which wrote the row, lists the type
(off the hidden types, a place in the menu) | objectstack-ai#38484, objectstack-ai#38619 |
7258423977 · **written as an added note** (the row says "Reword") |
| ADR-0037 · TL;DR item 2 and the "What already exists" table | "the
streaming build tree (`data-build-progress` parts)", and a table row
that marks "`data-build-progress` stream parts" shipped | The
build-progress stream frame is retired. Its reader left with the build
chat frontend, its producer with the cloud build loop, and its
declaration left `@objectstack/spec/ai`. The upgrade guidance is the
migration entry `ai-build-progress-frame-retired` | objectstack-ai#38398 (reader:
objectstack-ai#37720) | 7250363289 · **written** (one sentence beyond the row) |
| ADR-0150 · the note of 2026-11-26, bullet "Reads stay the missing
name" | "Three reads at `_env` still answer `409` at this head
(`?state=draft`, `?preview=draft`, `?layers=true`), and card objectstack-ai#34261
carries their move to `404`." | The move has landed. For a name only
disabled packages hold, each of the three answers its own `404` and
names no package, on both transports. An enabled package's stored draft
that the plain read does not see keeps the `409` for the two draft reads
| objectstack-ai#38633 | 7259890438 · **written, corrected to the tree** (codes and
callers made exact) |
| ADR-0150 · D4, the engine's flow-map row | The table keys the engine's
flow map by `(package, name)` and says nothing of the status rows read
from it | Each status row carries the `packageId` of the engine slot it
reads, so `(packageId, name)` names one row. The toggle door reads back
the row of the slot it switched, and echoes the request only where the
reading cannot name that flow | objectstack-ai#38652 | 7266385586 · **written** |
| ADR-0085 · the note of 2026-11-27 | "Neither key is in the spec yet:
`ObjectSchema` is strict and refuses both until objectstack-ai#37792 lands
`pinOverview` and objectstack-ai#37802 lands `fieldTabs`." | `pinOverview` is in the
spec, an optional boolean on `ObjectSchema`; `false` means the desktop
full record page never pins. An object extension does not carry the key.
`fieldTabs` is still refused | objectstack-ai#38679 | 7271302663 · **written**, no
`fieldTabs` line |
| ADR-0146 · the note of 2026-11-24 (near line 908) | "A `.custom`
package that is not the object's pair is not applied, and the boot log
names it." | Maintainer ruling 7268226134 on objectstack-ai#36548, item 5, arm (c),
verbatim 「保存和安装都拒绝」. A non-pair `.custom` package that writes
`fieldGroups`, `relatedLists` or `actionLayout` on an object extension
is refused at the save, the restore, the draft promotion, a package
duplicate and marketplace install. Where no door can read the installed
packages, the sentence stands | objectstack-ai#38706 | 7272564306 · **written,
corrected to the tree** (statuses; the duplicate's answer corrected in
patch round 1) |

### Rows not carried

- **ADR-0161, two rows** (Consequences, "The service keeps none of its
own"; K7 components table, "Split algorithm version"). The claim for
this pull request leaves that file out, because pull request objectstack-ai#38764 was
open on the same record when the claim was written. objectstack-ai#38764 merged at
2026-11-30T13:15:16Z, while this branch was being verified, and the
prerequisites both rows name (objectstack-ai#38307, objectstack-ai#38401, objectstack-ai#38375, objectstack-ai#38452) are
merged. Pull requests objectstack-ai#38730 and objectstack-ai#38732 (card objectstack-ai#38692) are still open and
both write ADR-0161, so that record still has other writers. By the
seat's call on the card (comment 7280598106) the two rows stay on objectstack-ai#38438
behind them, and this pull request is `Part of objectstack-ai#38438`.
- **ADR-0085, a `fieldTabs` line.** Its pull request, objectstack-ai#38742, was open
and a draft when this was opened (read at 2026-11-30, head
`59220bf331`). The card says that line follows when it merges.

Every prerequisite of the seven rows is merged on `main`: objectstack-ai#38398,
objectstack-ai#38501, objectstack-ai#38484, objectstack-ai#38619, objectstack-ai#38633, objectstack-ai#38652, objectstack-ai#38679 and objectstack-ai#38706. The newest
comment on the card when this was opened is the claim, 7279134045; a row
added after it is not in this pull request.

### Where a note differs from its row

- **ADR-0084, item (3).** The row names Setup's doors "Open in Studio"
and "Customize in Studio". The labels on `main` are "Open in App Studio"
and "Customize in App Studio", and the note uses them. The proposed text
was dated 2026-11-29; the note is dated 2026-11-30, the day it was
written into the record. The note names the three Setup doors one by one
and says of the review-changes deep link what the row says: no door, by
a seat reading, not by a ruling.
- **ADR-0084, the `form` row.** The row says "Reword". The card's rule
is that a row lands as an added dated note, so the 2026-11-29 note stays
as written and a note under it says which pull request did which half.
- **ADR-0037.** One sentence goes beyond the row: Phase 2's first
invalidation source, the `buildProgress.items` diffs, was the same
signal as the chat held it, and no code under `ui/` holds it any more.
Cut it if the note should carry the row alone. The note also names the
producer's retirement in the cloud repository and what a host does that
still streams a progress part of its own.
- **ADR-0150, the reads.** The row's proposed sentence gives `404` for
`?preview=draft` and `?layers=true`. The note gives the code the tree
answers, `404 RESOURCE_NOT_FOUND`, says that these are the answers to a
caller admitted to the switch, and that a caller who is not admitted
gets the plain read's `404`. It adds two facts from the tree: a
package-less draft is withheld while a disabled package holds the name,
and the layered view answers `404` under the leak guard.
- **ADR-0150, D4.** The note spells out the three cases where the toggle
door still echoes the request. The row's proposed sentence leaves them
out.
- **ADR-0085.** The row offers a "Built by" line in the style of an
earlier note. The note carries it and also restates what `false` does
and why an object extension does not carry the key, both from the row's
own "what is true now".
- **ADR-0146.** The row gives one code for every door. The tree answers
`VALIDATION_ERROR` with status 400 at the save, the restore and the
draft promotion, and with status 422 at marketplace install, with
nothing installed. A package duplicate saves each copied row through the
save door and lists a refused row in its own `failed[]`, with the save
door's sentence and no code, storing nothing for that row. The note says
all three, and that no error code is minted.

## Patch round 1 (head `04cc5911`)

The contract review at `947b7e64` (comment 7280965486) passed with one
should-fix: the ADR-0146 note put `VALIDATION_ERROR` / 400 on the
package duplicate. Commit `04cc5911` corrects this branch's own
2026-11-30 note to the tree (`duplicatePackage` reports the refused row
in `failed[]`) and adds one sentence from item 3 of ruling 7268226134 (a
target whose owner the door does not know is not judged by role). Only
that note moves: +9 / -3 inside it, and the branch is still +62 / -0
against `main`. Dev report: card comment 7281379369. Sections below that
name `947b7e64` record the first round.

## Tests

Docs only. No package source is touched, so no package test and no type
check is owed for the change. No tested behaviour changed, so there is
no ablation.

Checked on the committed text at `947b7e64`:

- Each phrase a note quotes from its ADR is in that file as it stands on
`main`. A script compared them. One quotation, in the ADR-0085 note,
reads as the sentence renders: the record links its two card references
and the quotation does not.
- Each verbatim maintainer quotation was compared with its record on
GitHub (7247357556 and 7268226134).
- Each path a note cites exists on the tree. The one exception is
deliberate: the ADR-0037 note names
`packages/spec/src/ai/build-progress.zod.ts` to say that the module is
gone.
- Each test title a note quotes is in the test file the note names.
- A probe on the spec source: `ObjectSchema` accepts `pinOverview:
false`, refuses `pinOverview: "no"`, and refuses `fieldTabs` as an
unrecognised key; `ObjectExtensionSchema` refuses `pinOverview` as an
unrecognised key, with its guidance.
- Upstream moved four commits while this was written. The branch merges
`main` at `f576dee5`; none of the four touches one of the five files or
a path a note cites. `overlap-check` answers `VERDICT clean exit 0`
against that `main`, and no open pull request shares a file with this
branch.

Two tests read these records from disk. Both were run on `947b7e64`
under the verify lock, after building what each needs:

-
`ui/packages/app-shell/src/views/studio-design/studioMenuPlacement.test.ts`
reads ADR-0084's type table: `Test Files 1 passed (1)`, `Tests 21 passed
(21)`.
- `packages/qa/scenarios/test/score/entry.test.ts` reads ADR-0150's D1
table: `Test Files 1 passed (1)`, `Tests 14 passed (14)`. Its first run
answered `Failed to resolve entry for package "@objectstack/types"`, a
missing build in the fresh worktree and no verdict on this change; it
passed once that package's build closure was built.

The local gate set is the `dispatch-gates --commands` derivation for
this change set, 21 commands, run on commit `947b7e64` (patch round 1
ran the same 21 on `04cc5911`, all exit 0). Each exit code was captured
before any pipe. Reconciliation: `Run reconciliation — 21 derived, 21
run, 0 NOT-MEASURED, 0 UNRUN`. The same 21 were derived and run on the
commit before the merge, with the same result.

<details><summary>ADR gates on 947b7e6 (all exit 0)</summary>

| Command | Exit | Verdict line |
|:---|:---|:---|
| `pnpm check:adr-symbol-anchors` | 0 | `check-adr-symbol-anchors: 4597
anchors across 165 records resolve`, 0 line anchors survive. On the base
commit the gate read 4570, and 4593 with this change alone; the other
four come with `main`. |
| `node scripts/check-adr-links.mjs` | 0 | `check-adr-links: 1284
relative link destination(s) under docs/adr/ resolve` |
| `node scripts/check-adr-links.mjs --self-test` | 0 | |
| `pnpm check:adr-anchors` | 0 | `check-adr-anchors: OK (135 anchored
file(s), every governing ADR still referenced` |
| `pnpm check:adr-index` | 0 | `adr-index --report: OK —
docs/adr/README.md is current, every record parsed` |
| `pnpm check:doc-authoring` | 0 | |
| `pnpm check:nul-bytes` | 0 | `check-nul-bytes: OK (scanned 29015 text
file(s)`, no raw control bytes |
| `pnpm check:closed-ceremony-text` | 0 | |
| `pnpm check:pm-governed-merges` | 0 | |
| `pnpm --filter @objectstack/lint run check:doc-formula-expressions` |
0 | run after building `@objectstack/spec`, `@objectstack/formula` and
`@objectstack/lint` under the verify lock |

</details>

<details><summary>The other derived families on 947b7e6 (all exit
0)</summary>

`node scripts/check-closing-keyword-parity.mjs` and its `--self-test`,
`node scripts/check-comment-mask-corpus.mjs`, `node
scripts/ci/plan-test-core-shards.mjs --self-test`, `pnpm
check:ci-filter-parity`, `pnpm check:cross-package-test-inputs`, `pnpm
check:driver-memory-census`, `pnpm check:gitlink-declared`, `pnpm
check:pm-prior-rulings`, `pnpm check:refd-timer-probe`, `pnpm
check:watch-hint-literal`.

Before the last push: `node scripts/check-commit-card-trailers.mjs
--range origin/main..HEAD` exit 0, two commit messages (three after
patch round 1, also exit 0), no card relation and no model identifier in
the trailer pair.

</details>

<details><summary>A local-only reading that is red for a reason outside
this change</summary>

`pnpm check:dev-prereqs` exits 1 in this worktree: "The workspace is not
built", 105 of 110 workspace packages have no build output. It judges
the machine and not the diff, CI does not run its scan, and a fresh
worktree that builds only what a docs change needs reads this way. It is
not in the derived list.

</details>

Not run locally: the repository test project behind `test:repo`, and
every package suite. CI runs them on the pull request and on the merge
group. Every other family CI runs is read from this pull request's check
runs, not re-run here.

## Acceptance notes

- **Changeset.** None, and the pull request carries `skip-changeset`.
`docs/adr/**` ships in no package.
- **Governed surface.** `docs/adr/**` lands on the maintainer's
approval. This pull request stays a draft; the seat arranges the review
at the tier this surface owes and hands it over.
- **Why "Part of".** The card says it ends when its pull request merges.
Two of its rows are not here, so merging this one must leave the card
open.
- **Seen and left alone.** These are outside the seven rows and are not
changed here.
- ADR-0037's Status line says all four phases are implemented. On this
tree the console's canvas-invalidate signal has a subscriber and no
publisher: nothing calls the bus function that emits it. It is a
candidate row for the card of this name.
- ADR-0150's D4 note of 2026-11-10 gives its own end condition, an
earlier card landing. That card ended on 2026-11-12, and the record
carries no line that says so. A possible row; not judged here.
- Comments in the chat plugin still name the retired build-progress
part, and one test fixture uses the name as an open `data-` part. Not a
record, so not a row.

## Verification

### Read first

1.
`docs/adr/0146-studio-designs-setup-administers-one-editor-per-item-paired-customize-package.md`,
the note of 2026-11-30 under the note of 2026-11-24. The highest-risk
hunk: it quotes a maintainer ruling, and it draws the line between the
doors that refuse and the places where the old sentence still stands.
Check the two statuses and the list of places with no door.
2. `docs/adr/0084-application-builder-information-architecture.md`, the
amendment of 2026-11-30 under the amendment of 2026-11-28. It quotes a
maintainer ruling and lists every door; check the list, and the sentence
on the review-changes deep link, which records a seat reading and says
so.
3.
`docs/adr/0150-behavioural-metadata-addressed-by-package-objects-keep-the-literal-prefix.md`,
the first amendment note of 2026-11-30. Check the three answers, who
gets which, and the leak-guard paragraph against the tests it names.

### Two-minute check

Run `git diff --numstat origin/main...HEAD` on this branch. Expect five
rows under `docs/adr/`, each with `0` in the removed column, and 62
added lines in total (2, 4, 18, 28 and 10). Then run `pnpm
check:adr-symbol-anchors` and expect exit 0 with a line that contains
`anchors across 165 records resolve`.

---
_Generated by [Claude
Code](https://claude.ai/code/session_01WGufzhPdWmTd47Fi2bKYZS)_

<!-- signed: repo:objectstack@os-support-ai · os-support-ai ·
session_01WGufzhPdWmTd47Fi2bKYZS -->

---------

Co-authored-by: Claude <noreply@anthropic.com>
Nenzyz pushed a commit to Nenzyz/objectstack that referenced this pull request Dec 1, 2026
…ut a code is refused, never answered as no hits (objectstack-ai#38761)

<!-- claude-projects-attribution: {"github_login":"os-steve"} -->
_Requested by **Steve** · [project
thread](https://claude.ai/code/project/chan_01FdL1XeUyvVNxLreh3F4Qi9?thread=cmsg_01FdL1XeUyvVNxLreh3F4Qi9DAwBxBGNv4CexdUyBYJXSw)_
Fixes objectstack-ai#38728
repo:objectstack#3 · os-steve · session_01ADHkmPDtfMCw4FJfyFfQ7v

Clause-②: no (narrowing)
Metadata-protocol: none

## 维护者速读

- 变化:知识库检索时,某个来源的检索服务出错(如向量服务连不上)不再显示成「什么都没搜到」,而是列为「该来源未能检索」。
- 谁会碰到:只在某来源检索抛出无错误码的异常时出现;若它是本次唯一被检索的来源,整次检索改为报「服务不可用」(503),其他来源照常返回结果。
- 出错会怎样:最坏是把出错来源误报为不可用;改动集中在一处,可直接撤回。
- 要你做什么:无。

## BREAKING

**BREAKING** for a caller of a knowledge search (the `search_knowledge`
tool, its MCP HTTP and stdio faces, and in-process
`KnowledgeService.search` / `searchWithRefusals`) when a source's
adapter throws from `search` with an error that does not carry both an
ADR-0112 `code` and `status` (an embedder that cannot be reached, a
timeout outside the store). The search now names that source in
`refused`, coded `SERVICE_UNAVAILABLE` (503), with a platform sentence
naming the source; before, the source read as if it had matched nothing.
The thrown message is not shown to the caller; the operator's `error`
log line keeps it. Sources that answer are still served beside the
refusal. A source that matches nothing is unchanged, and so is a coded
refusal's own `refused` entry; a whole rejection that also names an
uncoded throw may take that throw's top-level code (cell 2 below).
Declared as a narrowing per L1 REWORK 7279138481; registered in the
ADR-0087 ledger as semantic entry
`knowledge-search-uncoded-adapter-throw-refused`
(`packages/spec/src/migrations/entries/semantic/19.knowledge-search-uncoded-adapter-throw-refused.ts`,
a new file; the registry is generated, no existing spec file edited),
added to the file surface by claim amendment 2 (comment 7279244160).

FROM → TO:
- No searched source answers and at least one threw without a code — two
cells:
1. Every searched source throws without a code (one source, or several
failing on the same embedder outage). FROM: the search succeeded with `{
hits: [] }`. TO: rejected `SERVICE_UNAVAILABLE` / 503 with `refused`
naming each source (the `search_knowledge` executor and in-process
`search` reject with `refused`; MCP answers an error result whose
envelope is `code`, `message` and `status`, the sources named in the
message).
2. A source throws without a code beside a source refused with a code,
none answering. FROM: rejected with the coded source's `code` / `status`
and `refused` naming it alone. TO: `refused` names both, and the
rejection's top-level `code` / `status` are the first refusal's in
source order, so a 409 `KNOWLEDGE_REBUILD_REQUIRED` rejection may now
read 503 `SERVICE_UNAVAILABLE`.
- A refill fails without a code. FROM: the source's round-one survivors
were served. TO: they are dropped and the source is refused for the
whole search, as a coded refusal of the refill already was.

Fix for each reader: a caller reads `refused` and the 503 instead of
treating an empty answer as no match; an operator repairs the adapter or
embedder the `error` line names.

## What changes

`searchRound`
(`packages/services/service-knowledge/src/knowledge-service-search.ts`)
catches an adapter's throw from `search`. A coded refusal (ADR-0112
`code` + `status`) was already pushed to `refused`; any other throw was
only logged at `error`, so the source read as zero hits. Now an uncoded
throw is pushed to `refused` as `{ sourceId, code:
'SERVICE_UNAVAILABLE', status: 503, message }`, where `message` is a
platform sentence naming the source and its adapter id (never the thrown
text, which can carry hosts, SQL or keys). The operator `error` line is
unchanged and still carries the thrown message. The docblock states the
new outcome.

Code choice: the existing `SERVICE_UNAVAILABLE` (503), the code this
package already answers for an adapter that cannot serve
(`UNMOUNTED_ADAPTER_CODE`, `knowledge-service-top-level.ts`). No new
code is minted, so no ledger or `StandardErrorCode` change. The literal
is written in the catch (not the constant imported) to stay inside the
claimed hunk.

Consequences that follow from the existing refusal machinery, unchanged
by this diff:
- When no searched source answers (`first.size === 0 && refused.length >
0`), the search is refused whole (`wholeRefusal`), so a search whose
only source's embedder is down now rejects with `SERVICE_UNAVAILABLE` /
503 and `refused`, instead of resolving `[]`.
- Refill: a source refilled is one that answered round one, so it is
never refused twice in one search. A source that fails the refill
uncoded is now refused for the whole search and its round-one hits
dropped, as a coded refusal of the refill already was
(`refusedInRefill`).

## Public doors

Measured on `origin/main` acf3b33 plus this branch; there is no REST
knowledge search route (a grep of `packages/rest/src` and
`packages/runtime/src` for a knowledge search route finds none; the same
grep finds the `search_knowledge` registrations below).
- `search_knowledge` executor,
`packages/services/service-knowledge/src/knowledge-tools.ts:662-671`:
with other sources answering, the tool output now carries `refused: [{
sourceId, code: 'SERVICE_UNAVAILABLE', message }]` beside their hits
(before: no `refused`, the source silent). When it is the only searched
source, the executor rejects with the whole refusal (`wholeRefusal`,
thrown at `knowledge-service-search.ts:231`, or `:258` on a refill):
`code: 'SERVICE_UNAVAILABLE'`, `status: 503`, `refused` naming the
source (before: `{ hits: [] }`).
- MCP `search_knowledge`, `packages/mcp/src/mcp-http-tools.ts:3824-3826`
(registered for HTTP at `mcp-http-tools.ts:3428` via
`packages/runtime/src/domains/mcp.ts:1786`, and for stdio at
`packages/mcp/src/plugin.ts:1068` via `stdio-data-bridge.ts:1998`): the
partial case returns the text result with `refused`; the only-source
case returns `errorResultWithCode` (`mcp-http-tools.ts:1636`), an error
result with the ADR-0112 envelope `SERVICE_UNAVAILABLE` / 503 (before: a
text result with no hits).
- In-process `KnowledgeService.search` / `searchWithRefusals` callers
(no other non-test caller in this repo): same as the executor.

## Tests

New `src/__tests__/search-uncoded-throw-38728.test.ts` (5 cases): plain
`Error` gives one `refused` entry naming the source (code + status
asserted, thrown text absent from the caller's message, present in the
`error` line), other sources' hits still served; only source throwing
uncoded refuses the search whole (503); coded refusal unchanged; source
matching nothing answers no hits and no refusal; refill failure refused
once, round-one hits dropped.

Flipped pins of the old "logged, zero hits" outcome (each now asserts
the refusal's sourceId/code/status):
- `knowledge-service.test.ts` "a refill the adapter fails keeps the
source's round-one survivors" -> refused as a coded refill refusal is.
- `knowledge-tools.test.ts` "control: a failure without a code is logged
and skipped as before" -> refused `SERVICE_UNAVAILABLE`, text withheld.
- `knowledge-settings-contribution.test.ts`: "no settings: ... search
answer an error", "the API key is in no log line and no error", "a
plugin a host mounts itself, no embedder" -> search rejects
`SERVICE_UNAVAILABLE` / 503 naming `docs`.
- `packages/plugins/knowledge-pgvector/bench/instrument.test.mjs` "a
failed embed is counted, and the search answers no hit with the
service's "search failed" line" (`s.ok` true, `s.hits` 0) -> "a failed
embed is counted, and the search is refused SERVICE_UNAVAILABLE naming
the source, with the service's "search failed" line": `s.ok` false,
`s.errorCode` `SERVICE_UNAVAILABLE`, the thrown refusal
`SERVICE_UNAVAILABLE` / 503 with `refused` naming `clauses`;
`embedFailures` 1, `calls.ranking` 0 and the one "search failed"
operator line kept.

This sixth pin was added to the file surface by claim amendment 1
(comment 7278305559).

Files changed (8):
- `packages/services/service-knowledge/src/knowledge-service-search.ts`
-
`packages/services/service-knowledge/src/__tests__/search-uncoded-throw-38728.test.ts`
-
`packages/services/service-knowledge/src/__tests__/knowledge-service.test.ts`
-
`packages/services/service-knowledge/src/__tests__/knowledge-settings-contribution.test.ts`
-
`packages/services/service-knowledge/src/__tests__/knowledge-tools.test.ts`
- `packages/plugins/knowledge-pgvector/bench/instrument.test.mjs`
- `.changeset/38728-uncoded-search-throw.md`
(`@objectstack/service-knowledge` and `@objectstack/spec` patch,
`fix(service-knowledge)!:`, `Clause-②: no (narrowing)`, the ADR-0087
`registered` marker)
-
`packages/spec/src/migrations/entries/semantic/19.knowledge-search-uncoded-adapter-throw-refused.ts`
(new; claim amendment 2, comment 7279244160)

<details><summary>Readings (tests at 43def1f; e52b762 adds only the
changeset sentence)</summary>

- `pnpm --filter @objectstack/service-knowledge test`: Test Files 26
passed (26), Tests 841 passed (841).
- `pnpm --filter @objectstack/service-knowledge typecheck` (tsc over
`src`, tests included, plus `check:test-typecheck`): exit 0.
- Ablation: catch reverted to `acf3b33e` on disk, new file run: 3 failed
/ 2 passed (the three uncoded pins red; coded and no-match pins green).
Fix restored.
- Local derived gates: 40 of 69 run, all exit 0 except
`check-plugin-teardown-shape --self-test` (exit 3, shallow-clone
prerequisite, NOT MEASURED) and `check:type-check-debt` (local 100 s
timeout, NOT MEASURED). The other 29 are left to CI.
- `overlap-check.mjs`: VERDICT clean exit 0 (merges cleanly with main,
objectstack-ai#38722, objectstack-ai#38730, objectstack-ai#38732).
- Round 2 (6348efa): `bench/instrument.test.mjs` alone 8 passed (8);
`pnpm --filter @objectstack/knowledge-pgvector test` 46 passed, 95
skipped (live-postgres); knowledge-turso 301 passed; knowledge-memory 66
passed; overlap-check VERDICT clean exit 0 (also objectstack-ai#38758).
</details>

## Acceptance notes

- Read first: the catch block in `searchRound` (the only runtime hunk);
then the refill pin flip in `knowledge-service.test.ts`, which is the
one behaviour change beyond the card's literal Ask (a refill failure now
drops round-one survivors instead of keeping them, to match the coded
path).
- The stand-in embedder's "No embedder is configured ... restart" text
is uncoded, so the caller now reads the generic platform sentence and
the remedy stays on the operator line. Coding that error at its producer
would let the caller read the remedy; noted, not filed.
- `content/docs/protocol/knowledge.mdx` not edited (open PRs edit it;
skipped per dispatch).

## Verification

Two-minute check: `pnpm --filter @objectstack/service-knowledge exec
vitest run src/__tests__/search-uncoded-throw-38728.test.ts` -> 5
passed.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

https://claude.ai/code/session_01ADHkmPDtfMCw4FJfyFfQ7v
<!-- signed: repo:objectstack#3 · os-steve ·
session_01ADHkmPDtfMCw4FJfyFfQ7v -->

---------

Co-authored-by: Claude <noreply@anthropic.com>
Nenzyz pushed a commit to Nenzyz/objectstack that referenced this pull request Dec 1, 2026
…ce's state; the embedder help text says what saving a provider sends (objectstack-ai#38786)

Part of objectstack-ai#38369 (PR 3a of the card's part 3: the CLI's reading of a held
knowledge service and the embedder help text. The server half, the
`index_status` answer and the `rebuild` refusal, is PR 3b and follows
after the open retrieval-mode PRs land. Item 6, the skill, is its own
PR.)

Clause-②: no
Metadata-protocol: none

## 维护者速读

-
用户能看到什么变化:管理员在命令行查看知识库状态时,如果服务器报告知识服务未启用,第一行会写明未启用、有几个知识源被挂起以及原因和补救办法;设置页「AI
与嵌入模型」里嵌入模型一节的说明多了一句:保存提供商并重启后,每个知识源列出的内容字段会发给该提供商并由其计费(所有界面语言)。
- 为什么做:知识服务「挂载不等于启用」那张卡的第三部分的前一半,让管理员看得见服务没启用、保存嵌入模型会发出什么数据。
- 出错会怎样:只影响命令行状态输出的第一行和设置页一句说明文字;服务器还没发送这个状态时命令行输出和今天完全一样。撤回这次合并即可恢复。
- 要你做什么:无。

## What changes

- **`os knowledge status`** reads an optional `enablement` field of the
`index_status` answer (`KnowledgeEnablementView` in
`packages/cli/src/utils/knowledge-actions.ts`). When it is present, the
command prints `knowledge service: not enabled — N source(s) held, none
built, synced or searched` and the reason with its remedy, before the
sources. **The server does not send this field yet**: PR 3b adds it to
the `index_status` answer. That is harmless: the field is optional and
only read, and an answer without it prints exactly as today (pinned line
by line).
- **`os knowledge rebuild`**: docblock only. On `main` a held service's
rebuild already answers the service's own sentence (`Rebuild of source
'X' was not started: [knowledge] the knowledge service is not enabled
... To enable it, save an embedder provider, then restart.`), and the
command already exits 1 with it. A new test pins that the command prints
that sentence and exits 1, whether the server answers it as `ok` with no
build or as a refusal (the shape PR 3b gives it).
- **Settings → AI, Embedder section** (`aiEmbedderSettingsSpecifiers` in
`ai.manifest.ts`): the help text says that once a provider is saved and
the server restarted, the content fields each knowledge source lists are
sent to that provider for every row the source matches, and the provider
bills for them. The sentence is in the English copy and in all 10 other
shipped locales.
- **Docs**: one sentence in `content/docs/ai/knowledge-rag.mdx` (the `os
knowledge` section) on what the two commands do while the service is
held. `content/docs/protocol/knowledge.mdx` is left untouched: a
sentence there conflicted textually with the open PR objectstack-ai#38730.

## Tests

- `packages/cli/src/commands/knowledge/knowledge.test.ts`: (1) an answer
with `enablement` prints the not-enabled line and the reason first, then
the sources; (2) an answer without it prints exactly the lines it
printed before; (3) the existing full status case asserts no `knowledge
service:` line; (4) a held rebuild exits 1 with the server's sentence,
in both answer shapes.
- `packages/services/service-settings/src/manifests/ai.manifest.test.ts`
(new top-level `describe`): the section declaration and the English copy
carry the sentence; every shipped locale's copy names the restart and
the bill.

## Acceptance notes

- What the server answers is unchanged here; `Clause-②: yes (widening)`
stays with PR 3b, which adds `enablement` to `index_status`.
- A measurement for the seat, not acted on here: on `main`, with the
service held and its store mounted (the no-embedder case), each
`index_status` read calls the store adapter's `indexStatus` once per
source (`knowledge-build-actions.ts:335` →
`KnowledgeService.readIndexState`, `knowledge-service.ts:584` →
`readIndexStateOf`, `knowledge-service-indexing.ts:712`), and the
reading can say `due: true ... it is built anew` while nothing will
build it.

## Verification

<details><summary>Local runs at b4b6e97</summary>

- `pnpm --filter @objectstack/cli exec vitest run --maxWorkers=2
src/commands/knowledge/knowledge.test.ts`: 15 passed (12 before, plus 3
new). `pnpm --filter @objectstack/cli typecheck`: exit 0. The typecheck
runs `check:test-typecheck`, so it covers the test file too.
- `pnpm --filter @objectstack/service-settings exec vitest run
--maxWorkers=2 src/manifests/ai.manifest.test.ts
src/translations/settings-translation-coverage.test.ts`: 2 files, 204
passed. `pnpm --filter @objectstack/service-settings typecheck`: exit 0.
- Ablation: with `status.ts` restored to `main`, the new held-status pin
fails (1 failed, 14 passed); restored afterwards, tree clean.
- `dispatch-gates --ran`: 104 derived, 101 exit 0, 3 NOT MEASURED, all
for a prerequisite these paths do not touch: `check:skill-examples`
(client-react dist), `check:dual-build-cjs-loads` (scenarios/studio
dist) and `check:i18n-coverage` (the app-showcase config needs the
service-print dist). `check:i18n`, `check:i18n-walk-parity` and
`check:nul-bytes` passed with exit 0.
- eslint over the changed `.ts` files: exit 0. `overlap-check`: clean
against `origin/main` and objectstack-ai#38732.

</details>

Two-minute check: `pnpm --filter @objectstack/cli exec vitest run
src/commands/knowledge/knowledge.test.ts -t "held"` should report 2
passed.

---
_Generated by [Claude
Code](https://claude.ai/code/session_01ADHkmPDtfMCw4FJfyFfQ7v)_

🤖 Generated with [Claude Code](https://claude.com/claude-code)

https://claude.ai/code/session_01ADHkmPDtfMCw4FJfyFfQ7v
<!-- signed: repo:objectstack#3 · os-steve ·
session_01ADHkmPDtfMCw4FJfyFfQ7v -->

---------

Co-authored-by: Claude <noreply@anthropic.com>
Nenzyz pushed a commit to Nenzyz/objectstack that referenced this pull request Dec 1, 2026
…dge service is held (objectstack-ai#38796)

Part of objectstack-ai#38369 (PR 3b, the server half of the card's part 3. PR 3a,
objectstack-ai#38786, shipped the CLI reading and the embedder help text. Item 6, the
skill, is its own governed PR.)

Clause-②: yes (widening)
Metadata-protocol: none

## 维护者速读

-
用户能看到什么变化:没启用知识服务(缺嵌入模型或知识存储没挂上)的私有部署上,管理员查看知识库状态时,第一行写明未启用、几个知识源被挂起、原因和怎么补,每个知识源显示「挂起」,不再误报「需要重建」;手动重建会被直接拒绝并给出补救办法。没有知识服务的部署,启动日志里的补救说明也补上了「保存嵌入模型后再重启一次」这一步。
- 为什么做:知识服务「挂载不等于启用」那张卡的最后一块代码,让管理员看得见服务为什么没生效;同时修正了上一张 PR 审核时留下的三处小问题。
- 出错会怎样:只影响状态查询和手动重建的回答,以及一行启动日志;已启用的部署和宿主自己挂载知识服务的部署回答不变。撤回这次合并即可恢复。
- 要你做什么:无。

## What changes

- **`index_status`, while the service is held**
(`knowledge-build-actions.ts`): each source's index reads the new state
`held` (`heldIndexReading` in `knowledge-build.ts`: not due, with one
sentence), and the store is **not** asked what it holds. On `main` a
held read called the store adapter's `indexStatus` once per source,
through `KnowledgeService.readIndexState`, and could answer "it is built
anew" for a build that nothing would run. The answer gains `enablement`
(`state: 'not-enabled'`, the `reason` naming each missing half and its
remedy, `embedder` / `store`, `heldSources`), and its message leads with
the reason and the held count. A service a host mounts itself, and an
enabled one, answer exactly as before.
- **`rebuild`, while held**: the service's own refusal of the build
(`heldSourcesError` in `rebuildSource`) is now answered as a refusal
(`ok: false`, which the settings door answers 400): `Rebuild of source
'X' is refused: [knowledge] the knowledge service is not enabled on this
deployment: ... To enable it, save an embedder provider, then restart.`
Before, it was answered `ok` as "was not started". No second refusal
path is added: the action reads `heldReading()` only after
`rebuildSource` threw.
- `KnowledgeBuildActionsService` gains `heldReading` as an **optional**
member, so a caller's own service double still fits.
- **Carry-overs from the PR 2 contract review** (record 7257422588,
routed here by L1 record 7257956376):
- N1: `knowledge-settings-contribution.test.ts`. The "no identity"
assertion now passes `null`, because `undefined` hit the helper's
default parameter and repeated the author's case. It asserts the held
`503 SERVICE_UNAVAILABLE`, which pins that the held refusal comes ahead
of the identity check.
- N2: the `admitAuthoredSource` jsdoc in `knowledge-service.ts` now says
that `door` also decides whether the held refusal applies.
- N6: `packages/objectql/src/knowledge-source-unserved.ts`. The boot
line of a deployment that holds `knowledge_source` items and runs no
knowledge service now names the embedder step its save refusal already
names: `Declare requires: ['knowledge'] in the stack and restart, then
save an embedder provider and restart again`. This makes
`knowledge-rag.mdx`'s "and the same fix" true again.
- **Docs**: `content/docs/protocol/knowledge.mdx` gets the sentence that
PR 3a dropped (it conflicted with objectstack-ai#38730, which has since merged), now
saying what both actions answer while held.

## Tests

- New
`packages/services/service-knowledge/src/__tests__/held-status-38369.test.ts`.
Both actions run through the settings service's action door on a kernel
running the plugin as the runtime composes it:
- the not-enabled `enablement` with its reason, the embedder half and
the held count;
  - both halves at once;
- a host-mounted service and an enabled one answer no `enablement` and
the old message;
  - a held rebuild is refused with the remedy and no store call;
  - an enabled rebuild is not refused.
- On a service with a data engine bound and a counting store, while
held: the index reads `held`, not due, with no "built anew", and **0
`indexStatus` calls**. Control, enabled: the same store is asked once
(`new-fingerprint`).
- `knowledge-source-unserved.test.ts` pins the embedder step in the boot
line.

## Acceptance notes

- N2's other stale lines are in
`packages/metadata-core/src/knowledge-source-save-admission.ts`:
`noKnowledgeServiceRefusal`'s "the token, a restart, then the save" at
:185, and the door docs at :84 and :115. That file is outside this
claim's surface, so they are left for a follow-up.
- The `new-fingerprint` detail "it is built anew" stays as it is for an
enabled service, where it is true. While held, that reading is no longer
produced.

## Verification

<details><summary>Local runs at 142f3f6 (base c8b1dbb)</summary>

- `pnpm --filter @objectstack/service-knowledge test`: 29 files, 879
passed. `typecheck` exit 0 (it includes `check:test-typecheck`).
- `pnpm --filter @objectstack/objectql exec vitest run
src/knowledge-source-unserved.test.ts`: 7 passed. `pnpm --filter
@objectstack/objectql typecheck`: exit 0.
- Ablation 1: with `index_status` reading the store while held (the fix
reverted), "held, the store mounted: ... the store is never called"
fails (1 failed / 6 passed).
- Ablation 2: with the held branch disabled (`heldOf` answering
`undefined`), the four held pins fail (4 failed / 3 passed). Both
restored; tree clean.
- `dispatch-gates --ran`: 105 derived, 102 exit 0, 3 NOT MEASURED:
  - `check:skill-examples`: no client-react dist;
  - `check:dual-build-cjs-loads`: no scenarios/studio dist;
- `check:type-check-debt`: its `--re-measure` starts a whole-workspace
build beyond the 10-minute cap; stopped, and CI runs it.
- eslint over the changed `.ts` files: exit 0. `overlap-check` against
`origin/main` 6cc2024 (with objectstack-ai#38786 merged): clean; objectstack-ai#38791 merges
cleanly.

</details>

Two-minute check: `pnpm --filter @objectstack/service-knowledge exec
vitest run src/__tests__/held-status-38369.test.ts` should report 7
passed.

---
_Generated by [Claude
Code](https://claude.ai/code/session_01ADHkmPDtfMCw4FJfyFfQ7v)_

🤖 Generated with [Claude Code](https://claude.com/claude-code)

https://claude.ai/code/session_01ADHkmPDtfMCw4FJfyFfQ7v
<!-- signed: repo:objectstack#3 · os-steve ·
session_01ADHkmPDtfMCw4FJfyFfQ7v -->

---------

Co-authored-by: Claude <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation protocol:ai size/m tests tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants