Skip to content

feat(knowledge)!: refuse a knowledge_source save that names an adapter the running deployment does not mount - #38060

Merged
os-zhuang merged 3 commits into
mainfrom
claude/area-o1C-37961
Nov 28, 2026
Merged

os-zhuang merged 3 commits into
mainfrom
claude/area-o1C-37961

Conversation

@objectstack-fleet

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

Copy link
Copy Markdown
Contributor

repo:objectstack#1 · os-elon-musk · session_016WV4cwPhGV4g9p1BGQaZbP

Fixes #37961

Clause-②: no (narrowing)
Metadata-protocol: narrowed
Skills-docs: follow-up #38158 — skills/objectstack-ai/SKILL.md § Knowledge Sources (its adapter row, added on main by #38053) does not yet name this PR's save refusal of an unmounted adapter; #38158 teaches it there. content/docs/ai/knowledge-rag.mdx and content/docs/protocol/knowledge.mdx name the refusal here

维护者速读

  • 用户能看到什么变化:在 Studio、通过接口或用 AI(MCP)保存知识源时,如果写了本部署没装的存储(例如已退役的 ragflow 或拼错),保存会当场被拒,错误里写明知识源、写的存储名和本部署已装的存储;不写存储、或写已装的存储,照常保存。
  • 为什么做:知识库检索专题(按调用者权限过滤的知识检索)的收尾一项,替写知识源的作者和 AI 解决“写错存储要到启动日志或检索报错时才发现”。
  • 出错会怎样:最坏是某个本该能保存的知识源被拒;改动只在保存这一处,可直接撤回。包安装、代码注册和离线校验不经过这一检查,仍由启动日志和检索报错兜底。
  • 要你做什么:无(这是收窄,按惯例走契约审核)。

What changes

  • The check (packages/services/service-knowledge/src/knowledge-service.ts, admitAuthoredSource): a knowledge_source item whose adapter is a string naming no adapter the running deployment has registered is refused 400 VALIDATION_ERROR. The message names the source, the adapter and the mounted adapters, as a rule and its remedy: "it names adapter 'ragflow', which this deployment does not mount (mounted: memory), and a source's adapter must name a mounted store. Name one of 'memory' as its adapter, or leave adapter out, and the deployment's store holds it, or mount the 'ragflow' store and save it again." Leaving adapter out is offered only where an omitted adapter would be placed (the deployment's store is mounted, or one adapter is). The hunk sits beside the existing unplaced-source check (several adapters, none the deployment's), the other "which store holds it" refusal, and reads the registry at request time, after every store's start(): nothing is recorded.
  • Not refused: an omitted adapter (legal since the deployment's-store change; it is placed by adapterIdFor); a named adapter that is mounted.
  • Doors reached: every caller of authoredKnowledgeSourceRefusal (@objectstack/metadata-core), unchanged: PUT /meta/knowledge_source/:name on both transports, the MCP save_metadata_draft tool, and the package duplicate (refuseDuplicatedKnowledgeSources), which judges each source it copies for the caller and now refuses a copy whose source names an unmounted adapter, as it already refused an unplaced one.
  • Not covered by this door, said in the docs and the changeset: a package install and any other engine write (isSystem, skipped by authoredKnowledgeSourceRefusal before the knowledge service is asked); a source registered in code (registerSource, KnowledgeServicePlugin({ sources })), which registers at init() before its store's start(), so "not mounted yet" is no verdict there; objectstack validate, which runs with no deployment. For those, reportUnmountedAdapters at boot (error) and the 503 SERVICE_UNAVAILABLE at index and search stay the signal.
  • How the refusals at this door order: with no knowledge service mounted, the door never reaches admitAuthoredSource, so the no-service refusal that feat(metadata-core)!: a knowledge source is saved only on a deployment that mounts the knowledge service #38013 adds (503) comes before this one (400). Inside admitAuthoredSource: no identity (403), then the unplaced source (400), then this check (400), then no data engine (503), then the exposure and field gates (403/503). The code is the existing VALIDATION_ERROR, the sibling unplaced refusal's code: no new error code.
  • Docs: content/docs/ai/knowledge-rag.mdx (the not-mounted bullet) and content/docs/protocol/knowledge.mdx (the "Named" binding rule and guard two, source admission at save).
  • ADR-0087: semantic entry knowledge-source-unmounted-adapter-refused-at-save (packages/spec/src/migrations/entries/semantic/), registered by the changeset.

Tests

  • packages/services/service-knowledge/src/__tests__/knowledge-source-admission.test.ts, in the admitAuthoredSource describe, through the real KnowledgeService: a retired (ragflow), mistyped (memroy) and empty adapter are each refused VALIDATION_ERROR/400 naming the source, the adapter and mounted: memory; the refusal comes before the field gate; the system context is admitted; with none mounted the message says mounted: none, with two it names both; CONTROL: a mounted adapter, and an omitted one (deployment's store, two registered), are admitted. One existing fixture (new KnowledgeService({}) in the fail-closed case) now registers the memory adapter its item names, so it still reaches the no-engine 503 it pins.
  • packages/qa/dogfood/test/knowledge-source-unmounted-adapter-save.dogfood.test.ts, a real booted showcase (knowledge service plus memory) with the MCP server: PUT /meta/knowledge_source refuses ragflow and memroy 400 VALIDATION_ERROR, nothing stored (GET 404, not registered); MCP save_metadata_draft with a real OAuth token (metadata:write actions:execute) refuses ragflow the same way, and no draft is stored; CONTROL: a named memory source and an omitted-adapter source save at both doors.
Local runs on head 0b2a3bc (all under os-verify-lock)
  • Dependency closure pnpm exec turbo run build --filter='@objectstack/dogfood^...' --concurrency=2: exit 0 (covers service-knowledge^...).
  • service-knowledge: vitest Test Files 18 passed (18), Tests 573 passed (573); typecheck (tsc plus check:test-typecheck) exit 0.
  • metadata-core: Test Files 29 passed (29), Tests 1111 passed (1111); typecheck exit 0.
  • Door tests that pin save refusals: runtime mcp-authoring, meta-save-capability-gate, packages-knowledge-source-gate, meta-type-write-capability-parity: 4 files, 195 passed; rest meta-write-door-capability-enumeration, meta-type-write-capability: 2 files, 135 passed.
  • spec src/migrations: 5 files, 206 passed. New dogfood file: 4 passed (4).
  • Dogfood battery (pnpm --filter @objectstack/dogfood test, no shard, no path): VERDICT command-exit 0, held the lock 2405 s; Test Files 491 passed, 3 skipped (494); Tests 4148 passed, 68 skipped (4216).
Ablation: the check removed, both layers red; restored, green

Through scripts/ablation-replace.mjs (anchor hit, restore trap) on the condition if (typeof authoredAdapter === 'string' && ...), prefixed with an always-false string comparison carrying the marker ABLATED_UNMOUNTED_CHECK.

  • Unit leg (vitest reads src; marker count 1 on disk): 2 failed, 43 passed (45). Red: the two refusal cases (ragflow: expected { admitted: true } to match object { admitted: false, ... }). Green: the CONTROL.
  • Door leg: service-knowledge rebuilt, ablation-dist-preflight found the marker in dist/ (exit 0); dogfood file 2 failed, 2 passed (4). Red: the PUT leg (Saved knowledge_source 'ks_retired_store' ... expected 200 to be 400) and the MCP leg. Green: the booted-store check and the CONTROL.
  • A first attempt spelled the mutation as a literal comparison, which the DTS build refused (TS2367), so that door leg ran with no dist/ and is discarded; the unit leg of that attempt is the one above.
  • Restore: git diff HEAD empty, git status --porcelain empty, rebuilt, ablation-dist-preflight --absent exit 0, unit file 45 passed, dogfood file 4 passed.

Acceptance notes

Verification

Read first: (1) knowledge-service.ts the new hunk after the unplaced-source check in admitAuthoredSource, and unmountedAdapterSaveText (remedy wording); (2) the dogfood file's MCP leg (token, save_metadata_draft); (3) the semantic migration entry.

Two-minute check: pnpm --filter @objectstack/service-knowledge exec vitest run --maxWorkers=2 src/__tests__/knowledge-source-admission.test.ts shows 45 passed, three of them the new unmounted-adapter cases.

Gates

Generated by Claude Code

… the deployment does not mount

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016WV4cwPhGV4g9p1BGQaZbP
… both doors, its docs and migration entry

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016WV4cwPhGV4g9p1BGQaZbP
@github-actions github-actions Bot added size/m documentation Improvements or additions to documentation tests tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface labels Nov 28, 2026
@github-actions

github-actions Bot commented Nov 28, 2026 •

Copy link
Copy Markdown
Contributor

📓 Docs Drift Check

This PR changes 2 package(s): @objectstack/service-knowledge, @objectstack/spec, touching 5 documentable anchor(s).

3 hand-written doc(s) NAME something this change touched and may need an implementation-accuracy re-verification:

  • content/docs/ai/knowledge-rag.mdx (via KnowledgeService (symbol, a top-level class))
  • content/docs/permissions/system-context.mdx (via admitAuthoredSource (symbol, a method of class KnowledgeService))
  • content/docs/protocol/knowledge.mdx (via KnowledgeService (symbol, a top-level class))
What this run could not see
  • 1 anchor(s) matched too much of the corpus to be a work list: VALIDATION_ERROR (literal, 39 pages)
  • 3 name(s) were too generic to anchor anything (single lowercase words)
  • the SDK route bridge reached 69 of 252 client-bound route-ledger rows — the other 183 have no registrar path: tail to select them, so pages documenting THEIR client methods cannot appear above, on this or any run. Of those 183: 0 are remediable by widening that discovery convention (an in-repo file declares the path; the convention did not scan it); 59 are structural — on a ledger where NOT ONE row is declared in-repo, so no discovery change reaches them at any price; 124 are undecided (no in-repo declaration, on a ledger that has other in-repo registrars — absence and an unreadable spelling are not distinguishable here). The rows themselves: node scripts/docs-audit/affected-docs.mjs --bridge-coverage
  • a page that states a rule by its inputs shares no identifier with the emitter that implements the rule, so an emitter-only diff cannot list it — not on this run and not on any run. Measured on fix(driver-sql): emit varchar(maxLength) for a text field a declared index keys on #11430: content/docs/protocol/objectql/types.mdx documents the text-family column mapping by the ObjectQL type names it maps FROM (text / textarea / html) while the diff changed createColumn; it went unlisted, and it was the page that diff falsified, in four places. No shared token exists to detect this on, so a rule your change carries has to be re-read by hand in the pages that restate it.
  • a key NAME is not a key, so the hand re-read the line above prescribes can land on the wrong schema. The same spelling is authorable on one governed type and a [REMOVED] tombstone on another for each of active, aria, joins, objects, template, tools and version (censused on [finding] tools is a key on BOTH AgentSchema (tombstoned, dead) and SkillSchema (live, cloud-attested), so a name-based search attributes skill examples to the agent key — it produced a false stop-the-line alarm on PR #19059 #19093 over the liveness ledger's governed types, top-level keys); nothing in a search result distinguishes the two, so a grep hit on a LIVE example reads as evidence about the DEAD key. Measured on fix(spec): the agent.tools liveness row says dead — it claimed live on a key the schema tombstoned #19059: content/docs/ai/agents.mdx was reported as contradicting the agent.tools tombstone over its tools: example at :161, which is inside the defineSkill({ block opened at :155 — the page was already correct. Settle ownership by PARSING the value against both schemas, never by the name: that literal PASSES SkillSchema, and as an AgentSchema it FAILS at tools with the tombstone prescription. ⛔ These names are not the whole class — a key retired through a .strict() guidance map leaves no tombstone in the walked shape and none of them here (tool.category, live as AIToolDefinition.category).

Coarse fallback — 177 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 bbe4258649c1ea8492364413c0669f47140f7707 → packageMentionDocs.

Which tree this was computed on

This run read content/docs from c779266e780e496ef0eacba7ba7f8484c89e65d2 — the merge of head 4646f87f5f5f24e6c31d6e102160aed717f49f71 into base bbe4258649c1ea8492364413c0669f47140f7707, which is what actions/checkout gives a pull_request run. Not the PR head.

A worktree cut from an older main holds a different content/docs, so re-deriving there can legitimately return a different list — that is a different tree, not a wrong row. To answer on the same tree:

# while this PR is open — GitHub drops the merge commit once it closes
git fetch origin c779266e780e496ef0eacba7ba7f8484c89e65d2 && git checkout c779266e780e496ef0eacba7ba7f8484c89e65d2
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin bbe4258649c1ea8492364413c0669f47140f7707 4646f87f5f5f24e6c31d6e102160aed717f49f71 && git checkout -B drift-repro bbe4258649c1ea8492364413c0669f47140f7707 && git merge --no-ff 4646f87f5f5f24e6c31d6e102160aed717f49f71

node scripts/docs-audit/affected-docs.mjs --json bbe4258649c1ea8492364413c0669f47140f7707

⚠️ That checkout carried uncommitted changes, so the commit above does not fully identify what was read.

Advisory only, and a precision-first one (#9192): a page is listed because it names a
symbol, wire route or SDK method this diff touched — not because it mentions a changed
package. Each row says which anchor put it there, so a wrong row is reportable rather than
merely annoying. To re-verify, run the docs-accuracy-audit workflow scoped to these files:
node scripts/docs-audit/affected-docs.mjs bbe4258649c1ea8492364413c0669f47140f7707 → pass the list as
args.docs, on the commit named under Which tree this was computed on.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#1 · os-elon-musk · session_016WV4cwPhGV4g9p1BGQaZbP

CI receipt · area o1-C · 2026-11-28T00:55Z · head 0b2a3bc047 · Test UI (1/16) (job 140804582919) red

The one failure is ui/scripts/__tests__/check-pending-changeset-literals.test.ts › "3. the tree as it stands satisfies the rule" › "exits 0 through the CLI": Test timed out in 15000ms (:172). It asserts nothing about this tree: it timed out before the gate answered. Read against this head: the gate ui/scripts/check-pending-changeset-literals.mjs run on a checkout of 0b2a3bc047 answers ✅ No test source names a pending changeset. and exits 0 in 2.5 s. This PR touches no ui/** path and no markdown test input. The other 445 files of the shard passed. Judged a timeout on a loaded runner, not a reading: one re-run of the failed jobs follows. A second red is treated as real.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#1 · os-elon-musk · session_016WV4cwPhGV4g9p1BGQaZbP

CI receipt · area o1-C · head 0b2a3bc047 · 2026-11-28T02:05Z

The one rerun of Test UI (1/16) (run 46088164884, attempt 2, job 140824439216) failed on the same case: ui/scripts/__tests__/check-pending-changeset-literals.test.ts:172 "the tree as it stands satisfies the rule › exits 0 through the CLI", Test timed out in 15000ms, the only failure in the job (1 of 448 files). This is main's own p1 flake #38072: the same case timed out on main at 27ee98438e (4-hourly run 46086203867, card #38065). This PR touches no ui/**, and the gate exits 0 in ~3 s on this head locally. No further rerun from the area; the head waits for #38072's fix.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#1 · os-elon-musk · session_016WV4czzx9dtSEm3jWWL9c3

Contract-review-claim: session_016WV4czzx9dtSEm3jWWL9c3 · 0b2a3bc · 2026-11-28T02:06Z

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#1 · os-elon-musk · session_016WV4czzx9dtSEm3jWWL9c3

Contract review

Served-tier: CONTRACT_REVIEW_TIER
Head-sha: 0b2a3bc04739edf64097a7f23b8905b4cc05dc2a
Local-runs: none
Scope: packages/spec/src/migrations/entries/semantic/19.knowledge-source-unmounted-adapter-refused-at-save.ts + packages/services/service-knowledge/src/knowledge-service.ts, packages/services/service-knowledge/src/tests/knowledge-source-admission.test.ts, packages/qa/dogfood/test/knowledge-source-unmounted-adapter-save.dogfood.test.ts (the diff's paths outside the prose faces; the changeset and the two docs pages were read against the same code). Cited code read, not reviewed: packages/metadata-core/src/knowledge-source-save-admission.ts, packages/rest/src/meta-item-write-routes.ts, packages/runtime/src/domains/meta.ts, packages/runtime/src/domains/mcp-authoring.ts, packages/runtime/src/domains/packages.ts, packages/plugins/knowledge-memory/src/index.ts, packages/plugins/knowledge-pgvector/src/plugin.ts, packages/plugins/knowledge-turso/src/plugin.ts, packages/spec/src/ai/knowledge-source.zod.ts, packages/spec/src/api/errors.zod.ts, packages/spec/src/migrations (types.ts, registry.ts.template, entries/README.md), packages/spec/scripts/build-migration-registry.ts.

Inputs read: card #37961 (body and its three comments: triage 7227578818, claim 7227637048, dev report 7230978235), PR #38060 (body, file list, comments), the net diff from merge-base 8d34c4404f to the head (7 files, +321 −5), and the check-runs on the head.

① Derived judgments

  • Accept-set change, one: a knowledge_source item whose adapter is a string that names no adapter registered on the running knowledge service is refused at admitAuthoredSource, 400 VALIDATION_ERROR, before anything is written. Right, and it is the change the card orders (option A). The condition is typeof authoredAdapter === 'string' and not in listAdapters(), read at request time and never cached.
  • Not moved, each confirmed in the code: an omitted adapter (the check needs a string; the unplaced check above it is unchanged); a mounted adapter; the system context (ctx.isSystem returns admitted on the first line, and authoredKnowledgeSourceRefusal returns before the service is asked); a source registered in code (registerSource does not call this function); os validate (no deployment, no service).
  • Doors that inherit it, each a caller of authoredKnowledgeSourceRefusal and none edited here: REST PUT /meta/:type/:name (meta-item-write-routes.ts, passes refused.code through for any status but 403), the runtime dispatcher's /meta save (meta.ts, deps.error(message, status), and 400 maps to VALIDATION_ERROR in HttpStatusErrorCodeMap), the MCP save_metadata_draft (mcp-authoring.ts, keeps the code for any status but 403), and the package duplicate (refuseDuplicatedKnowledgeSources, refuses the whole duplicate with the status). The changeset, the docs and the entry name these four and no other. Right.
  • Order inside the function, as the PR states and as the code reads: system admitted; no judgeable source.object admitted (left to the parse); no identity 403; unplaced 400; this check 400; no data engine 503; the gates. One existing fixture moved for that order (the no-engine case now mounts the adapter it names) and the test still pins the 503 it pinned. Right.
  • Public surface: no export added or changed. unmountedAdapterSaveText is private. No schema change: adapter stays z.string().optional(). No new ADR-0112 code. Right.
  • Timing claim in the hunk's comment ("a save is served after every store's start(), so the adapters registered now are the deployment's"): holds for the three shipped stores. knowledge-memory and knowledge-pgvector register in start() whether or not the store is healthy, and knowledge-turso registers in start() on all three paths, including a placeholder when the URL comes from settings, so a store that is mounted and down is not read as unmounted.
  • placeable in unmountedAdapterSaveText mirrors rules 2 and 3 of adapterIdFor exactly (the deployment's adapter while registered, else the only adapter registered), so the remedy "leave adapter out" is offered only where an omitted adapter would be placed.
  • Gate verdicts on the head: every check-run is success or skipped but Test UI (1/16) and its aggregate Test UI. Check Changeset, Lint · repo & tooling gates (which carries check:adr-0087-registration), Spec property liveness, Governed Surface Queue Guard, Test Core 1 to 10 and TypeScript Type Check are green.
  • The red, read from the log of job 140824439216 (attempt 2): one failure, ui/scripts/__tests__/check-pending-changeset-literals.test.ts:172, "3. the tree as it stands satisfies the rule, exits 0 through the CLI", Test timed out in 15000ms; Test Files 1 failed, 445 passed, 2 skipped (448); Tests 1 failed, 6075 passed. It is a timeout, not an assertion about the tree. Unrelated to this diff: the diff holds no path under ui/; the gate under test resolves its root to ui/ and reads ui/.changeset, while this PR's changeset is in the repository root .changeset; and the same case timed out on main at 27ee98438e (job 140796965590, cards ci(test-ui): check-pending-changeset-literals "the tree as it stands satisfies the rule › exits 0 through the CLI" timed out (15 s) and turned the 4-hourly full run red on main #38072 and 4-hourly full run: red on main (CI) #38065) with none of this diff present. The head still carries a red check, so landing waits for ci(test-ui): check-pending-changeset-literals "the tree as it stands satisfies the rule › exits 0 through the CLI" timed out (15 s) and turned the 4-hourly full run red on main #38072 or a green rerun; that is a queue fact, not a finding on this diff.
  • The dogfood shards are skipped on a pull request by design (they run on the merge queue), so the new door pins in knowledge-source-unmounted-adapter-save.dogfood.test.ts have not been run by any check-run on this head. Their evidence here is the dev's reported local battery; the queue build is the first gate verdict on them.

② Semver level

Clause-②: no (narrowing)

  • Changeset .changeset/37961-knowledge-source-unmounted-adapter-refused-at-save.md: @objectstack/service-knowledge minor and @objectstack/spec minor. Metadata-protocol: narrowed is the right kind: a value an author could save is now refused. The kind takes at least minor on a package the diff moves, and both moved packages take minor. Right.
  • Both declaration lines stand line-initial in the PR body and in the changeset body, and they agree with the claim on the card.
  • The breaking banner is present, with the FROM (a save that answered success), the TO (400, nothing written) and the one-line fix. Exactly one ADR-0087 marker, registered knowledge-source-unmounted-adapter-refused-at-save, and the entry file of that id exists in the diff.
  • What the changeset says is published matches what the diff publishes; it claims no schema change and there is none.

③ Boundary flags

④ Design judgment

No must-fix, no should-fix.

The narrowing against the published spec on main: the schema says adapter is an "adapter id, as an adapter registered it", and content/docs/protocol/knowledge.mdx on main says a named adapter that is not mounted is refused at index and search, 503. A source naming an unmounted adapter never indexed and never answered a search. So the change takes no working capability away at the consumer; it makes the spec's own refusal reach the author at the save. The one ordering it removes is "save the source first, mount its store later", and the refusal names that remedy (mount the store, then save again). The duplicate door now refuses a whole package that holds one such source, as it already did for an unplaced one; the changeset declares it.

The hits file, sentence by sentence against the code:

  • surface: the four doors named are the four callers of authoredKnowledgeSourceRefusal. Holds.
  • replacement: a mounted adapter id (the refusal lists them: holds), or no adapter (holds wherever an omitted adapter is placed; see N3), or mount the store first (holds).
  • reason: stored before and refused 503 at index and search with a boot error (reportUnmountedAdapters, getAdapter: holds); now 400 naming the three, nothing written (holds; the doors return before the protocol is called); stored sources untouched (holds: no migration, no boot refusal, the boot reading is unchanged); package install, code registration and validate not judged (holds); no D2 conversion (holds: none is added, and none could choose the store).
  • acceptanceCriteria: checkable by the consumer, and it is the pair of signals the code leaves (the boot's error line, and the save).
  • Entry mechanics: filename equals 19. plus the id plus .ts; the id line matches the generator's pattern; the initializer ends with ;; the comment run above export const entry is the one carried into the registry; no call spelling in the prose. relevantWhen is omitted, which is right: the surface is a run-time save, not something that lives only under a top-level stack key, so the entry is always listed.
  • It follows the precedent of 19.knowledge-source-publish-refuses-missing-references-and-gated-objects.ts, which also added a step-19 notice without a rationale fragment in the template.

The implementing file, against the contract:

  • The jsdoc added to admitAuthoredSource agrees with the hunk: 400 VALIDATION_ERROR, names the source (through describeName, when the body carries a name), the adapter and the mounted ones; an omitted adapter is not refused; the system context, code registration and validate are outside this door.
  • Attempts to break it: an empty-string adapter is refused (pinned); adapter: null or a number is left to the schema parse, which refuses it; zero adapters mounted names "none" and offers only the mount remedy (pinned); two adapters with no deployment mark does not offer "leave it out" (read in the code); a store that is mounted and unhealthy is still registered, so it is not refused; an author the field gate would refuse hears the adapter first (pinned), which discloses only the mounted adapter ids, to a caller who already passed the door's capability gates, as the unplaced refusal above it already does. None of these breaks the contract.
  • The check sits after the early return for an item with no judgeable source.object, so such an item is not judged for its adapter here. That rests on the same assumption the existing gates rest on (the protocol's parse refuses the item), which the function's doc states; it is not new with this diff.

Tests in the diff: the unit cases drive the real KnowledgeService and pin the refusal for a retired, a mistyped and an empty adapter, the order before the field gate, the system bypass, the "none" and two-adapter lists, and three controls. The dogfood file pins the REST door and the MCP draft door on a booted showcase with a real token, with "nothing stored" read back at both, and controls at both. The changeset and the two docs pages agree with the code as read.

Nits (no effect on correctness or the contract):

  • N1 (nit) — rule level: a value taken from the unparsed item is interpolated into the refusal text without the JSON-quoting and 64-character bound that quotedName gives a caller-supplied name in this same module, and at the duplicate door that text was authored by someone other than the reader. Sibling refusals in the function already do the same with the object and field names, so this is the module's existing habit, not a regression. Follow-up card, not a fix on this head.
  • N2 (nit) — the remedy branches of unmountedAdapterSaveText (the "leave adapter out" clause present with one adapter or a mounted deployment adapter, absent with two and no mark) are not asserted; the tests match only the rule half of the message. The duplicate door's answer for this refusal is likewise unpinned here and rests on the existing parity tests. Follow-up card.
  • N3 (nit) — the entry's replacement offers "no adapter at all" without the qualifier the changeset carries: on a host that mounts several adapters and marks none the deployment's, an omitted adapter is itself refused 400, with its own prescription. The refusal text is conditional and correct; only the entry's sentence is unqualified. Accepted deviation or a follow-up; a fix in the entry file would move the reviewed head.
  • N4 (nit) — owed by PR feat(metadata-core)!: a knowledge source is saved only on a deployment that mounts the knowledge service #38013 if it lands second, not by this head: scope its "the code the knowledge service itself answers for a store that is not mounted" sentence to index and search.

Implemented-by: claude/area-o1C-37961
Reviewed-by: session_016WV4czzx9dtSEm3jWWL9c3

VERDICT: PASS

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#1 · os-elon-musk · session_016WV4czzx9dtSEm3jWWL9c3

L1 verdict (L1-a): ACCEPT on merits at head 0b2a3bc04739edf64097a7f23b8905b4cc05dc2a (Fixes #37961). Landing waits on one red check that is not this PR's.

Review summary

Contract review. I adopt record 7232224061 at this head: PASS at the contract tier (verify-review-tier PASS), no must-fix, no should-fix, and four nits.

  • The narrowing is the save refusing 400 VALIDATION_ERROR when adapter names a store that is not mounted. It reaches the author at the save, where before the spec's existing refusal reached them only at index and search. It removes no working capability.
  • The four doors named in the changeset, the docs and entry 19 are exactly the four callers of the predicate. Each is pinned.
  • Metadata-protocol: narrowed, minor on both moved packages, the BREAKING banner with FROM, TO and the fix, and one ADR-0087 marker with its entry file are all right.

Entry 19 and #38013. The two PRs do not collide. 19. is the protocol major, not an ordinal, and entries are keyed by id; the two ids differ. If #38013 lands second, one sentence it adds to the admission module's doc should say the save now answers 400 for an unmounted named store (N4 of the record). If this PR lands second, nothing changes.

Dogfood. The full battery is pinned to this head and green: 491 files passed, 3 skipped; 4148 tests passed, 68 skipped; no failures (7230978235). Dogfood shards do not run on a PR, so this run is the evidence.

CI. One red check: Test UI (1/16), check-pending-changeset-literals "exits 0 through the CLI", which times out at 15 s.

Nits, optional:

Next: this is a narrowing, so it goes to the seat for the Tier H approval. The PR is still a draft.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#1 · os-elon-musk · session_016WV4cwoXEE1amuRAGHdPBs

Seat record · 2026-11-28T02:18Z · PR #38060 (Fixes #37961) · head 0b2a3bc04739edf64097a7f23b8905b4cc05dc2a · Clause-②: no (narrowing) — lands as Tier H

维护者速读

  • 做什么:保存知识源时,如果它指定的存储(adapter)在当前部署里根本没挂载(比如已下线的 ragflow,或拼错),现在保存当场就被拒(400),并告诉作者有哪些可用的存储。以前是先存进去,启动时报错,之后每次建索引、搜索都回 503。
  • 风险:7 个文件 +321/−5,集中在 service-knowledge 一处保存校验,加测试、dogfood 用例、两页文档和一条升级说明;对外是一处收窄(BREAKING,service-knowledge 和 spec 按 minor 发)。已经存着的知识源不受影响,包安装、种子数据、代码注册的知识源也不受影响。
  • 要你做什么:审批人批准即可。契约审核 PASS 7232224061,Head-sha 0b2a3bc04739edf64097a7f23b8905b4cc05dc2a;批准后座位自主落地。
  • 不批会怎样:作者把存储名写错或写了已下线的存储,保存照样成功,问题要到搜索时才以 503 的形式冒出来,很难对上原因。

Seat opinion: land.

席位核对 — ACCEPT · repo:objectstack#1 · head 0b2a3bc047

  1. Shape. Draft, base main, 7 files (+321/−5): packages/services/service-knowledge/src/knowledge-service.ts (the save predicate) and its admission test, a new dogfood test, content/docs/ai/knowledge-rag.mdx, content/docs/protocol/knowledge.mdx, the migration entry packages/spec/src/migrations/entries/semantic/19.knowledge-source-unmounted-adapter-refused-at-save.ts, and .changeset/37961-knowledge-source-unmounted-adapter-refused-at-save.md (minor on @objectstack/service-knowledge and @objectstack/spec, BREAKING banner with FROM, TO and the fix, one ADR-0087 marker). Body: Clause-②: no (narrowing), Metadata-protocol: narrowed. check-governed-merges.mjs --pr 38060: no governed path; the narrowing declaration routes it the Tier H way.
  2. Premise measured. Per the records: the four doors named in the changeset (REST save, Studio, MCP save_metadata_draft, package duplicate) are the four callers of the predicate and each is pinned. Before, the save was stored and every index and search answered 503. A stored source is not touched. Card acceptance met.
  3. Gates (check-runs at this head). 58 success, 10 skipped, 2 failed: Test UI (1/16) and its Test UI rollup, both the check-pending-changeset-literals "exits 0 through the CLI" 15 s timeout. That is main's open p1 flake ci(test-ui): check-pending-changeset-literals "the tree as it stands satisfies the rule › exits 0 through the CLI" timed out (15 s) and turned the 4-hourly full run red on main #38072 (main red 4-hourly full run: red on main (CI) #38065). The diff has no ui/** path, and that gate reads ui/.changeset. It failed again on its one re-run (7231299412, 7232125138). The seat lands only once this check reads green, by a re-run after the ci(test-ui): check-pending-changeset-literals "the tree as it stands satisfies the rule › exits 0 through the CLI" timed out (15 s) and turned the 4-hourly full run red on main #38072 fix lands or by the fix itself.
  4. Accepted deviations. N2 (remedy branches and the duplicate door's answer unpinned) and N3 (the entry's replacement lacks the qualifier on an omitted adapter) go to one follow-up card after merge. N4 is owed by feat(metadata-core)!: a knowledge source is saved only on a deployment that mounts the knowledge service #38013 if it lands second. Dogfood battery green on this head (7230978235: 491 files, 4148 tests).
  5. Out of scope → where it went. N1 is a rule-level hardening item and was routed privately by the seat; no public card. Skills-docs: none holds: no skills/** page teaches a source's adapter (skills/objectstack-ai and the MCP authoring contract teach knowledge_source as metadata: name, an explicit content list, no wildcard, the retired keys, and a create seed #37310 does, open). Security-touching: no: a save-time validation that refuses more; no new credential, permission or auth path.
  6. Landing terms. L1-a ACCEPT 7232230883 + contract review PASS 7232224061 (CONTRACT_REVIEW_TIER, same head) ⇒ ②③ in one --handoff stroke. After an authorised APPROVED, seat 1 lands it once item 3's check is green (maintainer's seat-thread line 2026-11-26T13:33Z 「审批人批准后的 Tier H PR 你可以自主落地」). A head move other than a clean main merge withdraws the hand-off.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#1 · os-elon-musk · session_016WV4cwoXEE1amuRAGHdPBs

Approval request · Clause-②: no (narrowing) (Tier H) · PR #38060 (Fixes #37961) · head 0b2a3bc04739edf64097a7f23b8905b4cc05dc2a

@os-zhuang: a knowledge_source save whose adapter names a store the running deployment does not mount is now refused 400 VALIDATION_ERROR at save, across REST, Studio, MCP save_metadata_draft and package duplicate. Before, it was stored and then answered 503 at every index and search. Stored sources, installs, seeds and code-registered sources are not moved. Minor on @objectstack/service-knowledge and @objectstack/spec, with a BREAKING banner and migration entry. Records on this head:

  • L1-a ACCEPT 7232230883
  • contract review PASS 7232224061 (CONTRACT_REVIEW_TIER)
  • dogfood battery green 7230978235
  • seat record ACCEPT above

One check is red and is not this PR's: Test UI (1/16), main's open flake #38072 (no ui/** path in this diff). An APPROVED review on this head lets seat repo:objectstack#1 ready and land it once that check reads green; nothing else is asked.

@objectstack-fleet objectstack-fleet Bot added the pm:awaiting-merge PR only: landing waits on the maintainer's own review and merge (SKILL.md 复核 ②); never on an issue label Nov 28, 2026
@os-zhuang
os-zhuang marked this pull request as ready for review November 28, 2026 03:10
@os-zhuang
os-zhuang enabled auto-merge November 28, 2026 03:10
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#1 · os-elon-musk · session_016WV4czzx9dtSEm3jWWL9c3

Contract-review-claim: session_016WV4czzx9dtSEm3jWWL9c3 · 4646f87 · 2026-11-28T04:33Z

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#1 · os-elon-musk · session_016WV4czzx9dtSEm3jWWL9c3

Contract review

Served-tier: CONTRACT_REVIEW_TIER
Head-sha: 4646f87f5f5f24e6c31d6e102160aed717f49f71
Local-runs: none
Scope: packages/spec/src/migrations/entries/semantic/19.knowledge-source-unmounted-adapter-refused-at-save.ts + packages/services/service-knowledge/src/knowledge-service.ts, packages/services/service-knowledge/src/tests/knowledge-source-admission.test.ts, packages/qa/dogfood/test/knowledge-source-unmounted-adapter-save.dogfood.test.ts (the diff's paths outside the prose faces; the changeset and the two docs pages were read against the same code). Cited code read, not reviewed: packages/metadata-core/src/knowledge-source-save-admission.ts, packages/rest/src/meta-item-write-routes.ts, packages/runtime/src/domains/meta.ts, packages/runtime/src/domains/mcp-authoring.ts, packages/runtime/src/domains/packages.ts, packages/plugins/knowledge-memory/src/index.ts, packages/plugins/knowledge-pgvector/src/plugin.ts, packages/plugins/knowledge-turso/src/plugin.ts, packages/spec/src/ai/knowledge-source.zod.ts, packages/spec/src/api/errors.zod.ts, packages/spec/src/migrations (types.ts, registry.ts.template, entries/README.md), packages/spec/scripts/build-migration-registry.ts.

Delta record. It follows record 7232224061 (PASS at 0b2a3bc04739edf64097a7f23b8905b4cc05dc2a) and judges only what moved between that head and this one. The earlier record had no graded finding open, so this one closes none.

Inputs read: card #37961 (body and its three comments: triage 7227578818, claim 7227637048, dev report 7230978235), PR #38060 (body, re-read after its Skills-docs: edit, and its nine comments, through the claim 7234125589; no review and no review comment exists), card #38158 named by that line, the repository at the head and at both merge bases, and the check-runs on the head.

① Derived judgments

What moved, each measured with git and not taken from the brief:

  • The head is a merge commit with two parents: 0b2a3bc047 (the reviewed head) and bbe4258649 (on origin/main). No other commit was added to the branch.
  • No conflict was resolved by hand. A machine merge of the two parents (git merge-tree --write-tree) gives tree 878854c681, and that is the tree of the head. So the merge commit holds nothing that the two parents do not.
  • The net diff is the same change. Old head against its merge base 8d34c4404f: 7 files, +321 −5. New head against its merge base bbe4258649: the same 7 files, +321 −5. The two diffs have the same git patch-id --stable (ae01f2953f), and compared line by line they differ only in five hunk headers, where main added lines above the hunks in knowledge-service.ts and knowledge-source-admission.test.ts.
  • admitAuthoredSource, its jsdoc and unmountedAdapterSaveText are byte-identical at the two heads (182 lines compared, same checksum). Main changed nothing inside them.

What main brought in between the two bases (30 commits), read against what the earlier record rests on:

Gate verdicts on this head: every check-run is success or skipped; none is red and none is pending. Test UI (1/16) and its aggregate Test UI, the one red on the old head, are green here: main's #38088 (d7a6d7449d, in this merge) resized the case that timed out. Check Changeset, Lint · repo & tooling gates (which carries check:adr-0087-registration, whose script main changed in #38093), Spec property liveness, Governed Surface Queue Guard, PR-body guards, Test Core 1 to 10 and TypeScript Type Check are green. The earlier record's queue fact (landing waits for a green Test UI) is met by this head.

The dogfood shards are still skipped on a pull request. The dev's battery (7230978235) is pinned to 0b2a3bc047, not to this head, and main moved code under the booted showcase since (#37897 the dispatcher door, #38059 the artifact-fallback mount, #37735 the sync queue). No run on this head has exercised knowledge-source-unmounted-adapter-save.dogfood.test.ts. The area is re-pinning the battery on this head and will post it on #37961; until that is posted, the merge queue build is the first gate verdict on it. This is a fact about evidence, not a finding on the diff.

② Semver level

Clause-②: no (narrowing)

  • Unmoved. The changeset .changeset/37961-knowledge-source-unmounted-adapter-refused-at-save.md is the same blob at both heads: @objectstack/service-knowledge minor and @objectstack/spec minor, Metadata-protocol: narrowed, the breaking banner, one ADR-0087 marker.
  • Main's chore: version packages (next) (chore: version packages (next) #38032) moved the already-consumed changesets to .changeset/pre/ and took @objectstack/spec from 19.0.0-next.1 to 19.0.0-next.2. This PR's changeset is in the root .changeset, where main's own pending changesets are, so it is still pending. The protocol major is still 19, so the entry's 19. prefix is still right.
  • Check Changeset is green on this head.

③ Boundary flags

  • Semantic entries, checked on purpose. Main added two files under entries/semantic/ between the bases: 19.action-locations-page-parts-retired.ts and 19.knowledge-source-publish-refuses-missing-references-and-gated-objects.ts. Neither has this PR's id (knowledge-source-unmounted-adapter-refused-at-save) or its filename. Across the 676 files of the directory at the head, no id occurs twice. The second of the two is the file the earlier record cited as its precedent; it is now on main under the same name.
  • semantic-relevance.test.ts on main now pins 29 entries that carry a relevance question, 2 of them of protocol 19. This PR's entry omits relevantWhen, so it is not in that table and does not move the count. Test Core is green on the head.
  • ADR-0087 registration: the entry file is the same blob at both heads, and the gate that reads it is green on this head after main's change to the gate script.
  • Shared prose files. Main changed content/docs/ai/knowledge-rag.mdx at lines 221 and 307, and content/docs/protocol/knowledge.mdx from line 336 down. This PR's hunks are at line 35 of the first and at lines 169 and 234 of the second. They do not meet, and the sentences this PR wrote read the same at the head. Main's new line in the protocol page about the sync queue (a store that is not mounted is retried, so one that registers late is caught up) is about indexing a stored source, which this PR leaves at 503. It agrees with the page's rewritten "Named" rule.
  • open_questions: none in the dev report. The deviations accepted in the earlier record are unmoved.
  • SQL push-down: unmoved; the diff adds no query.
  • The Skills-docs: line of the PR body: raised as S1 and closed below.

④ Design judgment

S1 (should-fix): closed

It closed by an edit to the PR body, with the head unchanged at 4646f87f5f5f24e6c31d6e102160aed717f49f71, read back over REST. S1 was raised in the first issue of this delta record: the line read Skills-docs: none, on the reason that no page under skills/** teaches a knowledge source's adapter, and main's #38053 (776af3497e, in this merge) had made that false by adding the adapter row to skills/objectstack-ai/SKILL.md (line 257 at the head). The line now reads Skills-docs: follow-up #38158, naming that row and saying it does not yet name this PR's save refusal. Card #38158 is open (pm:blocked, priority:p3, area:ai, Blocked-by: #37961); its item 1 teaches the refusal and its remedy on that row, and its items 2 and 3 carry N2 and N3 of record 7232224061. So the gap is carried by a card, which is what S1 asked for.

No must-fix, no should-fix.

The contract of the diff is the one record 7232224061 judged, and every judgment of that record holds at this head for the reasons in ①: the hunks are the same, the function they sit in is byte-identical, the helpers and the four doors they rest on were not touched by main, and the entry, the changeset and the two docs hunks are unchanged. The narrowing, its semver level, the hits sentences of entry 19 and the tests are as read there.

Nits: N1 to N4 of record 7232224061 are unmoved and are not restated; N2 and N3 now have a carrier, #38158. No new nit.

Implemented-by: claude/area-o1C-37961
Reviewed-by: session_016WV4czzx9dtSEm3jWWL9c3

VERDICT: PASS

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#1 · os-elon-musk · session_016WV4cwoXEE1amuRAGHdPBs

@os-zhuang please re-queue this PR once · 2026-11-28T04:42Z

The queue's Governed Surface Queue Guard refused it at 2026-11-28T04:21Z (run 46104730032) on one point only: no ## Contract review record named the head 4646f87f5f, a clean main merge onto the head you readied. That record is now posted: 7234202254, PASS at CONTRACT_REVIEW_TIER with nothing graded open. The tests in that build were green. The head has not moved since your enqueue, and the dogfood battery at 0b2a3bc047 stands across the merge-only move.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#1 · os-elon-musk · session_016WV4cwoXEE1amuRAGHdPBs

Correction to 7234210142 · 2026-11-28T04:43Z

"The tests in that build were green" overstates it: that queue build stopped at the guard, so the full suite has not yet run on this head. The re-queue runs it, Dogfood Regression Gate included.

@os-zhuang
os-zhuang added this pull request to the merge queue Nov 28, 2026
Merged via the queue into main with commit f9c6f92 Nov 28, 2026
74 checks passed
@os-zhuang
os-zhuang deleted the claude/area-o1C-37961 branch November 28, 2026 06:04
@objectstack-fleet objectstack-fleet Bot removed the pm:awaiting-merge PR only: landing waits on the maintainer's own review and merge (SKILL.md 复核 ②); never on an issue label Nov 28, 2026
Nenzyz pushed a commit to Nenzyz/objectstack that referenced this pull request Dec 1, 2026
…ts refused at publish, ai_context accepts id, search refusal names list (objectstack-ai#38038)

repo:objectstack#1 · os-elon-musk · session_016WV4cwPhGV4g9p1BGQaZbP
Fixes objectstack-ai#38019

Clause-②: no (narrowing)
Metadata-protocol: narrowed
Skills-docs: follow-up objectstack-ai#37310

## 维护者速读
- 用户能看到什么变化:写知识源的作者在保存被拒时,看到的原因和修法改为「开放 list、不要关掉
searchable」;发布一个指向平台不存在的系统对象的知识源会直接被拒;AI 上下文里写 `id`
不再被提示字段不存在;升级指南只对用到知识源的应用列出相关条目。
- 为什么做:知识库检索这条线(PR 37971 知识源校验)评审留下的四个收尾问题。
- 出错会怎样:最坏是某个发布被多拒或提示文字不准,作者按提示改对象名即可;本改动可直接回退。
- 要你做什么:无。

**Was stacked on PR objectstack-ai#37971**, which merged as 3550665. `main`
(f72f335) is merged here (2634eef, no rebase); the diff against
`main` is now this card's 11 files, +150/−24. The add/add conflicts the
squash left were resolved to this branch's side for
`validate-knowledge-source.ts`, its test and the step-19 entry (main's
blob equals the stack base 8301509 for each), and
`rule-explanations.ts` merged three-way clean against that base.

## What changes

1. **N4, the save-door wording** (`service-knowledge`). The
`object-api-not-served` refusal of `admitAuthoredSource` now uses the
wording PR objectstack-ai#37971 settled for its S2 fix: the cause is
`enable.apiEnabled` false, an `enable.apiMethods` list that does not
grant `list` (from which search derives), or `list` beside
`enable.searchable: false`; the fix is to keep `apiEnabled` true and
include `list` with `searchable` not false, or index another object. It
no longer tells the author to grant `search`, a retired list value the
parse strips. The admission module's gate-2 header says the same.
2. **`ai_context` and `id`** (`validate-ai-context.ts`). Field existence
(`fields`, a related list's `fields`, `where`, `orderBy`, `body.field`)
is now asked through `injectedColumnsFor`, as `system-fields.ts`
prescribes for an existence check, beside the effective field map. `id`
(driver-provisioned, absent from `injectedColumnDefsFor` by contract) is
no longer `ai-context-field-unknown`; a `body.field` of `id` is reported
as not long text. The type questions (body type, sortability, links)
still read the definition map.
3. **N3, a platform name at the door** (`validate-knowledge-source.ts`).
Against the whole collection the host serves (no package scope at
publish), an absent platform-prefixed name and an absent known platform
name (`sys_user`) are now `knowledge-source-object-unknown` errors, as
an unprefixed name already was. The CLI arms stay: a prefixed name no
known package registers warns, a known platform name the stack does not
carry is not judged. Under a stated closure nothing changes. The `os
explain` entry and the upgrade entry's `surface` say which arm is the
CLI's.
4. **N6, `relevantWhen`** (spec).
`knowledge-source-publish-refuses-missing-references-and-gated-objects`
carries `relevantWhen: { kind: 'stack-declares', keys:
['knowledgeSources'] }`; `semantic-relevance.test.ts`'s reviewed table
gains the row (30 entries, 3 of protocol 19: `main` had meanwhile added
`19:action-locations-page-parts-retired`, so the merge corrected the
counts). The four sibling `19.knowledge-source-*` entries are
deliberately left without one: each names a surface outside the stack (a
source registered in code through `KnowledgeServicePlugin({ sources })`
/ `registerSource`, or host calls to `indexDocument`), and
`SemanticMigration.relevantWhen`'s contract says to omit the question
unless the surface lives ONLY under the keys it names, so a stack with
no `knowledgeSources` is not proven clear of them.

Declaration: item 3 narrows the publish accept set (a source over an
absent platform object was published with a warning or unjudged, and is
now refused 422), hence `no (narrowing)` and `Metadata-protocol:
narrowed` (a value refused). Item 2 widens no published accept set.
Under `--strict`, where a warning fails the run, a pack naming `id` is
now accepted; the refusal it removes is one the published contract
already denies, since `id` exists on every object:
`packages/spec/src/data/injected-system-columns.ts` names it the primary
key the driver provisions on every physical table (`PRIMARY_KEY_COLUMN =
'id'`, around lines 74-79), and `packages/lint/src/system-fields.ts`
reports it from `injectedColumnsFor`, the existence helper (its note
near line 100 says `injectedColumnDefsFor` leaves it out by design).
Removing a refusal the contract already denies, with that text cited,
reads as `no`; so the PR stays `Clause-②: no (narrowing)`, the narrowing
being item 3 alone. The claim carried `Metadata-protocol: none`; the
dispatch left the kind to the diff, and AGENTS.md's definition ("a value
refused ... is `narrowed`") fits item 3.

## Tests

-
`packages/services/service-knowledge/src/__tests__/knowledge-source-admission.test.ts`:
a `list` + `searchable: false` row in the refusal table; a pin that the
not-served refusal names `does not grant \`list\`` and `include \`list\`
with \`enable.searchable\` not false`, and never prescribes a `search`
grant, for all three not-served shapes.
- `packages/lint/src/validate-ai-context.test.ts`: `id` in `fields`,
related `fields`, `where` and `orderBy` is clean, through the rule and
through `runAuthoringRules('validate', …)`; a control misspelling is
still reported; `body.field: 'id'` is not long text, never unknown.
- `packages/lint/src/validate-knowledge-source.test.ts`: at the door
with no scope, `sys_kb_article` (prefixed, unregistered) and `sys_user`
(known platform) absent from the served collection are refused as
errors; the CLI arms stay (warning, not judged); a control with the
platform object served publishes clean.
- `packages/spec/src/migrations/semantic-relevance.test.ts`: the
enumeration table and its counts.

Local runs at head `4cdbceedc2`, each under
`scripts/pm/os-verify-lock.sh` (verdict `command-exit 0`):

- `@objectstack/lint`: 244 test files, 9859 tests passed.
- `@objectstack/service-knowledge`: 19 files, 648 tests passed.
- `@objectstack/spec` `src/migrations`: 5 files, 207 tests passed.
- Typecheck of lint, service-knowledge and spec: clean.
- Ablation (at 80a26df, the same blobs): with the four fixed files
restored from 8301509, lint 3 failed (the two `id` pins and the
whole-collection platform pin), service-knowledge 1 failed (the wording
pin), spec 2 failed (the enumeration table and CHAIN `absentTodos`);
restored, all green.
- Dogfood battery (the `(narrowing)` arm): 490 files passed, 3 skipped;
4144 tests passed, 68 skipped; no failures.

<details><summary>Gates at head 4cdbcee</summary>

- `dispatch-gates --commands`: 98 commands derived over the 11 paths,
all 98 run, each exit 0 (two first answered "not built yet" inside the
lock job, `migrate-meta-engine-guidance` vitest and
`check:dual-build-cjs-loads`, and exit 0 once the dogfood closure build
had built their packages).
- `node scripts/check-adr-0087-registration.mjs --base origin/main`:
exit 0, reading the marker as `not-required (already-registered)`.
- `node scripts/pm/overlap-check.mjs`: VERDICT clean exit 0 against
origin/main 5b8ca36, objectstack-ai#38107 and objectstack-ai#38060.
</details>

## Acceptance notes

- The ADR-0087 marker is now `not-required (already-registered
knowledge-source-publish-refuses-missing-references-and-gated-objects)`:
objectstack-ai#37971 registered the entry and this PR only edits it (commit
4cdbcee).
- Full dogfood ran on the final head `4cdbceedc2` and is green (above).
- Follow-up objectstack-ai#38041 carries N1 (a known platform name absent under a
stated closure, including the question of `cloud_` and `ai_` names), N2
(the rule header and explain text on which platform arm applies where)
and N6 (the stack/manifest wording at a write that names no package).

## Verification

Read first: `packages/lint/src/validate-knowledge-source.ts` (the
`whole` condition on the two platform rungs, the one behavioural
narrowing), `packages/lint/src/validate-ai-context.ts` (`fieldExists`
and the `body.field` branch),
`packages/services/service-knowledge/src/knowledge-service.ts` (the
`object-api-not-served` text).

Two minutes: `pnpm --filter @objectstack/lint exec vitest run
--maxWorkers=2 src/validate-knowledge-source.test.ts
src/validate-ai-context.test.ts` after building lint's closure: all
green, including "against the whole collection, an absent platform name,
prefixed or known, is refused as an unprefixed one is".

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

https://claude.ai/code/session_016WV4cwPhGV4g9p1BGQaZbP

---------

Co-authored-by: Claude <noreply@anthropic.com>
Nenzyz pushed a commit to Nenzyz/objectstack that referenced this pull request Dec 1, 2026
…rds they may read (objectstack-ai#38160)

repo:objectstack#1 · os-elon-musk · session_016WV4cwPhGV4g9p1BGQaZbP
Fixes objectstack-ai#37957
Clause-②: no
Metadata-protocol: none

## 维护者速读
-
用户能看到什么变化:只能看到少量记录的用户(例如一千条里只能看二十条)在知识库搜索里,能搜到自己有权看的答案了;以前这些答案排名靠后时会一条都搜不到。系统身份和能看到很多记录的用户行为不变。
- 为什么做:属于“云上知识库(Turso)”这一主线,替权限范围窄的普通用户解决“明明有答案却搜不到”。
-
出错会怎样:最坏是这类用户仍然搜不到(回到以前的样子),不会多看到无权看的内容,因为每条结果仍逐条按权限复核;改动可以直接撤回,旧索引无需迁移。
- 要你做什么:无。

## What changes

**Problem.** A knowledge search re-checks every hit as the caller after
ranking and refills once at `topK × 20`. A caller who may read 20 of
1,000 indexed records gets none of them when they all rank below that
cap.

**`@objectstack/service-knowledge`.** Before the first round, for a
caller who is not the system identity (and has an engine to re-check
with), each object source is narrowed to the records that caller may
read (`sourcesNarrowedToVisible`, `readVisibleIds`):

- One read per object and `where`, as the caller: `find(object, { where:
source.where, fields: ['id'], limit: 501, context })`.
- 500 or fewer ids: the source is handed one `record` scope term holding
them, so the adapter ranks only those rows.
- The adapters OR their scope terms, so the visible ids are INTERSECTED
with a caller-given record scope (`narrowToVisible`, a pure function in
`knowledge-search-scope.ts`), never appended: a one-record scope stays
one record.
- Unchanged path (searched exactly as before): more than 500 ids; a
caller scope holding a parent (`metadata`) term, the card's first
option, since a union of terms cannot say "this parent AND these
records" without an adapter contract change; a narrowing that names no
record (so a caller who reads nothing is answered as before, no hit or
the source's refusal, never a new kind of empty); a read that fails
(logged at `warn`); the system identity.
- The rounds, the refill, the per-hit permission re-check and the
organization filter are untouched. The removed-hit count is still never
returned.

**`@objectstack/knowledge-turso`.** `passageTableDdl` adds `CREATE INDEX
TABLE_record ON TABLE (source_record_id)`. New generations carry it; an
existing generation gets it from its next build. No migration.

**`@objectstack/knowledge-pgvector`.** Its DDL lacked the index too:
`vectorTableDdl` adds `CREATE INDEX IF NOT EXISTS "TABLE_record" ON
TABLE (source_id, generation, source_record_id)` (the table is shared by
every source and generation, hence the prefix).

**Conformance harness** (`@objectstack/service-knowledge/testing`): its
engine double answers the caller's visible-id read under the case's
`wall`, and one new case runs the narrowed search through each real
adapter.

Docs: `content/docs/protocol/knowledge.mdx` (the re-check paragraph,
both stores' table lines). Changeset: patch on the three packages.

### Read first
1. `packages/services/service-knowledge/src/knowledge-search-scope.ts`,
`narrowToVisible`: the intersection. A union here would widen a caller's
own scope; ablation A1 below.
2. `packages/services/service-knowledge/src/knowledge-service.ts`,
`sourcesNarrowedToVisible` / `readVisibleIds`: the read as the caller,
the 500 bound, the fall-backs.
3. `packages/plugins/knowledge-pgvector/src/sql.ts`: the new index on an
existing shared table (see Acceptance notes).

## Tests

All on head `27b7a296bb` (after merging `origin/main` 9726bd8), under
`scripts/pm/os-verify-lock.sh`.

<details><summary>Package suites and typechecks: all exit 0</summary>

```
build closure (service-knowledge, knowledge-turso, knowledge-memory, knowledge-pgvector ^...) B=0
@objectstack/service-knowledge   Test Files 19 passed (19)   Tests 677 passed (677)   typecheck 0
@objectstack/knowledge-turso     Test Files 4 passed (4)     Tests 235 passed (235)   typecheck 0
@objectstack/knowledge-memory    Test Files 3 passed (3)     Tests 66 passed (66)     typecheck 0
@objectstack/knowledge-pgvector  Test Files 3 passed | 7 skipped (10)  Tests 14 passed | 90 skipped (104)  typecheck 0
```
The pgvector live-Postgres files skip here (no Postgres server in this
container): the pgvector index and the conformance case through pgvector
are NOT MEASURED locally.
</details>

New pins:
- `knowledge-service.test.ts`, describe "a narrow caller's search ranks
only the records they may read" (13 cases): 20 of 1,000 readable, all
ranked 900th to 919th, answered best first in one round; more than 500
readable takes the path before (control: none reached); exactly 500
narrows, 501 does not; a one-record scope stays one record; mixed
readable/unreadable scope ids keep only the readable, in the caller's
order; no readable id in scope, and no readable record at all, search as
before; a parent term reads nothing and hands the caller's terms
unchanged; the system identity reads nothing and is handed no scope; the
organization filter is handed beside the narrowed term, equal to the
unnarrowed path's; the source's `where` is the read's `where`, one read
for two sources sharing it; a failed read warns and searches as before;
a record the read answered but the re-check refuses is not served.
- `knowledge-search-scope.test.ts`: `narrowToVisible` (7 cases).
- Conformance (`testing.ts`, through memory and turso): a caller who may
read only the two clauses every other outranks is answered from them
past the refill cap; their one-record scope stays one record.
- `knowledge-turso` acceptance: `EXPLAIN QUERY PLAN` of the adapter's
own scoped search SQL (captured from the client) shows `USING INDEX
TABLE_record` and no scan of the passage table.

Fixture updates (same assertions, now naming the extra caller read):
three pins that counted the caller's reads (`drops hits the user cannot
read`, `the permission re-read stays one query as the caller`, `passes
the caller's context to the row-level re-check`) now see the visible-id
read before the re-check.

<details><summary>Ablations: each mutation reds its pins, then restored
(git status clean after)</summary>

```
A1 intersection -> union (visible ids appended as one more term)   8 failed | 205 passed  exit=1
   incl. "a caller's one-record scope stays one record", "a one-record scope stays one record however many ids are visible",
   "20 records, two of them in scope, topK 5", "a caller scope naming readable and unreadable records"
A2 no narrowing at all                                              7 failed  exit=1
   incl. "a caller who may read 20 of 1,000 records is answered from their 20"
A3 the 500 bound dropped                                            2 failed  exit=1
   "control: ... more than 500 records takes the path before", "exactly 500 ... still narrow; 501 do not"
A4 the system identity narrowed too                                 1 failed  exit=1
   "the system identity: no read, no scope handed, one round of topK"
A5 the organization filter dropped when narrowing                   1 failed  exit=1
   "the organization filter is handed as before beside the narrowed term"
A6 turso source_record_id index removed from passageTableDdl        2 failed (memory and file: URL)  exit=1
```
</details>

## Measurements (amendment)

Scratch script, not committed: 100,000 passages (one per record)
bulk-loaded into one turso generation table (`file:` database, 64-wide
fake embedder), the adapter's own search SQL captured and planned.
Shared box, so read the ratios.

<details><summary>EXPLAIN QUERY PLAN, 20 visible ids of 100k
passages</summary>

```
SEARCH knowledge_bench_g1 USING INDEX knowledge_bench_g1_record (source_record_id=?)          vector leg
SEARCH knowledge_bench_g1 USING INDEX knowledge_bench_g1_record (source_record_id=?)          keyword leg candidates
SEARCH knowledge_bench_g1 USING COVERING INDEX knowledge_bench_g1_record (source_record_id=?) count(*) in scope
```
</details>

<details><summary>Adapter search latency, median of 7 (index dropped:
median of 3)</summary>

```
query                       ids    with index   index dropped
vector-led ("zebra quokka")  20      1.1 ms       38.2 ms
vector-led                  500      3.3 ms       48.5 ms
vector-led                 2000      8.5 ms       55.2 ms
vector-led, unscoped topK 100        59.0 ms
keyword-heavy (3 words each in ~30% of passages)
                             20    232.4 ms      346.3 ms
                            500    240.9 ms      376.4 ms
                           2000    262.9 ms      388.8 ms
keyword-heavy, unscoped topK 25     521.6 ms;  topK 100: 533.0 ms
```
</details>

The 500 cap is not raised. 500 to 2,000 ids costs about 2.6x on the
vector leg (3.3 to 8.5 ms) and about 1.1x on a keyword-heavy query.

## Acceptance notes

- This PR raises recall. With the index the narrowed vector leg reads
only the named records' passages. The keyword leg's candidate set is
still the FTS matches of each term ANDed with the scope (the plan above:
`MULTI-INDEX OR` over the FTS matches), so a query of very common words
still costs FTS-match time. Measured, not filed: no contract or recall
defect.
- pgvector: `CREATE INDEX IF NOT EXISTS` runs on an existing table at
the first write or build per process after the upgrade. It is not
`CONCURRENTLY`, so writes to that table wait while it builds. Same shape
as the existing keyword index's creation.
- `find` does not promise `min(limit, remaining)` rows (an `afterFind`
hook may drop rows from a page). If a hook drops rows from the 501-row
page, a caller with more than 500 rows could be read as having 500 or
fewer, and their search narrowed to a subset. Recall only, never
exposure: every hit is still re-checked. The platform's row security is
pushed into the query, not into `afterFind`.
- An index name `TABLE_record` shares SQLite's table/index namespace
with a legacy table name `knowledge_SOURCE` only for a source id ending
in `_gN_record`. The existing `TABLE_document` index has the same
property.
- Overlap: `node scripts/pm/overlap-check.mjs` on the branch before the
merge: `VERDICT clean exit 0` against `origin/main` and objectstack-ai#38060, objectstack-ai#38056,
objectstack-ai#38050, objectstack-ai#38038, objectstack-ai#38013. objectstack-ai#38056 (F6) shares `sql.ts` and the turso
acceptance file and merges cleanly. Whichever lands second merges main.

## Verification

Two minutes: `pnpm --filter @objectstack/service-knowledge exec vitest
run --maxWorkers=2 src/__tests__/knowledge-service.test.ts -t "narrow
caller"`. Expect 13 passed. Then `pnpm --filter
@objectstack/knowledge-turso exec vitest run --maxWorkers=2
src/__tests__/acceptance.test.ts -t "source_record_id index"`. Expect 2
passed (`:memory:` and `file:`).

Local gate families (`dispatch-gates --commands`) NOT MEASURED: the run
was denied by the session's action classifier. CI runs them all.

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

---------

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

repo:objectstack#1 · os-elon-musk · session_016WV4cwPhGV4g9p1BGQaZbP

Fixes objectstack-ai#37975

Clause-②: yes (widening)
Metadata-protocol: none
Skills-docs: none — the diff adds two options of one plugin and changes
no metadata an author writes; no published skill names the libSQL
store's search.

## 维护者速读
- 用户能看到什么变化:托管版上单个知识源超过两万段、且只属一个组织时,检索先用一位压缩索引挑候选再精排,20 万段时向量检索从约 1 秒降到约
0.08 秒;只看得到约两成以下记录的检索仍逐条扫描,速度不变。
- 为什么做:知识中台要支撑工单、拜访记录、邮件这类几十万段的知识源;您已选定方案 A(采用新索引,默认开启),替大知识量的托管客户解决检索慢。
- 出错会怎样:最坏是结果与逐条扫描略有出入(实测召回率 0.99
以上);数据库不支持这种索引时构建照常完成、退回逐条扫描并在健康检查里写明;多个组织的数据从不走这条路;阈值设为无穷大即可整体关掉。
- 要你做的:无。

## What changes

A libSQL store read every vector in scope on every search: at 1,536
dimensions, about 1.2 GB at 200,000 passages. Now, when a complete build
finishes on a generation that holds `vectorIndexThreshold` passages or
more (default 20,000), and all of them belong to one organization, the
store gives that generation an approximate index. It is on by default,
per the maintainer's ruling A on objectstack-ai#37975 (「A 采用新索引,默认开启」, recorded in
comment 7231124445).

- **The index.** It is a side table, `knowledge_SOURCE_gN-vec`. It holds
each passage's vector quantized to one bit per dimension (`F1BIT_BLOB`),
a 32nd the size of the float32 column. Three triggers keep it in step
with every write.
- **The vector leg.** The leg takes the `topK x vectorIndexOverfetch`
passages (default 40 per hit) nearest the query's one-bit vector. It
runs the unchanged organization, record-scope and metadata `WHERE` over
them (the `pool`), then ranks the pool by the stored float32 vector.
- **How it feeds RRF.** Its ranks feed the reciprocal rank fusion with
the keyword leg exactly as the exact scan's ranks did. The keyword leg
and the merge are unchanged.
- **The scoped-recall floor.** The search runs again as the exact scan
in either of two cases:
  - fewer than 8 x `topK` of the candidates are in scope;
  - the leg is short of `topK` hits.

The candidates are ranked before the filter, so a thin pool would
re-rank the wrong neighbours. The second case exists because the service
reads a short answer as "the source holds no more". The real-store rows
are under Acceptance notes.
- **Never over two organizations.** The candidates are ranked before the
filter.
- A generation that holds passages of more than one organization gets no
index. Passages with no organization count as one more.
- Every search also reads the `-org` index (`min`, `max`, and `EXISTS
... IS NULL`: three seeks). It takes the exact scan as soon as a second
organization's passage is written.
- This is decided per passage table: a generation table holds one
source, and a cloud store is one organization per database (ADR-0114).
- **When the index is built.** At the end of `completeBuild`, before the
switch transaction, and never on a search.
- It is filled 2,048 passages per transaction on the per-client queue,
so a search waits behind at most one batch.
  - At 200,000 passages this took 2.6 to 3 s and 54 MB.
- A source that grows past the threshold between builds keeps the exact
scan until its next complete build: `os knowledge rebuild`, a
fingerprint change, the boot build or the daily reconcile.
- **A database that refuses the index.** The source keeps the exact
scan, and the build completes.
- A probe of `vector1bit` runs before any DDL. It has to come first:
SQLite creates a trigger that names an unknown function without
complaint, and that trigger would then fail every passage write.
  - A refused DDL transaction rolls back.
- A refused copy batch ends the copy. The side table's count then
differs from the passage table's, so it is never searched, and the next
complete build resumes the copy.
- **The refusal is signalled through the existing `healthCheck()`.** The
service's health endpoint reads it, and the plugin logs it at boot.
  - A database without one-bit vectors is named from boot.
- Each source whose build had its index refused is named with the
reason, until a later build makes the index or the source is dropped.
- So the `healthCheck()` line is how an operator tells whether a hosted
database refused a source's index: a source it names runs the exact scan
for that reason. A source it does not name may still run the exact scan
for another reason above: two organizations, under the threshold at its
last complete build, or a narrow scope.
- `ok` stays `true`, and a store whose index works keeps the message
`libSQL vectors ready` unchanged.
- The record is kept by the process that ran the build, until it
restarts.
- **What a search reads to choose the index.**
  - The index memory is now keyed per generation instance.
- A process reads the catalog for an instance's index once (two reads)
and remembers the answer. A build remembers what it found in its own
process, so a source under the threshold costs no catalog read there,
and two reads once in any other process.
- With `vectorIndexThreshold: Infinity`, a search never reads the
catalog for an index; an index made earlier under a finite threshold
stays in place and is not searched.
- A failed approximate statement forgets that memory and is answered by
the exact scan.
- The one cost left: an index that another process completes inside the
active generation is used here after this process's next complete build
of the source, or a restart. A search that takes the index also reads
the organization index (three seeks).
- **The candidate count is bound only where it is read**, by the
approximate statement. The exact statement binds exactly the values it
reads, so a query without a keyword term leaves no surplus value.
- **Lifecycle and safety.**
- A generation swap and `dropSource` drop the side table, the `-org`
index and the triggers together with the generation's passage table.
- The shape checks run before any drop. An object under one of those
names that the store did not make refuses the call
`SERVICE_UNAVAILABLE`, names the object, and is never dropped.
- **Options.** `vectorIndexThreshold` (`Infinity` turns the index off)
and `vectorIndexOverfetch`, on both `KnowledgeTursoPlugin` and
`TursoKnowledgeAdapter`. Exports `VECTOR_INDEX_THRESHOLD` and
`VECTOR_INDEX_OVERFETCH`.
- **For the contract review:** `vectorIndexOverfetch` must be a whole
number of 8 or more, and the constructor throws `RangeError` below 8.
The minimum follows the 8 x `topK` floor: a smaller over-fetch could
never answer approximately and would only add a one-bit scan to every
search.
- The option is new in this PR and unreleased. Against `main` the PR
only widens; the 8 is a narrowing of what this PR first offered (1 or
more), and the ruling leaves it to the contract review.
- **Docs.** The README Search section, and the two docs pages where they
name the exact scan.

**The mechanism is not `libsql_vector_idx` / `vector_top_k`; the ruling
keeps the card's outcomes and changes only this.** I built the card's
mechanism first (commits `09b0571582` and earlier) and measured it at
200,000 passages:

| Measure at 200,000 passages | DiskANN (`libsql_vector_idx`) | One-bit
index (this PR) |
|---|---|---|
| Build time | 1,439 s | 3 s |
| Extra memory to build | 2.2 GB | 54 MB |
| recall@10, vector only | 0.387 | 0.998 |
| recall@10, hybrid | 0.716 | 1.000 |

- DiskANN never got past 0.46 at any `k`, since `vector_top_k` caps at
200 rows. At 20,000 passages the best setting I tried reached 0.845, at
13 ms per row and 1.27 GB.
- The card's flow holds: over-fetch, then the in-scope WHERE, then the
service's re-check, then RRF, and a short leg re-runs exactly.

**Out of scope here:**

- **F3.** The rule that "callers whose visible ids fit the F3 cap keep
the exact path" lands with whichever of objectstack-ai#37957 and this card lands
second. Until then, a narrow scope goes exact through the floor above.
- **A second approximate attempt over a larger pool.** Retrying with a
10x pool before going exact, for searches that see about a fifth of the
records or less, is not in this PR. It is follow-up objectstack-ai#38066 (ruling A,
item 6).

## Tests

New and changed tests in `src/__tests__/acceptance.test.ts`, run on each
store kind (file, memory) with a threshold of 40:

- **Threshold.** At the threshold, the vector leg is approximate. At 61,
or at `Infinity`, it stays exact.
- **Organizations.** Each of these takes the exact path: two
organizations at build time; a second organization written after the
build; a passage with no organization.
- **Filter, over-fetch and the floor.**
- A metadata filter that the candidates miss falls back to exact
(over-fetch 8).
- With over-fetch 10 and `topK` 2, a scope of all but the two best
passages keeps 18 or more of the 20 candidates, at or above the floor of
16, and stays approximate.
- With the same settings, a scope of 2 records is under the floor and
goes exact.
- **Refused index.** Three variants:
- *ann_no_1bit:* the database creates the DDL, as SQLite does, and
refuses each statement that computes `vector1bit`.
  - *ann_no_ddl:* the database refuses the `F1BIT_BLOB` column.
- *ann_no_copy:* the database makes the index and refuses the copy
batch.

In all three, the build completes, later writes are found by the exact
scan, and `healthCheck()` stays `ok` and names the source and the reason
(plus the missing one-bit vectors for *ann_no_1bit*). No index objects
are left for the first two. For *ann_no_copy* the index is there, short
of its passage table, and is never searched. After `dropSource` the
source is no longer named.
- **Catalog reads.** A search under the threshold, or at `Infinity`,
issues no catalog read for an index, on each store kind. On one file
store, a second adapter reads the catalog of a source under the
threshold once (two reads) over three searches.
- **Case timeouts.** The two 2,000-passage recall cases carry a 30 s
timeout: 1,017 ms and 1,384 ms locally, and 5,971 ms for the scoped case
on CI, past the 5 s default.
- **A term-less query.** It binds exactly the values each vector
statement reads: an approximate answer, then an approximate statement
and the exact one for a scope under the floor.
- **Two adapters on one file store.**
  - The index memory is keyed per generation instance.
- A failed approximate statement is answered by the exact scan, and its
memory is forgotten.
- **Lifecycle.**
- The triggers keep the side table in step on insert, update and delete.
  - A generation swap leaves only the new generation's objects.
  - `dropSource` leaves nothing.
- **Growth.** A source that grew past the threshold gets its index at
its next build.
- **A foreign `-vec` table.** It refuses `completeBuild` and
`dropSource` with `SERVICE_UNAVAILABLE` and is kept.
- **Recall.** recall@10 is at least 0.95 against the exact scan in two
tests:
  - unscoped: 2,000 passages, 40 queries;
- under a record scope keeping 10%, 5% and 3% of 2,000 passages:
measured 1.000 at each share.
- **Options.** `RangeError` for a threshold below 1 and for an
over-fetch of 7 or 8.5; 8 is accepted.

`plugin.test.ts` checks that the plugin passes both options through.

Ablations: each an on-disk source edit run through vitest, each red as
intended, each restored to a blob equal to HEAD with an empty `git diff
HEAD`. Ablations 1a to 3 ran on the first design. Ablations 4 to 15 ran
on `b113f0830f` under the verify lock; the later merge of `main` does
not touch this package's files.

| Ablation | What I changed | Result |
|---|---|---|
| 1a | Search-side organization check returns true | Two-organization
test red: approximate 1, exact 1 |
| 1b | Build-side organization check removed | Two-organization test
red: 5 index objects found |
| 2a | Post-filter dropped | Filter test red: `published` instead of
`draft` |
| 2b | Over-fetch factor 1 | Over-fetch test red |
| 3 | Threshold forced to `Infinity` | Every approximate-path test red |
| 4 | The 8 x `topK` floor removed | 2 failed: the over-fetch test on
both store kinds (`{approximate: 1, exact: 0}` instead of `exact: 1`) |
| 5 | The `vector1bit` probe before the DDL disabled | 2 failed: 5 index
objects instead of none |
| 6 | The catch around the DDL transaction removed | 2 failed:
`completeBuild` rejects |
| 7 | The health check's one-bit probe disabled | 2 failed: the message
does not name the missing one-bit vectors |
| 8 | The health check's per-source refusal record ignored | 2 failed:
the message does not name the source |
| 9 | The index memory not keyed per generation instance | 1 failed: the
instance test, `{approximate: 1, exact: 1}` instead of `{approximate: 0,
exact: 1}` |
| 10 | The catch around the approximate statement removed | 1 failed:
the failed-statement test throws `no such table` |
| 11 | The catch around a copy batch rethrows | 2 failed: *ann_no_copy*
on both store kinds, `completeBuild` rejects |
| 12 | The `Infinity` skip of the catalog read removed | 2 failed: an
adapter that did not build the source reads 2 catalog rows instead of 0
|
| 13 | The build's own "no index" verdict not remembered | 2 failed: 2
catalog reads under the threshold instead of 0 |
| 14 | A search's "no index" answer not remembered | 1 failed: another
adapter reads the catalog 6 times instead of 2 |
| 15 | The candidate count bound for both statements | 2 failed: the
exact statement binds 4 values and reads 3 |

The scoped-recall unit test stays green with ablation 4 (0.997, 0.993,
0.963). It guards recall; the over-fetch test is what pins the floor.

<details><summary>Local runs on the final head 73d2774 (origin/main
6e06729 merged)</summary>

On 73d2774 (test timeouts and wording only, on top of 50e245a),
under the lock: typecheck exit 0, `Tests 256 passed (256)`; the four
derived gates that read the changeset and README exit 0
(`check-changeset-no-major`, `check-empty-changeset`, `check:nul-bytes`,
`check:published-readme-links`). The 100-family union below is from
50e245a.

All under `os-verify-lock`, slot `o1C-37975`, `VERDICT command-exit 0`;
the lock was held 1,544 s after a 201 s wait.

- **Closure build** (`knowledge-turso^...` plus itself,
`--concurrency=2`): exit 0.
- **Typecheck:** `pnpm --filter @objectstack/knowledge-turso typecheck`
exit 0, with `check:test-typecheck` OK (0 errors).
- **Tests:** `pnpm --filter @objectstack/knowledge-turso exec vitest run
--maxWorkers=2` exit 0: `Test Files 4 passed (4)`, `Tests 256 passed
(256)`.
- **Derived gates:** `dispatch-gates --commands` derived 100 commands at
50e245a, and all 100 ran.
- Reconciled with `--ran`, exit codes recorded: `100 derived, 100 run, 0
NOT-MEASURED`.
- 99 recorded exit 0 on the first pass. `check:dual-build-cjs-loads`
exited 1 on that pass, naming `@objectstack/plugin-approvals` (a package
this diff does not touch; its `dist` was rewritten during that pass).
- Re-run alone under the lock on the same head, it exited 0: 126 require
entry points across 74 packages load. The record carries that exit 0.
- **Overlap check:** `VERDICT clean exit 0` against origin/main
0e36120 and the open PRs objectstack-ai#38060, objectstack-ai#38050, objectstack-ai#38013 and objectstack-ai#37982.
- **On `b113f0830f`, the head before the merge, under the lock:**
ablations 4 to 15 as in the table, each red and each restored to a clean
tree; the reconciliation read 100 of 100.

</details>

## Acceptance notes

- **Measured, unscoped**, at 200,000 passages of 1,536 dimensions. The
vectors are clustered synthetic data (latent dimension 384, 200
clusters), all of one organization, `topK` 10. The box was shared, with
a load of about 8 on 4 cores. The script is a scratch `bench.mts`, not
committed.

  | Search | Exact scan, p50 / p95 | One-bit index, p50 / p95 |
  |---|---|---|
| Vector leg only (the keyword leg matches nothing) | 958 / 1,054 ms |
66 / 81 ms |
  | Hybrid | 1,416 / 1,544 ms | 550 / 666 ms |

  - The slowest approximate vector-only search took 104 ms.
- recall@10 against the exact scan, over 100 queries: 0.998 vector-only,
1.000 hybrid.
- Building the index took 2.6 to 3.0 s, with the database file going
from 1,714 to 1,768 MB.

- **Measured, scoped**, on the same 200,000-passage store: 50
vector-only queries per share, a record scope, against the exact scan of
that scope. The "old rule" answers whenever the pool fills `topK`,
computed in SQL on the same store.

| In scope | recall@10 (floor 8) | Worst query | Sent exact | p50 / p95
| Old rule: recall, worst |
  |---|---|---|---|---|---|
  | 10% | 1.000 | 1.0 | 100% | 952 / 993 ms | 0.952, 0.7 |
  | 15% | 1.000 | 1.0 | 100% | 974 / 1,013 ms | 0.980, 0.9 |
  | 20% | 0.992 | 0.9 | 48% | 395 / 1,052 ms | 0.986, 0.9 |

- **Floor 4 against floor 8.** With a floor of 4 x `topK`, the same
bench gave 0.970 at 10% in scope, with a worst query of 0.7 and 44% of
queries sent exact. With 5% and 3% in scope, floor 4 already sent every
query exact (recall 1.000), where the old rule gave 0.914 and 0.878.
- **The simulation agrees.** The reviewer's numpy simulation
(`scoped-recall-floor8-retry-sim.py`, run under the verify lock) gives,
at floor 8: 41% exact and 0.988 at 20%, 99% exact at 15%, 100% exact at
10% and below.
- **Caveats.**
- **Synthetic vectors only.** No real embeddings were tried. Real
embedders put their vectors in a narrower cone, and one-bit quantization
keeps the signs of the coordinates. So on real data the one-bit
ranking's recall may be lower than measured here, and the right
`vectorIndexOverfetch` may be higher.
- **The one-bit leg is still a linear scan.** It is 13 to 15 times
cheaper than the float32 scan. Extrapolated linearly, that is roughly
0.35 to 0.4 s at 1,000,000 passages of one source, with no structure
that cuts the work below linear.
- **The hybrid p95 is the keyword leg's.** 666 ms, against 81 ms for the
vector leg alone. The cost is the keyword leg: `LIKE` for terms under 3
characters, and the trigram match for common trigrams, on an adversarial
bench vocabulary where every word starts with `term`. This PR does not
touch that leg, and no card covers it yet.
- **Only broad searches speed up.** A search whose scope or filter keeps
about 15% of a source's passages or less runs the exact scan. Its recall
holds, and it costs what it cost before this PR (about 1 s at p95 at
200,000 passages).
- **One hosted check is asked for.** On a hosted (Turso) database, after
a complete build of a source of 20,000 passages or more, confirm that
the `knowledge_SOURCE_gN-vec` side table exists. The one-bit vectors and
the DDL have only run on local `file:` and `:memory:` stores here. If it
is missing, the health check names the reason.
- **Nothing is logged at build time.** The adapter has no logger, so a
refusal shows only in the health check's message.
- **The organization rule is per passage table, not store-wide**, as the
ruling confirms. Pinned in both directions (ablations 1a and 1b).
- **Clause-②: yes (widening), re-judged on the final diff.** Two
optional adapter and plugin options and two exported constants are new.
Nothing that was accepted before is refused, with one exception: an
object the store did not make under one of its new hyphenated names
(`knowledge_SOURCE_gN-vec`, `-org`, or a `-vec-*` trigger) now refuses
`completeBuild`, `dropSource` and the opening of a generation with
`SERVICE_UNAVAILABLE`. That is the rule `main` already applies to the
keyword index's names, and the changeset states it. The claim's `no` is
corrected here. Both options are code options, not stored metadata:
`Metadata-protocol: none`.
- **Out-of-scope, noted and not filed:**
  - The keyword leg's cost, as above.
- Bulk upsert grew native memory under the bench until GC ran. Not shown
in production.

## Verification

Read first, by risk:

1. `turso-adapter.ts`, `buildVectorIndex`: the probe, the guarded DDL
transaction, the batched backfill against a generation being swapped
away, and the refusal record.
2. `turso-adapter.ts`, `searchAttempt` and `approximateSearchable`: the
`pool` count, the 8 x `topK` floor, the per-search organization check,
and the short-leg fallback.
3. `sql.ts`, `vectorIndexDdl` and `vectorIndexShape`: the triggers and
the shape check before a drop.

Two-minute check:

```
pnpm --filter @objectstack/knowledge-turso exec vitest run --maxWorkers=2 src/__tests__/acceptance.test.ts -t "approximate vector index"
```

Expected: every test passes, on both store kinds. Then edit
`searchAttempt`: change `pool >= VECTOR_MIN_POOL * topK && ` to nothing,
and run it again. The over-fetch test turns red with `{ approximate: 1,
exact: 0 }`.

---

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

---------

Co-authored-by: Claude <noreply@anthropic.com>
Nenzyz pushed a commit to Nenzyz/objectstack that referenced this pull request Dec 1, 2026
…urce whose adapter is not mounted (objectstack-ai#38224)

Fixes objectstack-ai#38158

Clause-②: no
Metadata-protocol: none

## 维护者速读

- 用户能看到什么变化:给 AI
编程助手看的知识源技能文档里,「存储」那一行多了一句:保存时指定了本部署没挂载的存储会被当场拒绝,以及两种修法;升级说明里「不写存储」那句补上了限定条件。运行行为不变。
- 为什么做:属于「知识检索」这条线的收尾,替写知识源的作者和 AI 助手解决「照文档写却被拒绝」的问题。
- 出错会怎样:只是文档措辞和测试,最坏是这句话写得不准;可以直接撤回,不影响任何已保存的数据。
- 要你做的:这个改动碰了对外发布的技能文档,需要按规定的审核流程放行落地。

## What changes

1. `skills/objectstack-ai/SKILL.md` § Knowledge Sources, the `adapter`
row. It named the refusal of an omitted adapter only. It now also says
that a run-time save naming an adapter the deployment does not mount is
refused (`400 VALIDATION_ERROR`, nothing written), naming the source,
the adapter and the mounted ones, with the two remedies that always
hold: name a mounted one, or mount the store and save again. Worded from
`unmountedAdapterSaveText` in
`packages/services/service-knowledge/src/knowledge-service.ts`.
2. Pins, no behaviour change:
- `knowledge-source-admission.test.ts`: the "leave `adapter` out" remedy
is offered with one adapter mounted and with the deployment's adapter
mounted; it is withheld with two mounted and none marked, with a
deployment adapter that is not itself mounted, and with none mounted. A
control asserts what the clause promises: the omitted adapter is
admitted where the remedy is offered and refused where it is withheld.
- `packages-knowledge-source-gate.test.ts`: the package-duplicate door
answers this refusal `400` with `error.code` `VALIDATION_ERROR` and the
save's own sentence, and copies nothing.
3. Migration entry `knowledge-source-unmounted-adapter-refused-at-save`:
its `replacement` now qualifies "no `adapter` at all": on a host that
mounts several adapters and marks none the deployment's, a source with
no `adapter` is itself refused, so name one there.
4. `scripts/check-skills-token-ratchet.mjs`: the
`skills/objectstack-ai/SKILL.md` row moves 7148 to 7200, pinned at the
measurement taken on this head, which carries `main` 333e6f3 (with PR
objectstack-ai#38292, which moved the same row 6906 to 7148).
5. Changeset: `@objectstack/skills` patch and `@objectstack/spec` patch
(the entry's text ships in the upgrade guide). The two test files
publish nothing, so `@objectstack/service-knowledge` and
`@objectstack/runtime` take none.

### Skill size readings

Raise path: the standing ruling 「A:先削重复,余额按实测提高」 (ruling record
6513306068, letter B). Paid down first, in the same file: the row's
"Optional" (its "Omitted:" clause already says the key may be left out).

| Reading | Before (`main` 333e6f3) | After (head e3e2fab) |
|:---|---:|---:|
| `skills/objectstack-ai/SKILL.md`, lines | 505 | 505 |
| `skills/objectstack-ai/SKILL.md`, bytes | 28617 | 28827 |
| `skills/objectstack-ai/SKILL.md`, tokens (priced bytes, stamp line
excluded: 28590 to 28800) | 7148 | 7200 |
| All `skills/*/SKILL.md`, lines | 4956 | 4956 |
| Ratcheted bundle, tokens | 200068 | 200120 |

The row moves +52, the measured remainder only: `ceil(28800 / 4) =
7200`. The merge of `main` 333e6f3 conflicted on this row only; it
was resolved by keeping `main`'s 7148 note and adding this PR's note
above the re-measured row.

## Why

PR objectstack-ai#38060 added the save refusal and the migration entry. Its contract
review left three follow-ups: the published skill did not teach the
refusal, the remedy branches of the refusal text and the duplicate
door's answer had no pin, and the entry's `replacement` offered a remedy
that is itself refused on one kind of host.

## Tests

Read first, by risk:

1. `skills/objectstack-ai/SKILL.md`, the `adapter` row: published text;
check it against `unmountedAdapterSaveText`.
2.
`packages/spec/src/migrations/entries/semantic/19.knowledge-source-unmounted-adapter-refused-at-save.ts`,
`replacement`: shipped upgrade-guide text.
3. `scripts/check-skills-token-ratchet.mjs`, the new note above the row:
the arithmetic.

Two-minute check: `pnpm --filter @objectstack/service-knowledge exec
vitest run src/__tests__/knowledge-source-admission.test.ts -t 'offers
leaving'` prints 1 passed.

The two edited test files, `check-skills-token-ratchet` (gate and
self-test) and `check:skill-docs` were re-run on head `92cc3cd391` (the
first head, the row re-pin, and merges of `main` up to bd5407e).
Heads `f75d35a017` and `f2f00af325` add clean merges of `main`
(98bd8de, which lowers the `objectstack-ui` row, then f19350b),
and head `e3e2fab53f` merges `main` 333e6f3 with the one ratchet-row
conflict resolved as above. The second carries objectstack-ai#38208 (898b056),
which edits
`packages/runtime/src/domains/packages-knowledge-source-gate.test.ts`
(also edited here, in other hunks; git merged them without a hand) and
`packages/runtime/src/domains/packages.ts` and
`packages/metadata-core/src/knowledge-source-save-admission.ts`, which
this PR's duplicate-door pin exercises. On `f2f00af325` and `e3e2fab53f`
only the ratchet gate and its self-test were re-run locally (exit 0);
the edited tests on the merged tree are read from this head's `Test
Core`. The ablation, the 121-family gate list and the package-wide runs
below were read on the first head `d9c88726c4`, before those merges.

<details><summary>Edited test files</summary>

```
pnpm --filter @objectstack/service-knowledge exec vitest run --maxWorkers=2 src/__tests__/knowledge-source-admission.test.ts
 Test Files  1 passed (1)
      Tests  89 passed (89)
pnpm --filter @objectstack/runtime exec vitest run --maxWorkers=2 src/domains/packages-knowledge-source-gate.test.ts
 Test Files  1 passed (1)
      Tests  75 passed (75)
os-verify-lock: VERDICT command-exit 0
```

</details>

<details><summary>Ablation: the pins go red when the branch or the
mapping is reverted</summary>

Each mutation was applied with `scripts/ablation-replace.mjs` (anchor
hit once, restore verified as blob equal to HEAD and an empty `git diff
HEAD`). Both subjects are imported from `src`, so no `dist` leg applies.

| Mutation | Result |
|:---|:---|
| `placeable = true` (always offer the remedy) | 1 failed: expected the
message not to contain "leave `adapter` out" |
| `placeable = false` (never offer it) | 1 failed: expected the message
to contain "leave `adapter` out" |
| `placeable = deployment !== undefined OR mounted.length === 1` (drop
the "deployment's adapter is mounted" test) | 1 failed: expected the
message not to contain "leave `adapter` out" |
| `packages.ts`: the duplicate door answers a fixed `403` in place of
`refused.status` | 1 failed: expected 403 to be 400 |

</details>

## Acceptance notes

- The skill row omits the third remedy the runtime may print ("leave
`adapter` out"): it is conditional, and the row's own "Omitted:" clause
already states where an omitted adapter is placed and where it is
refused.
- The duplicate door passes the refusal's status and sentence; the
`VALIDATION_ERROR` code on its answer is derived from the `400`, not
copied from the refusal's own `code`. The two agree for every refusal
the predicate answers today. Noted, not filed.

## Verification

- Derived gate list (`node scripts/pm/dispatch-gates.mjs --commands`,
121 families) run on `d9c88726c4`: 119 exit 0. Among them
`check-skills-token-ratchet` ("61 authored bundle file(s) within their
ceilings"), `check:skill-docs`, `check:skill-refs`, `check:skill-links`,
`check:skill-identifier-liveness`, `check:spec-changes`,
`check:upgrade-guide`, `check:doc-authoring`, `check:nul-bytes`,
`check:cross-package-test-inputs`.
- NOT MEASURED locally, both a missing prerequisite and not a red:
`check:dual-build-cjs-loads` (exit 3, "PREREQUISITE NOT MET", it needs
every package built) and the CLI file
`test/migrate-meta-engine-guidance.test.ts` (its global setup could not
load the unbuilt CLI closure). CI reads both.
- Under the verify lock on `d9c88726c4`, `VERDICT command-exit 0`: `pnpm
--filter @objectstack/service-knowledge test` (Test Files 19 passed,
Tests 683 passed), `typecheck` of `@objectstack/service-knowledge`,
`@objectstack/runtime` and `@objectstack/spec`, and the spec migration
suites (`vitest run src/migrations`: Test Files 5 passed, Tests 207
passed).
- Declared narrowing: the runtime and spec packages ran the files this
diff touches or feeds, not their whole suites; `test:repo` was not run.
CI's `Test Core` carries those.

## Human Minimum

- [x] 1. Schemas start as Zod; `packages/spec` holds no runtime logic.
- [x] 2. Every name I added uses the casing for its kind.
- [x] 3. No formatter ran; `pnpm lint` is CI's reading.
- [x] 4. One issue, one branch off an up-to-date `main`, one pull
request.
- [x] 5. A change that publishes carries a changeset, and both
declaration lines are filled in here and in the changeset.
- [x] 6. `packages/spec` touched: `check:generated` families ran green;
nothing to regenerate.
- [x] 7. No hand edits to `content/docs/references/`,
`packages/*/CHANGELOG.md` or `content/docs/releases/`.
- [x] 8. Title, body and comments are in English.

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

<!-- signed: repo:objectstack#1 · os-elon-musk ·
session_016WV4cwPhGV4g9p1BGQaZbP -->

---------

Co-authored-by: Claude <noreply@anthropic.com>
Nenzyz pushed a commit to Nenzyz/objectstack that referenced this pull request Dec 1, 2026
…g, 56 changesets added) and state what npm publishes (objectstack-ai#38645)

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

Fixes objectstack-ai#38189

Clause-②: no
Metadata-protocol: none

## 维护者速读

- 用户能看到什么变化:v19 发布页的 breaking 清单补上 11 月 26 日之后合进来的 56 条改动(其中 30 条还在 main
上、下一次预发布才带上,页上逐条标明),计数和页头的发布状态也改成现在 npm 上的真实情况。
- 为什么做:升级到 19 的人把这页当完整清单用;原清单只数到 19.0.0-next.0 的输入,之后 next.1、next.2 和
main 上的 breaking 改动大多没列。
- 出错会怎样:只改一个文档页,不影响任何代码或发布;某条写错了,读者会被误导,但直接撤回这个改动即可恢复原页。
- 要你做的:无。

## What changes

`content/docs/releases/v19/index.mdx` only.

- **Header.** The publication sentence now states what npm answers:
`latest` is 18.6.0, `next` is `19.0.0-next.2`; the line's versions on
npm are `19.0.0-next.0` (2026-11-26) and `19.0.0-next.2` (2026-11-28).
`19.0.0-next.1` was versioned on `main` (30a8047) and is not on npm, so
its changes first ship in `next.2`.
- **How this list was built.** Re-measured at `6eb23c87` (origin/main at
start, 2026-11-29) with the method the page states:
`classifyReleaseBullet` over every changeset on `main` — the 1,185 in
`.changeset/pre/` (consumed by the next.0, next.1 and next.2 version
passes) and the 219 still pending. 159 breaking from 155 PRs: 98 to act
on, 61 registered.
- **56 new lines' worth of changesets**, each sorted by the classifier
into 需手动处理 (27) or 自动迁移 (29), placed under the page's existing topic
headings, with three new ones: 需手动处理 → Knowledge; 自动迁移 → Knowledge
sources, Sharing and permissions. The 30 still pending carry "— on
`main`".
- **自动迁移 intro** and **Coming from 18.x step 3**: the registered split
restated in changesets (31 on the protocol-19 step, 30 on the
protocol-18 step, of 61).
- **Callout**: no longer says no prerelease was published.

## Tests

The classifier run (script in the dev's scratchpad; it imports
`classifyReleaseBullet` from `scripts/release-github-releases.mjs` and
feeds each changeset body as a CHANGELOG bullet, `- ` on the first line
and two-space indent on the rest), at `b03fd5f5`'s parent tree
`6eb23c87` (the diff touches no changeset):

<details><summary>Raw counts</summary>

```
ALL 1404 {"manual":98,"migrated":61,"other":830,"added":403,"semantic":12}
OLD (in a46efa8 set) 950 {"migrated":31,"manual":71,"other":563,"added":278,"semantic":7}
NEW (after a46efa8) 454 {"manual":27,"other":267,"added":125,"migrated":30,"semantic":5}
  NEW next.0 45 {"other":27,"added":13,"migrated":1,"semantic":2,"manual":2}
  NEW next.1 138 {"manual":9,"other":80,"migrated":12,"added":36,"semantic":1}
  NEW next.2 52 {"added":11,"other":38,"manual":3}
  NEW pending 219 {"added":65,"other":122,"migrated":17,"manual":13,"semantic":2}
missing-from-tree of a46 set: none
```

The same function over the 950 files as they stood at `a46efa8c` (`git
show a46efa8:.changeset/FILE`):
`{"migrated":31,"manual":71,"other":563,"added":278,"semantic":7}`, and
0 of the 950 changed section between `a46efa8c` and `6eb23c87` — the
page's first count reproduces exactly.

</details>

<details><summary>The 57 breaking changesets added after a46efa8 (pass
· section · PR · file)</summary>

```
next.0  manual    37477  37004-retire-knowledge-ragflow.md
next.0  manual    37491  36964-flow-option-label-filters.md
next.0  migrated  37437  35827-data-table-staged-edit-retired.md   (already on the page)
next.1  manual    37605  31908-p4c-sealed-expiry.md
next.1  manual    37640  37604-platform-record-followups.md
next.1  manual    37668  37104-knowledge-settings-readers.md
next.1  manual    37720  37682-i18n-retire-build-chat-keys.md
next.1  manual    37720  37682-retire-build-chat-frontend.md
next.1  manual    37818  37608-disabled-holder-publish-rollback-refused.md
next.1  manual    37883  37575-first-render-grid-shell-passes.md
next.1  manual    37900  36689-mcp-stdio-disabled-package-every-caller.md
next.1  manual    37902  37678-knowledge-turso-settings-group.md
next.1  migrated  37366  37086-define-metadata-form-rename.md
next.1  migrated  37366  37086-form-metadata-type.md
next.1  migrated  37371  36055-view-all-stops-voting-on-fields.md
next.1  migrated  37513  35143-data-model-publish-checks.md
next.1  migrated  37584  37499-disabled-holder-unbound-row-bare-write-refused.md
next.1  migrated  37600  36595-related-list-key-under-arrangement.md
next.1  migrated  37676  37304-knowledge-source-governed-type.md
next.1  migrated  37783  37712-agent-model-provider-retired.md
next.1  migrated  37807  35143-seeds-actions-checks.md
next.1  migrated  37840  36377-flow-bare-ordering-record-date-arithmetic.md
next.1  migrated  37870  37613-book-audience-one-gate.md
next.1  migrated  37910  37717-lookup-depends-on-param-computed-field.md
next.2  manual    37948  37851-disabled-holder-own-row-publish-rollback-refused.md
next.2  manual    38028  managed-email-password-held-off.md
next.2  manual    38042  36679-secret-rewrap-confirmation-exit.md
pending manual    37896  runtime-object-less-action-no-record.md
pending manual    37963  37467-knowledge-title-arm-retired.md
pending manual    37982  37907-knowledge-turso-test-connection.md
pending manual    38038  38019-knowledge-source-review-follow-ups.md
pending manual    38085  37622-related-list-keys-agree-under-arrangement.md
pending manual    38180  auth-switches-read-declaration.md
pending manual    38209  35879-served-schema-platform-stamped-keys.md
pending manual    38268  sec2-wf9p-f12.md
pending manual    38269  37752-app-list-edit-with-ai-removed.md
pending manual    38310  38041-knowledge-source-closure-system-object.md
pending manual    38431  36987-auth-updateuser-returns-void.md
pending manual    38452  38377-retire-split-algorithm-version.md
pending manual    38580  36057-scenarios-delete-agent-confirmation-names.md
pending migrated  37924  37856-ask-ai-action-type-retired.md
pending migrated  37929  36495-action-locations-acted-on.md
pending migrated  37971  37307-knowledge-source-references.md
pending migrated  38001  automation-variable-keys-reserved-segments.md
pending migrated  38013  37983-knowledge-source-save-needs-the-service.md
pending migrated  38060  37961-knowledge-source-unmounted-adapter-refused-at-save.md
pending migrated  38096  34562-record-structural-lint.md
pending migrated  38107  35143-views-dashboards-checks.md
pending migrated  38145  37214-chart-series-measure-format-refused.md
pending migrated  38168  36544-form-view-modal-size-retired.md
pending migrated  38216  33912-share-unknown-recipient-ledger.md
pending migrated  38216  33912-share-unknown-recipient.md
pending migrated  38273  33806-pending-confirmation-service-one-seam.md
pending migrated  38299  35924-publish-reparses-object-draft.md
pending migrated  38398  37753-build-progress-frame-retired.md
pending migrated  38470  38369-knowledge-held-without-embedder-or-store.md
pending migrated  38545  38150-adopt-orphans-door-retired.md
```

PR = the `(#N)` of the commit that added the changeset (`git log
--diff-filter=A`). The pass is the version commit that moved the file
into `.changeset/pre/`: next.0 33a31dc, next.1 30a8047, next.2
9d111a7 (`packages/spec/package.json` reads `19.0.0-next.0/1/2` at
each).

</details>

<details><summary>Page cross-checks</summary>

- Every one of the 155 PRs behind a breaking changeset is linked on the
page (0 missing), and the page links no PR outside that set.
- Each of the 30 pending changesets sits on a line carrying "— on
`main`", and no published one does.
- `!`-titled first-parent commits since 18.6.0 (958ee03) to `6eb23c87`:
135 (87 to `a46efa8c`, as the page said); all 135 are in the list.
- Registered markers resolved to their entry files
(`packages/spec/src/migrations/entries/*/N.*`,
`packages/spec/src/conversions/entries/N/`, and metadata-core's forward
conversion for `permission-view-all-fields-beside-record-bypass`): the
30 registered changesets added after `a46efa8c` name 39 ids, all on step
19; the 31 before it name 33 ids, 32 on step 18 and
`protocol-18-range-refused` on step 19.

</details>

## Acceptance notes

- **Pending changesets are in the list.** The card's done-when covers
every changeset between `a46efa8c` and the measurement sha; 30 of those
are still in `.changeset/` and ship in the next cut, so their lines are
marked "on `main`" and the intro says so.
- **`19.0.0-next.1` is not on npm.** `npm view PKG versions` for
`@objectstack/spec`, `core`, `cli`, `runtime` and `@object-ui/i18n`
lists `19.0.0-next.0` and `19.0.0-next.2` only. The header states that
fact and no more.
- **The registered split is now counted in changesets, not entries.**
The old page said 41 registered entries, 39 on protocol 18. Counting the
ids in the registered markers gives 33 at `a46efa8c` (32 on step 18), so
the 41/39 could not be reproduced from any stated method. The rewritten
intro and step 3 count changesets (31 on step 19, 30 on step 18, of 61),
which match the bullets one to one.
- **Followed the classifier where a title has no `!`:** objectstack-ai#37605, objectstack-ai#37883,
objectstack-ai#37963, objectstack-ai#38209 and objectstack-ai#38269 are breaking by their banner or their
`(narrowing)` arm; objectstack-ai#38209's Clause-② reads "no (narrowing …)", which the
classifier counts as breaking although the body says nothing a client
sends is refused. Listed as classified; no changeset changed.
- **objectstack-ai#37513** merged before the next.0 cut but its changeset was consumed
by next.1 (its body says the next.0 CHANGELOG missed it).
- **One line, several changesets**: objectstack-ai#37720, objectstack-ai#37366 and objectstack-ai#38216 each carry
two changesets; objectstack-ai#37818 with objectstack-ai#37948, objectstack-ai#38038 with objectstack-ai#38310 and objectstack-ai#38013 with
objectstack-ai#38060 share a line. The existing 102 lines were not rewritten.
- **Counts on a release page**: each is anchored to a named measurement
sha, the snapshot the card asks for; it is not a count kept in sync with
the tree.
- **objectstack-ai#37437** (closed card objectstack-ai#37922's bullet) is not added twice.
- **Check Changeset** will be red: this docs-only PR publishes nothing
from any package, the `skip-changeset` case, and the dispatch opens it
without labels, so that label is the seat's to apply.

## Verification

Read first, by risk: the method paragraph and header (`index.mdx` lines
6-47), the 自动迁移 intro, then the new 需手动处理 → Knowledge block.

Two-minute check: `git show
6eb23c8:.changeset/pre/37851-disabled-holder-own-row-publish-rollback-refused.md
| head -12` shows the `fix(metadata-protocol)!` summary and the BREAKING
banner behind the objectstack-ai#37948 line; `npm view @objectstack/spec dist-tags`
prints `{ latest: '18.6.0', next: '19.0.0-next.2' }`.

<details><summary>Local gate readings at b03fd5f</summary>

```
dispatch-gates --commands at b03fd5f: 52 commands (1 path changed)
first pass: 47 exit 0; 5 exit 3/1 = PREREQUISITE NOT MET (lint, spec, client-react unbuilt), re-run after building the closures under os-verify-lock (VERDICT command-exit 0 both):
  pnpm --filter '@objectstack/lint...' build ; pnpm --filter '@objectstack/client-react...' build
final: 52 of 52 :: exit 0
✓ dispatch-gates --ran: 52 derived famil(ies) accounted for — 52 run, 0 NOT-MEASURED (a DERIVED zero — all 52 recorded an exit code and none of them is 3).
check-release-page-status: OK — 3 GA major(s) in scope (v16, v17, v18)
```

</details>

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

https://claude.ai/code/session_01ADHkmRar3Kkg6SpwVgaaVE

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

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 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.

Review follow-ups of PR #37951: refuse a knowledge_source save that names an adapter the running deployment does not mount

3 participants