Skip to content

feat(service-knowledge): record changes sync through the queue service — a save does not wait for the embedder, a failed sync is retried, a rolled-back write is never indexed - #38043

Merged
objectstack-fleet[bot] merged 14 commits into
mainfrom
claude/area-o1C-37735
Nov 27, 2026

Conversation

@objectstack-fleet

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

Copy link
Copy Markdown
Contributor

repo:objectstack#1 · os-elon-musk · session_016WV4cwPhGV4g9p1BGQaZbP
Fixes #37735
Fixes #37110

Clause-②: yes (widening) — KnowledgeServicePluginOptions gains the optional recordSyncRetry; KnowledgeService gains routeRecordSyncs, recordSyncQueued, enqueueRecordSync and processRecordSync; the package exports KNOWLEDGE_RECORD_SYNC_QUEUE, RECORD_SYNC_RETRY_DEFAULTS and the KnowledgeRecordSync* types
Metadata-protocol: none

维护者速读

  • 用户能看到什么变化:保存一条被知识库收录的记录时,不再卡在向量模型上等待,保存立刻返回,几秒后检索才查到新内容;向量模型短暂故障时,同步会自动重试,不再永久丢失。
  • 为什么做:知识库检索的可靠性(替接手的旧卡一并解决),保存被向量模型拖慢、同步失败不重试、回滚的写入被收录进索引,这三个问题一次修掉。
  • 出错会怎样:最坏是某条记录的检索结果暂时停在旧版本,直到下一次保存、检索发现过期或每日对账把它修好;保存本身不受影响,撤回这次改动即恢复原来的同步方式。
  • 要你做什么:无。

What changes

A record change of an indexed object no longer syncs its document inside the write. Where the kernel composes a durable queue service (QueueServicePlugin over a data engine) and a data engine is bound, both triggers publish to the knowledge-record-sync queue:

  • the realtime knowledge-event-sync subscription;
  • the after-write hooks used on a kernel with no realtime service.

A worker, subscribed in kernel:ready, re-reads the row and writes or removes the document. Everything else keeps the inline path and says so once at boot at warn:

  • the kernel's in-memory fallback queue;
  • a queue with no listFailed;
  • no data engine.

enableEventSync: false and refresh.onRecordChange: false are unchanged: they publish nothing.

  • The message carries identifiers only: { source, object, recordId, reason }, where the reason is event or freshness. It never carries a field value. The test reads the stored sys_job_queue row.
  • How commit ordering works: the message is published after the commit, through ObjectQL's runAfterOpenUnitsCommit. It goes out once the open unit commits (the write's own unit or a caller's engine.transaction()) and is dropped on rollback. With no unit open it goes out at once. I did not use the other approach (the queue row joining the write's unit), and no engine change was needed.
  • Rows per save: one queue row per source per save, with no idempotencyKey. DbQueueAdapter suppresses a keyed publish while a message is pending or running, and for 24 h after it completes. A key per document would therefore drop a save made while that record's sync runs, and every save of it for a day after. Each worker run re-reads the row, so the last committed version wins. IQueueService and DbQueueAdapter are unchanged.
  • Retry, then dead letter: the worker throws on failure, including when the source's adapter is not mounted. The queue retries on recordSyncRetry: by default 8 attempts, 5 s doubling to a 2 min cap. The message then becomes a listFailed dead letter that names the source and record, logged once at error.
  • Outcomes that are not retried: a source that is gone, a source no longer indexing the object, and a malformed message all complete with no write.
  • The freshness repair goes through the queue: when a search finds a document stale, repairStale now publishes a freshness message instead of starting an un-awaited inline sync.
  • Who adopts whose seam: fix(service-knowledge)!: retire the knowledge field gate's title arm behind a per-source recipe proof #37963 touches this freshness path. If this PR lands first, fix(service-knowledge)!: retire the knowledge field gate's title arm behind a per-source recipe proof #37963 adopts this seam (the queued freshness message in repairStale). If fix(service-knowledge)!: retire the knowledge field gate's title arm behind a per-source recipe proof #37963 lands first, this branch merges main and adopts its seam.
  • Docs: content/docs/protocol/knowledge.mdx gains "Through the queue" and "Without a durable queue". content/docs/ai/knowledge-rag.mdx, the README and a changeset are updated too.

Tests

src/__tests__/record-sync-queue.test.ts is new. It boots a real ObjectKernel with ObjectQLPlugin, SqlDriver (a better-sqlite3 file), QueueServicePlugin({ adapter: 'db' }) and KnowledgeServicePlugin. Every queue-path case runs once per trigger (realtime, and the hooks).

The queue-path cases cover:

  • a save returns while the embedder is held;
  • the queue row holds identifiers only;
  • retry, then dead letter;
  • nothing is processed inside a caller's engine.transaction();
  • a rolled-back insert leaves no document and no row;
  • a rolled-back update leaves the committed row indexed;
  • a burst of 3 saves gives 3 rows and the last version wins;
  • a save after a completed sync is synced;
  • a delete, including member and record-granularity searches before the message is processed;
  • a source that is gone.

Further cases:

  • nothing is published before the write's own unit commits;
  • an afterInsert hook that aborts the write's own unit publishes nothing;
  • messages published before a restart are processed after it;
  • the freshness message;
  • the fallback warn and inline sync, plus both switches;
  • destroy() leaves the message pending.

Re-land head 5d430ea (after the merge-queue drop: #38026 made source.adapter optional, so processRecordSync now resolves through main's adapterFor(source); cause and fix in comment 7229116666). One locked batch, lock VERDICT command-exit 0:

  • turbo build --filter='@objectstack/service-knowledge^...': 19 of 19 tasks; pnpm --filter @objectstack/service-knowledge build: CJS, ESM and DTS build success (the build that failed in the queue);
  • pnpm --filter @objectstack/service-knowledge typecheck: check:test-typecheck: OK;
  • vitest run --maxWorkers=2: 19 of 19 files, 605 of 605 tests, including the new pin (a source with no adapter syncs through the queue to the deployment's store, on both triggers);
  • NOT MEASURED on this head: an ablation of the new pin (lock saturated by dogfood holders).

Earlier readings, on head 43dc682 unless noted (all under os-verify-lock):

  • pnpm --filter @objectstack/service-knowledge exec vitest run --maxWorkers=2: 19 of 19 files and 593 of 593 tests pass (on merge head 640b356; the one later commit changes only docs and the changeset);
  • pnpm --filter @objectstack/service-knowledge typecheck: check:test-typecheck: OK.
Ablations (mutated on disk, test file re-run, restored with git checkout; tests run from source, so no rebuild)
  • enqueue-not-sync (both triggers forced to the inline path): 24 failed.
  • rollback-not-indexed (runAfterOpenUnitsCommit removed, publish at once): 4 failed. They are the rolled-back insert (both triggers), the own-unit test and the own-unit abort. The caller-transaction case stayed green under this mutation, because on SQLite's single connection the poller cannot read inside an open transaction. The rollback cases are the pin for the deferral.
  • burst-keeps-last (idempotencyKey = source:object:recordId): 9 failed, including the burst, after-completed and delete cases.
  • no-field-value-in-message (the row's title added to the message on both triggers): 2 failed (the identifiers-only case for each trigger).
  • fallback-inline-warn: two mutations were run.
    • The boot warn dropped: 2 failed.
    • A degraded queue or one with no listFailed accepted: 2 failed.

Acceptance notes

  • MemoryQueueAdapter (adapter: 'memory') carries no degraded label and has no listFailed. It is refused through the listFailed condition, so it takes the inline path with the boot warn.
  • Cross-node race: in-process serialization (chainAfter per document) orders two runs on one node. Two nodes processing two messages for one record are not ordered against each other. Each run re-reads the row, so the last run to finish writes what it read. A save committing between one node's read and another's write can leave an older version until the next save, a freshness hit or the reconcile.
  • Distributed realtime adapter: the realtime trigger relies on the in-process publish running inside the write (so runAfterOpenUnitsCommit sees the open unit). A realtime adapter that delivers out of process would publish with no unit open, that is at once. That is still after the write returned, but not ordered against a caller's transaction. No such adapter ships today.
  • A system-identity search at chunk granularity re-reads nothing. It can answer a deleted record's chunks until the delete's message is processed. Member searches and granularity: 'record' searches do not; the docs now say so.
  • The standard runtime mounts queue on every preset except minimal. Under minimal the sync takes the inline path with the warn.

Verification

Two-minute check:

pnpm --filter @objectstack/service-knowledge exec vitest run --maxWorkers=2 src/__tests__/record-sync-queue.test.ts

Expected result: 33 of 33 tests pass.

Read first (by risk):

  1. knowledge-service.ts: publishRecordSyncs (the commit deferral) and processRecordSync (what is retried and what completes).
  2. knowledge-service-plugin.ts: startRecordSyncQueue (the queue resolution, the fallback warn and the dead-letter line).
  3. knowledge-record-sync-queue.ts: recordSyncPublishOptions (why there is no idempotency key).
Local gate subset

dispatch-gates --commands --repo objectstack-ai/objectstack derived 119 families. The --ran reconciliation reads: 115 run, 3 NOT MEASURED, 1 unrun.

  • Passed: 113 exit 0.
  • NOT MEASURED, prerequisite (exit 3, this worktree has no full build): check:skill-examples, check:dual-build-cjs-loads, check:published-readme-exports.
    • For check:published-readme-exports, I confirmed the one new README import (QueueServicePlugin from @objectstack/service-queue) by hand against service-queue/dist/index.d.ts.
  • Exit 1 from local build state, not from this diff:
    • @objectstack/spec check:docs: packages/spec/json-schema is older than src. This branch touches nothing in spec.
    • check:dts-closure: packages/rest/dist has no .d.ts. This branch does not touch rest; the partial dist likely comes from a build I stopped earlier.
  • Unrun, NOT MEASURED: check:type-check-debt, because it builds every package under the shared lock.
  • Re-run on 43dc682: the 39 doc and changeset families, all exit 0.

CI measures the full set.

overlap-check on 5d430ea: VERDICT clean exit 0 against main and the open PRs, including #37963, #38013 and #37982. Earlier, on 43dc682: VERDICT clean exit 0 against main and 6 open PRs (#38038, #38037, #38032, #38026, #37982, #37963).


Generated by Claude Code

…otocol, the RAG guide and the README

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016WV4cwPhGV4g9p1BGQaZbP
…nd the queue service from source

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016WV4cwPhGV4g9p1BGQaZbP
…ted yet; test the published rows, not their absence

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016WV4cwPhGV4g9p1BGQaZbP
Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016WV4cwPhGV4g9p1BGQaZbP
Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016WV4cwPhGV4g9p1BGQaZbP
@github-actions github-actions Bot added size/xl dependencies Pull requests that update a dependency file 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 27, 2026
@github-actions

github-actions Bot commented Nov 27, 2026 •

Copy link
Copy Markdown
Contributor

📓 Docs Drift Check

This PR changes 1 package(s): @objectstack/service-knowledge, touching 38 documentable anchor(s). ⚠️ 3 changed file(s) yielded no anchor (packages/services/service-knowledge/README.md, packages/services/service-knowledge/src/index.ts, packages/services/service-knowledge/vitest.config.ts), so the pages documenting them are NOT COVERED by this run — this is not a clean bill of health for those files.

34 hand-written doc(s) name something this change touched — list omitted above 15 rows. Re-derive on the tree named below: node scripts/docs-audit/affected-docs.mjs --json 8d34c4404f951410083a6caebd6ad8003ea3423d.

⛔ 6 release-owned page(s) also affected — read-only, see AGENTS.md Documentation Guardrails.

What this run could not see
  • 3 changed file(s) yielded no anchor (packages/services/service-knowledge/README.md, packages/services/service-knowledge/src/index.ts, packages/services/service-knowledge/vitest.config.ts) — pages documenting those are invisible to this run
  • 1 cross-cutting symbol(s) contributed no route anchor: recordId (5 routes)
  • 4 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 — 4 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 8d34c4404f951410083a6caebd6ad8003ea3423d → packageMentionDocs.

Which tree this was computed on

This run read content/docs from 711f6b613c7e2b32c49c31d5669ab1c18cb77c78 — the merge of head 5d430ea461542902c21fbc9ff0c6ec921d07c758 into base 8d34c4404f951410083a6caebd6ad8003ea3423d, 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 711f6b613c7e2b32c49c31d5669ab1c18cb77c78 && git checkout 711f6b613c7e2b32c49c31d5669ab1c18cb77c78
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin 8d34c4404f951410083a6caebd6ad8003ea3423d 5d430ea461542902c21fbc9ff0c6ec921d07c758 && git checkout -B drift-repro 8d34c4404f951410083a6caebd6ad8003ea3423d && git merge --no-ff 5d430ea461542902c21fbc9ff0c6ec921d07c758

node scripts/docs-audit/affected-docs.mjs --json 8d34c4404f951410083a6caebd6ad8003ea3423d

⚠️ 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 8d34c4404f951410083a6caebd6ad8003ea3423d → 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_016WV4czzx9dtSEm3jWWL9c3

Contract review

Served-tier: TIER_DEFAULT
Head-sha: 43dc682dcbeaf442a33cd8aac6c0511bb2de634d
Local-runs: none

Face: declaration. The diff touches no published-schema path and no governed rule text (13 files, all under packages/services/service-knowledge, its package.json, the lockfile, one changeset and two content/docs pages); the review is owed by the Clause-②: yes (widening) line alone.

① Derived judgments

  • The declaration is true. Every API change is an addition: KnowledgeServicePluginOptions.recordSyncRetry is optional; KnowledgeService gains routeRecordSyncs, recordSyncQueued, enqueueRecordSync and processRecordSync; the entry exports KNOWLEDGE_RECORD_SYNC_QUEUE, RECORD_SYNC_RETRY_DEFAULTS and the KnowledgeRecordSync* types. No existing signature changes, and no accepted input is refused: handleRecordUpsert and handleRecordDelete keep their shapes and remain the inline path. The changeset line and the PR body say the same.
  • The behavior change is stated, not hidden. On every runtime preset but minimal the queue capability is composed over a data engine (packages/core/src/capability-providers.ts), so a save of an indexed record now returns before its document is written, where before (with a realtime service) it waited for the embedder. That is a timing change, not an API or metadata change. The changeset and content/docs/protocol/knowledge.mdx both say it, including the window in which a system-identity chunk search can still answer a deleted record until its message is processed. No dogfood case reads a knowledge search right after a save (packages/qa/dogfood/test has no such read), so no bounded wait is owed.
  • Publish after commit is real. publishRecordSyncs goes through ObjectQL.runAfterOpenUnitsCommit (added by 19.0.0-next.0: a record-change flow's run-history and audit writes throw knex "Transaction query already complete" after the flow finishes (hotcrm lead_assignment) #37705, pinned in packages/objectql/src/engine-scoped-transaction-late-write.test.ts), and the tests at record-sync-queue.test.ts cover the caller's transaction, the write's own unit, an aborting afterInsert hook, and both rollback outcomes the card service-knowledge: event sync re-reads inside the uncommitted write, so a rollback leaves the index stale until the next event or a reindex #37110 names.
  • Retry and dead letter. The worker throws what a retry can change and completes the rest (malformed, source-gone, not-synced), so a gone source is not retried eight times. The dead-letter log fires when attempts reaches maxAttempts, and the test pins that the save never failed. The default waits sum to 395 s, which the docs give as about six and a half minutes.
  • No idempotency key is the right call, and the docs explain it against the queue's actual semantics (db-queue-adapter.ts: a keyed publish is suppressed for a 24 h window by default, and sys_job_queue keeps completed rows for its declared retention).
  • Message holds identifiers only, so sys_job_queue does not become a copy of the row outside its permissions; the test reads the stored row to pin it.
  • Fallback detection. resolveRecordSyncQueue refuses a missing queue, the kernel's fallback queue (degraded), and an in-memory queue with no listFailed, and the boot says once at warn why the sync is inline.

② Semver level

patch is right. Metadata-protocol: none is true: nothing a metadata author can write changes meaning, and no published schema is touched. Under AGENTS.md a non-protocol widening is a patch.

③ Boundary flags

  • SQL push-down: the worker re-reads one row by id through the engine, as the inline path did. No id materialisation and no in-app join is added.
  • The two new package.json entries (@objectstack/driver-sql, @objectstack/service-queue) are devDependencies, used by the test only; the runtime code reads the queue through the IQueueService contract, so the published package gains no dependency.
  • Fixes #37110: the queued path closes both rollback outcomes the card names, and the queued path is what the standard runtime composes. The inline fallback keeps the old behavior and the docs say so in its own section. Closing the card is acceptable on that basis.

Nits (no grade)

  • N1: knowledge.mdx says a burst of saves leaves "the last committed version" because each message re-reads the row. That holds within one process, where recordSyncTails serializes the syncs of a document. With workers in more than one process, two messages for the same record can finish out of order and leave the older version until the next save, a search that finds it stale, or the reconcile. The inline path had the same cross-process race, so it is not new; a short "in one process" qualifier would keep the sentence exact.
  • N2: the plugin's recordSyncRetry JSDoc says "a provider outage of six minutes is ridden out" while the docs say six and a half; both are true lower bounds of 395 s, but one figure would read better.

No must-fix, no should-fix.

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

VERDICT: PASS

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

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

L1 review — ACCEPT on merits, landing blocked by the PR-body guard

Head: 43dc682dcbeaf442a33cd8aac6c0511bb2de634d (card #37735, also closes #37110)

Verdict: ACCEPT on the code, tests and docs at this head. Contract review: TIER_DEFAULT declaration record 7227410375, PASS, no must-fix and no should-fix. patch with Metadata-protocol: none is right; no CONTRACT_REVIEW_TIER review is owed (no published-schema path, no governed rule text, no narrowing).

Read: the queue module, the service and plugin changes, the hooks, the 20 new tests, the changeset and both docs pages sentence by sentence. The publish goes through runAfterOpenUnitsCommit, so nothing is processed before the write commits and a rollback publishes nothing; the message holds identifiers only; the worker retries what a retry can change and completes the rest; the inline fallback is chosen on a missing, degraded or in-memory queue and said once at boot. The two new package entries are devDependencies.

Before it lands:

  1. PR-body guards is red: the body says Fixes #37110 and service-knowledge: event sync re-reads inside the uncommitted write, so a rollback leaves the index stale until the next event or a reindex #37110 carries no Claim: naming claude/area-o1C-37735. Post that claim on service-knowledge: event sync re-reads inside the uncommitted write, so a rollback leaves the index stale until the next event or a reindex #37110, then re-run the guard. Fixes is the right keyword here: the queued path the standard runtime composes closes both rollback outcomes the card names, and the inline fallback is documented as such.
  2. All checks green on this head. At this reading 40 checks were still pending (Test Core, Test UI, Type Check, Lint, Build).

A head that moves only for the claim and a re-run needs nothing more from this lane; a code change needs a delta read.

Nits (optional, may go in a follow-up): N1 qualify the "last committed version" sentence in knowledge.mdx to one process; N2 make the retry outage figure the same in the JSDoc and the docs.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

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

Landing · area o1-C · head 43dc682dcb · 2026-11-27T20:36Z · ACCEPT → PR #38043 comment 7227420133 (L1-a)

Probe Reading
check-runs at 43dc682dcb 62 success · 9 expected skip · 0 failed · 0 pending · mergeable_state clean (PR-body guards green after the #37110 claim 7227438690 and one re-run)
check-governed-merges.mjs --pr 38043 NOT governed · +1239 / −73
landing-k.mjs --pr 38043 K = 2 < 15

State: ready + auto-merge; #37735 and #37110 close on merge via Fixes. Declaration record 7227410375 (TIER_DEFAULT) PASS: Clause-②: yes (widening), patch, Metadata-protocol: none; no contract-tier L2 owed; not a (narrowing). Optional nits N1 (one-process qualifier on the "last committed version" sentence) and N2 (one outage figure) go with the next touch of these docs. #38017 (restore re-index) and #37736 build on this queue seam once it merges.

@objectstack-fleet
objectstack-fleet Bot marked this pull request as ready for review November 27, 2026 20:36
@objectstack-fleet
objectstack-fleet Bot added this pull request to the merge queue Nov 27, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Nov 27, 2026
Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016WV4cwPhGV4g9p1BGQaZbP
…h the source's binding

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016WV4cwPhGV4g9p1BGQaZbP
@github-actions

Copy link
Copy Markdown
Contributor

⛔ merge queue 构建失败 — 先分诊,再决定要不要重排

队列构建 46064910619 红了。队列跑的是全量套件(PR 侧 CI 只跑 affected 子集),
所以失败的测试可能在本 PR 没碰过的包里 —— 那不是重排能修的。每次盲目重排都会让排在后面的所有 PR 重建一轮。

分类:failure —— 按下面的日志分诊。

失败的 job(日志抽取,best effort):

  • Build UI Deps — 失败步骤: Build the @objectstack packages objectui consumes(日志不可读,点进 job 看)
  • Build Core — 失败步骤: Build packages (excluding docs)(日志不可读,点进 job 看)
  • Live E2E UI — 失败步骤: Build the workspace backend and the @objectstack packages objectui consumes(日志不可读,点进 job 看)
  • Dogfood Regression Gate (2/3) — 失败步骤: Build the dogfood package's dependency closure(日志不可读,点进 job 看)

↳ 失败原因 是判读的关键:超时(Test timed out in … / Hook timed out in …)多半是负载/时序,不是本 PR 的回归;
断言(AssertionError: …)才指向真实的行为改变。两者的 FAIL 行长得一模一样,只有这一行能区分。

⚠️ 断言这一侧有一类例外,判据是断言在测什么,不是它是不是 AssertionError。 断言的对象是产品行为(一个值、一个形状、一次拒收)⇒ 照上面读:真实的行为改变,去查,⛔ 不要重排掉;
断言的对象是这次实验自身的有效性前提(跑完的耗时、负载下的先后、任何只在时间预算内才成立的条件)⇒ 它跟超时是同一类,同样对负载敏感,重排一次是合法的判别手段。
识别是机械的:断言的消息或它比较的值本身点名了一段时长、一个时间戳、一个耗时计数。实测过的一对 —— AssertionError: SecurityPlugin.init() ran: expected false to be true 测的是产品行为(真回归);
AssertionError: this run took over a second, so second-precision stamps could have differed too: expected 1006 to be less than 1000 测的是实验前提:它守护的那条不变式当时是绿的,同一个 head 原样重排一次即成功。
穿着 AssertionError 外衣的时间测量,仍然是时间测量。(⛔ 这只改「怎么读一次红」,不改「哪些测试可以重排」——后者由别处管。)

跨 PR 相同签名(24h,按失败测试文件聚合):

  • ⚠️ 本次没有可用的聚合签名(日志里没有能解析出测试文件名的 FAIL 行)—— 这不是「没有同签名的其他 PR」,是这一轮没测到。跨 PR 聚合本次不可用,请手工比对其他 PR 的同类评论。
  • ⚠️ 24h 评论账本没读完(超过 5 页仍未读到窗口尽头),所以上面的「不同 PR 数」是下界,不是全量。

历史信号:

  • 本 PR 过去 24h 无队列失败记录(首次)。
  • 过去 24h 队列共有 17 个失败构建(不含本次)。

分诊清单:

  1. 失败测试在本 PR 改动的包里 → 真回归,修 PR。
  2. 失败测试与本 PR 无关 → 看上面的「跨 PR 相同签名」;已有汇总 issue ⇒ flaky/环境问题实锤,去那张 issue 上谈,修好前重排只会再烧一轮全队列。
  3. 两者都不是 → 可能与同组 PR 语义冲突;等前面的 PR 落地或失败出队后再重排一次即可,不要连续重排。

Generated by Claude Code · merge-queue-triage workflow (#4859)

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

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

Merge-queue drop (CI_FAILURE): cause and fix

Cause: this was a real semantic conflict with main, not a flake. #38026 landed on main and made source.adapter optional; a source with no adapter binds to the deployment's store. The worker body this PR adds, processRecordSync, still called this.getAdapter(source.adapter). The merge-group build therefore failed with TS2345: Argument of type 'string | undefined' is not assignable to parameter of type 'string' in knowledge-service.ts. Build Core, Type Check · consumer gates and Dogfood 2/3 failed on it. The two branches merged textually clean, so the overlap check could not see it.

Fix (commit 5d430ea, on top of a merge of origin/main):

  • processRecordSync now resolves through main's this.adapterFor(source), which wraps adapterIdFor. It picks the adapter the source names, else the deployment's store, else the only one registered.
  • Where none resolves, it still throws the coded refusal, so the message is retried and then dead-lettered as before. The refusals are:
    • the named adapter is not mounted;
    • no adapter is mounted (503 SERVICE_UNAVAILABLE);
    • several are mounted and none is the deployment's (400 VALIDATION_ERROR).
  • The comment above the call now names those refusals.
  • No other site in this diff resolved an adapter from source.adapter. The inline syncRecord already uses adapterFor after the merge, and repairStale publishes or calls syncRecord.
  • New pin, for both triggers: a source that names no adapter syncs through the queue to the deployment's store. Two stores are registered and deploymentAdapter: 'memory' is set. The queue row completes, the document lands in memory, the decoy store stays empty, and a search answers the record.

The verification readings are in the dev report.


Generated by Claude Code

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

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

Contract review

Served-tier: TIER_DEFAULT
Head-sha: 5d430ea461542902c21fbc9ff0c6ec921d07c758
Local-runs: none

Delta of record 7227410375 (head 43dc682). Face: declaration, unchanged. No published-schema path and no governed rule text in the diff.

① Derived judgments

  • What moved. Merge 76ff5ed brings in main at 8d34c44, which carries feat(knowledge): a knowledge source needs no adapter and no requires entry; it binds to the deployment's store #38026: KnowledgeSource.adapter is optional, and a source binds to the deployment's store. Fix 5d430ea makes processRecordSync resolve the source's adapter through main's adapterFor(source), replacing getAdapter(source.adapter). Compared file by file against the earlier head, the PR's net diff changes only in knowledge-service.ts (that call and its comment) and in record-sync-queue.test.ts (one new case and a test-host parameter).
  • The fix is right. Before it, the queued worker could not compile against main, and in effect would have looked up an undefined adapter id for a source that names none. adapterFor is the same resolution the inline path and the search use, so the queued and inline syncs now write to the same store. The new case pins it on both triggers: a source with no adapter syncs to the deployment's store, and a decoy store stays empty.
  • Retries. Every refusal adapterFor can throw is coded and thrown to the queue, so it is retried and then dead-lettered, as before. That keeps the rule the docs state: an unmounted adapter is retried like a failure.

② Semver level

Unchanged: patch with Metadata-protocol: none. The fix adds no API and accepts no new input.

③ Boundary flags

  • SQL push-down: unchanged, one re-read by id.
  • The new case's ablation is NOT MEASURED. By construction, getAdapter(undefined) would refuse or pick the wrong store, so the decoy assertion or the doc count would go red.

Nits (no grade)

  • N3: adapterFor can also refuse with 400 VALIDATION_ERROR, when several stores are mounted and none is the deployment's. That is a composition error, and a retry changes it only if a store registers later. It is retried eight times like the others before it becomes a dead letter. That is harmless, but the docs' list of retried refusals names only the unmounted adapter.
  • N1 and N2 of record 7227410375 stand as written.

No must-fix, no should-fix.

Implemented-by: claude/area-o1C-37735
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 at head 5d430ea461542902c21fbc9ff0c6ec921d07c758 (Fixes #37735, #37110). Delta read of ACCEPT 7227420133. The PR was dropped from the merge queue with TS2345 after #38026.

Review summary

Contract review. Delta declaration record 7229469935 at this head: PASS, no must-fix and no should-fix.

Delta.

Gates.

Nits, optional:

  • N3: the docs' list of retried refusals does not mention the 400 composition refusal (several stores, none the deployment's).

Next: not governed and not Tier H, so the area re-lands it once every check on this head is green.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

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

Re-landing · area o1-C · head 5d430ea461 · 2026-11-27T22:37Z · delta ACCEPT → PR #38043 comment 7229477605 (L1-a) · delta declaration record 7229469935 PASS at this head

Probe Reading
check-runs at 5d430ea461 64 success · 11 expected skip · 0 failed · 0 pending · mergeable_state clean
check-governed-merges.mjs --pr 38043 NOT governed · +1271 / −73
landing-k.mjs --pr 38043 K = 3 < 15

Queue drop cause (TS2345 after #38026 made source.adapter optional) is fixed in 5d430ea: the queued worker resolves through adapterFor(source), pinned on both triggers. State: ready + auto-merge; #37735 and #37110 close on merge via Fixes. Optional nit N3 (the docs' retried-refusal list omits the 400 composition refusal) is not owed.

@objectstack-fleet
objectstack-fleet Bot added this pull request to the merge queue Nov 27, 2026
Merged via the queue into main with commit 58be677 Nov 27, 2026
75 checks passed
@objectstack-fleet
objectstack-fleet Bot deleted the claude/area-o1C-37735 branch November 27, 2026 23:03
Nenzyz pushed a commit to Nenzyz/objectstack that referenced this pull request Dec 1, 2026
…behind a per-source recipe proof (objectstack-ai#37963)

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

Fixes objectstack-ai#37467

Clause-②: yes (narrowing)
Metadata-protocol: none
Skills-docs: none — no published skill teaches the knowledge field gate
or its refusals (`git grep` of `skills/objectstack-ai` for the gate, the
display field and `KNOWLEDGE_REBUILD_REQUIRED`: 0 hits)
Security-touching: yes

## 维护者速读

-
用户能看到什么变化:知识检索的权限过滤不再额外检查名为“标题”的旧字段;对象同时有“标题”字段和另一个显示字段的知识源,只有在索引确认按当前方式完整建成后才对非系统用户开放,而且每条命中都要与记录的当前内容核对,对不上的不返回。
- 为什么做:知识检索收口(知识库检索按调用者权限过滤)的遗留清理:旧索引兼容分支退役,改为按知识源确认索引、按命中核对内容。
-
出错会怎样:最坏是这类知识源在重建完成前检索不到内容(会明确报“需要重建”),或刚改过的个别记录暂时搜不到(后台自动补写);不会泄露无权字段,改动可直接撤回。
- 要你做什么:审阅这次安全相关的收紧,决定是否合并。

## What changes

- **The field gate's `title` arm is gone**
(`knowledge-source-admission.ts`, `servedFieldsOf`). The gate asks about
exactly what a document carries under the current recipe: each `content`
and `metadataFields` member and the display field
(`documentTitleField`), less the fields an index never carries.
- **Per-source proof at search time** (`KnowledgeService.unprovenIndex`,
from `planSearches`). `mayServeEarlierRuleTitle` names the sources where
the retired arm mattered: the object declares a field named `title` (or
its fields cannot be enumerated), the index may carry it, and the source
does not serve it. For a non-system caller such a source is searched
only when its adapter's `indexStatus` reports the fingerprint AND the
recipe hash `planIndex` computes now, and only where the builds that
record that hash purge. It is never proven for `refresh.onRecordChange:
false`, or on an adapter with no `indexStatus`, no `completeBuild` or no
`listDocuments`.
- **Per-hit check on a proven source**
(`KnowledgeService.dropUnverifiedHits`; the seat's ruling S1 = B). The
proof speaks for the index as its last complete build left it. So each
hit of a proven source is served only when (a) one system-context read
per source per search round, `where` AND `id` in the hits' record ids,
answers its record, (b) its `documentId` is the one the source derives
from that record, and (c) its stored `docHash` equals the one
`recordToDocument` computes from the row under the current object
definition. The hash covers the title. Every way the check cannot be
made drops the hit: the read throws or answers no list, the hit has no
`sourceRecordId` or no stored hash, the hash cannot be computed, or the
tenancy posture cannot be read. The read decides survival only. A
surviving hit is returned as the store answered it, and nothing the read
returned is put on it. A stale or missing record's own document is
repaired in the background through the existing `repairStale`, once per
document until a later search finds it current; a document under a
foreign id is dropped and not repaired. Under record granularity
`checkFreshness` then reads the same records again, so "one read" is the
new check's own cost.
- **Without the proof the source is refused, never served through the
old arm**: named in `refused` as `KNOWLEDGE_REBUILD_REQUIRED` / 409.
That code is already in `@objectstack/service-knowledge`'s error-code
ledger, which this PR does not change. A search where it was the only
source refuses whole. The caller and the operator are told what ends the
refusal: a complete rebuild, nothing (a configuration no build can
prove), or the next search (an unreadable status). A refused search
starts no build and writes nothing.
- **A source that needs the index proof is never searched without it.**
The adapter a source binds to is resolved once per search, in
`planSearches`: the proof is read from that instance, both search rounds
search that same instance, and a source whose adapter does not resolve
at the plan carries the coded refusal its resolution answered and is
refused, never searched. `searchRound` no longer looks an adapter up.
- **Every other source pays nothing**: no proof read and no per-hit read
when the object declares no `title`, its display field is `title`,
`title` is credential-class or `internal`, or the source serves `title`
itself.
- **Save door (ADR-0161 K4 guard two)**: the same `servedFieldsOf`
judges a save, so an author no longer needs to query a `title` field the
source never indexes. This is the widening half of the declaration; the
display field is still asked.
- Docs: `content/docs/protocol/knowledge.mdx` (the title rule, the
proof, the permanent cases, the per-hit check) and
`content/docs/ai/knowledge-rag.mdx` (the second cause of
`KNOWLEDGE_REBUILD_REQUIRED`).

## Measurements: the per-hit read

Method, enough to rebuild it (the script is not committed: it imports
the in-memory driver from its source by relative path, which is not a
dependency of this package):

- Engine and driver: `new ObjectQL()` from `@objectstack/objectql`,
`registerDriver(new InMemoryDriver(), true)` with `InMemoryDriver`
imported from `packages/drivers/driver-memory/src/index`, then `init()`.
One object `account` (text `name`, text `title`, textarea `body`)
registered with `registry.registerObject`.
- Rows: 2,000, inserted in the system context: `name` "Acme i", `title`
"T i", `body` "body text i " repeated 40 times.
- Source and service: object source `s` over `account`, `content:
['body']`; `new KnowledgeService({ dataEngine: engine })` with a stub
adapter registered as `memory`.
- Hits: for each size n in 5, 25 and 100, the first n rows read in the
system context; each hit's `documentId` is `s:ID`, its `sourceRecordId`
the row id, and its `docHash` `recordToDocument(source, source.source,
row, engine.getSchema('account')).docHash`. So every hit is current.
- Timing: call `dropUnverifiedHits(hits, new Set(['s']))` 20 times to
warm up, then 200 timed rounds per size with `performance.now()`; p50
and p95 from the sorted times. `engine.find` is wrapped to count
system-context calls (round trips) and the rows they return (rows read).
- Re-run: put the file in
`packages/services/service-knowledge/src/__tests__/`, run `pnpm --filter
@objectstack/service-knowledge exec vitest run --maxWorkers=1 FILE`,
delete it.
- Box: the shared container, beside sibling verify runs; load averages
(1, 5, 15 min) 8.07, 7.98, 7.60 at the run. Read the times as an upper
bound on CPU cost. A remote driver adds one database round trip per
proven source per round.

| hits checked | when | round trips per round | rows read per round |
p50 | p95 |
|---|---|---|---|---|---|
| 5 | small: one `topK` 5 page of hits | 1 | 5 | 1.5 ms | 2.5 ms |
| 25 | first round at `topK` 5 (`SEARCH_FIRST_ROUND_FACTOR` 5) | 1 | 25
| 3.3 ms | 7.6 ms |
| 100 | refill at `topK` 5 (`SEARCH_REFILL_FACTOR` 20) | 1 | 100 | 9.2
ms | 14.5 ms |

An earlier run of the same method at load about 7 read 1.6/5.1, 3.3/6.2
and 9.5/12.3 ms (p50/p95).

Rows read are bounded by the distinct record ids among the round's hits
of proven sources, projected to the fields assembly reads. Every hit was
served in every timed round, so the recomputed hash agrees with the
stored one end to end on the real engine.

## Tests


`packages/services/service-knowledge/src/__tests__/knowledge-source-admission.test.ts`:

- proven index: a caller who may not query `title` is served, and the
stored hit is returned unchanged;
- unproven, seven ways (no `indexStatus`, no `completeBuild`, no
`listDocuments`, no recipe hash, another recipe hash, another
fingerprint, a throwing `indexStatus`) plus `refresh.onRecordChange:
false`: refused `KNOWLEDGE_REBUILD_REQUIRED` / 409, never searched. The
caller message and the warn line promise a rebuild only where one ends
the refusal, and the system context is still served;
- per-hit check (new `describe`): CONTROL served with exactly one system
read; the read's fields never reach the caller; dropped for a stored
hash that is not the current one, a hit whose stored docHash differs
from the record's current build inputs, a document a complete build
kept, a foreign `documentId`, no hash, an empty hash, and a record the
read no longer answers; fails closed for a read that throws, one that
answers no list, an unreadable tenancy posture, a hash that cannot be
computed, and a hit with no `sourceRecordId`; a source with a `where`:
the system read asks for `{ $and: [where, { id: { $in } }] }` and a
record outside `where` is dropped; the refill round: a proven source
saturates the first round with stale hits, the refill runs, and its
stale hits are dropped while its current hit is served; a source
searched without the proof is not checked; two race pins for the rule
that a source that needs the index proof is never searched without it:
another adapter instance registered under the same id while the proof is
read is not searched, and an adapter that registers only after its
source was planned is not searched that search (the source is refused
`SERVICE_UNAVAILABLE` / 503);
- an unproven source beside a searchable one; sources where the arm
never mattered read nothing; rebuilt: refused (no `beginBuild`, `upsert`
or `completeBuild` call), then `rebuildSource` completes and the source
is served;
- reverse pins: on a proven index the display field, a `content` field
and a `metadataFields` field the caller may not query each still refuse
the source; on an unproven index a stored earlier-rule title never
reaches the caller;
- `mayServeEarlierRuleTitle` table; save door.

<details><summary>Readings at 3a69848</summary>

- `pnpm exec vitest run --maxWorkers=2` in
`packages/services/service-knowledge`: Test Files 18 passed (18), Tests
611 passed (611), after the merge of main and a rebuild of the
dependency closure under the verify lock.
- `pnpm typecheck` in the package (tsc plus `check:test-typecheck`):
exit 0, "0 file(s) / 0 error(s)".
- The admission file alone: 83 passed (83).

</details>

<details><summary>Ablations (one on-disk mutation each, file restored
after)</summary>

Per-hit check, each run against the admission file:

- hash not compared: red, the four stored-hash-differs cases (the refill
pin among them);
- `documentId` not checked: red, the foreign document;
- usable-hash filter and equality both admit a missing hash: red, no
hash and empty hash. The usable filter ablated alone stays green,
because the equality also refuses a missing hash, so this is a double
ablation by design;
- a record the read no longer answers passes: red, that case;
- a read error serves the hits: red; a non-list answer serves them: red;
- an unreadable posture proceeds: red;
- a hash that cannot be computed trusts the store: red;
- no `sourceRecordId`: the permission filter ablated alone leaves the
new pin green (the check holds it) and turns the existing filter pin
red; filter plus the check's record-id test ablated turns the new pin
red;
- the read's row put on the hit: red, CONTROL and the no-leak pin;
- every source checked: red, the unproven-source case and the hits
elsewhere that carry no hash;
- S4 (a), the `where` conjunct dropped (the system read's `where`
replaced by the id list alone): red, the `where` case;
- S4 (b), the refill round not checked (`served(...)` removed from the
`refilledKept` call site only): red, the refill case;
- the first-round call site not checked (`served(...)` removed from the
`kept` call site only): red, 13 cases;
- the check not wired (the body of `served` replaced by returning the
hits, which removes the check at both call sites, first round and
refill): red, 13 cases.
- resolve once undone (`searchRound` looks the adapter up again by the
source's binding, as before): red, both race pins.

Proof and refusal (earlier rounds, unchanged code): arm restored, proof
skipped, recipe hash not compared, fingerprint not compared, predicate
always true, withheld `title` ignored, served-field check removed,
`onRecordChange: false` proven, no `listDocuments` proven, no
`completeBuild` proven, a `never` refusal promising a rebuild, a refused
search starting a build: each red.

</details>

<details><summary>Gates at 3a69848</summary>

- `dispatch-gates --commands`: 101 families, run locally and reconciled
with `--ran`: 100 exit 0, 1 NOT MEASURED. `check:type-check-debt` exits
3: its coverage half reads OK (132/135 workspace packages type-checked,
0 in the debt ledger), but its re-measure closure build queue-timed-out
twice on the shared verify lock (540 s each). CI's `Type Check · debt
ledger` lane reads it. `✓ dispatch-gates --ran: 101 derived famil(ies)
accounted for — 100 run, 1 NOT-MEASURED`.
- `check-nul-bytes`: OK. `overlap-check`: `VERDICT clean exit 0` against
origin/main, objectstack-ai#38043, objectstack-ai#38038, objectstack-ai#38013 and objectstack-ai#37982.
- Dogfood battery (owed by the `!` title), at 3a69848, under the
verify lock: `pnpm exec turbo run build
--filter='@objectstack/dogfood^...' --concurrency=2 && pnpm --filter
@objectstack/dogfood test`, `VERDICT command-exit 0`, waited 293 s, held
2743 s; Test Files 490 passed, 3 skipped (493); Tests 4144 passed, 68
skipped (4212).

</details>

## Acceptance notes

- Card acceptance 1, per-source proof at search time: `unprovenIndex`
reads `indexStatus` against `planIndex`'s fingerprint and recipe hash on
every search that needs it, never cached. It adds no contract member and
no stored state.
- Card acceptance 2: the arm is removed for proven sources. Unproven
ones are refused and are rebuilt by the existing boot pass, reload,
reconcile or `os knowledge rebuild`, never served through the old arm.
On a proven source a hit the current recipe would not assemble from the
live record is not served either (seat ruling S1 = B).
- Card acceptance 3: no other arm changed; reverse pins above.
- Seat conditions for B: (1) each fail-closed case pinned and ablated,
as above. (2) The no-leak pin plus its ablation. (3) The `indexStatus`
proof is kept beside the per-hit check rather than dropped. (4)
Measurements above. (5) `KNOWLEDGE_REBUILD_REQUIRED` is kept with
messages that say what ends each refusal, and the ledger is unchanged.
(6) Withdrawn by the seat (it concerned a follow-up card). The ruling is
recorded on this PR (7224861986); the PR keeps `Clause-②: yes
(narrowing)` and `Security-touching: yes`, and lands the Tier H way
through the seat.
- The claim's `:178` is not the arm: `documentTitleField` answering
`title` for an object with no definition is the current assembly rule,
so the gate keeps asking about it.
- Narrowing, declared for the seat: for a non-system caller, a
qualifying source is refused until a complete build under the current
recipe has completed (for good under `refresh.onRecordChange: false` or
an adapter missing `indexStatus`, `completeBuild` or `listDocuments`).
On a proven source, a hit whose record changed after its document was
written is dropped until the document is rewritten, and an adapter whose
hits carry no `docHash` serves no hit from it (the built-in adapters
carry it). Under `buildAtBoot: false` only the reconcile, where it runs,
or `os knowledge rebuild SOURCE` ends the first.
- Merged with main after objectstack-ai#37306 landed (f10feed). The one
`planSearches` conflict keeps both intents: the adapter is the one the
source binds to (main's optional-adapter placement) and the index-proof
requirement stays on the admitted entry. Review point S5 is on top of it
(3a69848): a source that needs the index proof is never searched
without it. For every source, an adapter that registers mid-search is
used from the next search on.
- Deviation: with the shared verify lock held by sibling batteries
through repeated 540 s queue-timeouts (five runs queued ahead at the
last try), the package suite, typecheck, single-file runs, ablations and
the measurement ran unlocked at `--maxWorkers=2`. The dogfood battery
ran under the lock.

## Verification

Read first: `knowledge-service.ts` `dropUnverifiedHits` (the per-hit
check and its fail-closed exits), then `planSearches`, `searchRound` and
`unprovenIndex` (the adapter resolved once, the refusal and the
comparison), then `knowledge-source-admission.ts`
`mayServeEarlierRuleTitle` (which sources pay either read).

Two minutes: `pnpm --filter @objectstack/service-knowledge exec vitest
run --maxWorkers=2 src/__tests__/knowledge-source-admission.test.ts`
shows 83 passed, including the `per-hit check` block.

🤖 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
…A-g3hv-75wg-m249 exemption (objectstack-ai#38057)

Fixes objectstack-ai#36160

Clause-②: no
Metadata-protocol: none

## 维护者速读

- 用户无感:只改依赖覆盖规则、锁文件和安全扫描豁免清单,任何包的发布内容都不变。
- 为什么做:去掉依赖安全扫描里那条 12 月 21 日到期的匹配库漏洞豁免,让豁免清单回到零条。
- 出错会怎样:最可能是安全扫描或某个类型打包步骤在持续集成里变红,合并前就能看到;合并后出问题直接撤回这个改动即可。
- 要你做什么:无。

## What changes

The follow-up to objectstack-ai#38049 (merged as 39d611d), which moved the five
parents that accept minimatch 11 and kept exceljs's glob chain on its
own minimatch majors. The seat chose option A for the last holder. Every
reading below was taken on this PR's head, 84e6e1c, rebased onto
39d611d.

1. **`pnpm-workspace.yaml`: a parent-scoped override,
`@microsoft/api-extractor>minimatch` to `^11.0.9`.**
`@microsoft/api-extractor` declares `minimatch` `10.2.3` exact (7.58.2
here; the newest release, 7.60.2, still pins it). It was the last
minimatch 10.x copy in the lockfile. The comment beside the line gives
the reason, and says to delete the line once an api-extractor release
drops its exact 10.x pin.
- It is in the graph only as an auto-installed optional peer of `tsup`,
`unplugin-dts` and `vite-plugin-dts`. Those load it lazily, and only for
`bundleTypes`, `rollupTypes` or `experimentalDts`, which no build here
enables (evidence 1 below).
- Its one call into minimatch is the named `minimatch()` export, in
`Collector.js`, which minimatch 11 keeps. The smoke below runs that
exact call.
- The `pnpm-workspace.yaml` selector-shape rule governs `pkg@range`
floors. This key names a parent and has no version range, so there is no
bound to place. The exact-target rule covers packages whose export
surface we compile against, and minimatch is not one of them, so the
target is `^`.
- The comment over the per-major minimatch floors now says the 6.0.0 to
11.0.0 floor holds no copy today.
2. **`osv-scanner.toml`: the GHSA-g3hv-75wg-m249 exemption is deleted.**
It was the only entry, so the ledger is at its intended steady state of
zero exemptions. Per convention 3, removing an exemption may ride with
the fix. The header and template are untouched.
3. **`pnpm-lock.yaml`**, regenerated with pnpm 10.31.0. The only change
is that api-extractor's `minimatch` moves from 10.2.6 to 11.0.9,
`minimatch@10.2.6` drops out of the lockfile, and the `overrides` header
gains the new line.

No published package changes, so this PR carries no changeset. Every
manifest that moved for objectstack-ai#36160 moved in objectstack-ai#38049.

When `@microsoft/api-extractor` ships a release without the exact 10.x
pin, delete the override line. That needs no card.

## Tests

<details><summary>Evidence 1: no build here enables an api-extractor
path</summary>

- `git grep -n -E
'rollupTypes|bundleTypes|experimentalDts|api-extractor|apiExtractor|ExtractorConfig|api-extractor\.json'`
outside the lockfile and changelogs: 6 hits. Five are the new comment
and override in `pnpm-workspace.yaml`. One is a doc comment in
`packages/spec/scripts/lib/file-description.ts` that says no typedoc or
api-extractor reads the field it describes.
- `git grep` for `experimental-dts`, `experimentalDts` or `rollup-types`
in any `package.json`, `.ts`, `.mts`, `.js`, `.mjs` or `.cjs`: 0 hits.
No tracked `api-extractor.json` exists.
- The 41 files that reference `vite-plugin-dts` or `unplugin-dts` pass
`dts()` options from this set only: `aliasesExclude`, `compilerOptions`,
`exclude`, `include`, `insertTypesEntry`, `outDir`, `tsconfigPath`. The
one helper that spreads into `dts()`
(`ui/scripts/vite-dts-explicit-extensions.ts`) adds only
`beforeWriteFile` and `afterBuild`.
- `unplugin-dts` imports api-extractor with a dynamic `import()` inside
its rollup step only; `tsup` loads it only for `experimentalDts`.
</details>

<details><summary>Evidence 2: OSV-Scanner v2.5.0 (the workflow's
scanner), offline npm database freshly downloaded</summary>

- This head, `--offline-vulnerabilities --download-offline-databases
--config` pointing at this head's `osv-scanner.toml` (zero
`[[IgnoredVulns]]` entries; the only match for that string is the
commented template, and `g3hv` occurs 0 times): `No issues found`, 1698
packages scanned.
- This head with no ledger at all: `No issues found`.
- `node scripts/check-osv-exemptions.mjs`: exit 0, "osv-scanner.toml
holds zero OSV exemptions (the intended steady state)". `--self-test`:
exit 0.
</details>

<details><summary>Evidence 3: no minimatch 10.x copy in
pnpm-lock.yaml</summary>

- `grep -c -E 'minimatch@10\.|minimatch: 10\.' pnpm-lock.yaml` gives 0.
- Holders by resolved version: 3.1.5 for `glob` 7.2.3; 5.1.9 for
`readdir-glob` 1.1.3; 11.0.3 for `@oclif/core` 5.1.12,
`@typescript-eslint/typescript-estree` 8.74.0 and `glob` 14.0.3; 11.0.9
for `eslint` 10.15.0, `@eslint/config-array` 0.23.6, `@ts-morph/common`
0.29.1 and `@microsoft/api-extractor` 7.58.2.
</details>

<details><summary>api-extractor on minimatch 11, and the dts
builds</summary>

- A direct api-extractor 7.58.2 run on a fixture package resolved
`minimatch@11.0.9`. The fixture's `bundledPackages: ["foo-*"]` against
three declared dependencies drives the `Collector.js` glob branch, the
one `minimatch()` call. With a d.ts rollup enabled: `succeeded: true`, 0
errors, 2 warnings (`ae-missing-release-tag` on the fixture's untagged
exports), and the rolled file carries the fixture's API.
- On 84e6e1c, `turbo run build` over the `@objectstack/cli...` and
`@objectstack/rest...` closures, `@objectstack/metadata-core`,
`@object-ui/plugin-markdown...` and the i18n extract packages, under the
verify lock: `VERDICT command-exit 0`, Tasks 78 successful of 78, 3
cached. Its tsup builds emitted their declarations, with
`check-dts-emitted` passing for metadata-core. The vite builds ran
unplugin-dts: plugin-markdown printed "Declaration files built", as did
the `@object-ui` packages in its closure.
- `pnpm check:override-consistency`: exit 0. Its consumer census reports
the new key as having 0 consumers, which is a report, not a failure; see
Acceptance notes.
</details>

<details><summary>Derived gate families (dispatch-gates.mjs --commands),
on head 84e6e1c</summary>

The change set is 3 paths against merge base 39d611d
(`osv-scanner.toml`, `pnpm-lock.yaml`, `pnpm-workspace.yaml`), giving 25
derived families. All 25 were run on head 84e6e1c, with exit codes
captured before any pipe, and all 25 exited 0. Among them:
`check-osv-exemptions.mjs` and its `--self-test`,
`check:override-consistency`, `check:vendor-export-contract-resolve`,
`check:dual-build-cjs-loads`, `check:changeset-fixed`, `check:nul-bytes`
and `osv-base-relative.mjs --self-test`. The `--ran` reconciliation
reports 25 accounted for, 25 run, 0 NOT-MEASURED and 0 UNRUN. Before the
push, `overlap-check.mjs` returned VERDICT clean exit 0 against
origin/main 39d611d and objectstack-ai#38043.
</details>

## Acceptance notes

- `check:override-consistency` reads an override key as `name@selector`,
split at its last `@`. It does not parse a `parent>child` key, so its
report-only consumer census lists `@microsoft/api-extractor>minimatch`
as having 0 consumers, although api-extractor consumes it. That is a
report, never a failure, and the line must not be read as "safe to
tidy".
- Once an api-extractor release accepts minimatch 11, the override line
comes out in an ordinary dependency PR, with no card.

## Verification

Read first:
1. `pnpm-workspace.yaml`: the new `@microsoft/api-extractor>minimatch`
line and its comment.
2. `osv-scanner.toml`: the deleted entry, and that the header and
template are unchanged.
3. `pnpm-lock.yaml`: the `@microsoft/api-extractor@7.58.2` snapshot's
`minimatch: 11.0.9`.

Two-minute check: `grep -c -E 'minimatch@10\.|minimatch: 10\.'
pnpm-lock.yaml` prints `0`, and `node scripts/check-osv-exemptions.mjs`
prints that the ledger holds zero exemptions.

---

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

Co-authored-by: Claude <noreply@anthropic.com>
Nenzyz pushed a commit to Nenzyz/objectstack that referenced this pull request Dec 1, 2026
…t that mounts the knowledge service (objectstack-ai#38013)

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

Clause-②: no (narrowing)
Metadata-protocol: narrowed
Skills-docs: skills/objectstack-ai/SKILL.md § Knowledge Sources (RAG) —
the run-time clause now says that where an app ships no source, a
run-time save is refused (`503 SERVICE_UNAVAILABLE`, nothing written)
until the stack declares `requires: ['knowledge']` and the server
restarts (it said such items are never indexed); the matching eval case
in `skills/objectstack-ai/evals/skills-tools-knowledge.json` expects the
same; the token-ratchet row moves 6893 → 6906 under ruling record
6513306068, letter B

## 维护者速读

-
作者在没装知识服务的部署上,通过工作台、元数据接口或智能体工具保存知识源时,会当场失败并看到原因和修法(先在应用配置里声明需要知识服务并重启,再保存);以前这种保存显示成功却永远不生效。
- 属于知识库检索这条线,执行您选的方案 D:让作者在保存那一刻就知道,而不是只在看不到的服务器日志里。
-
只影响在这类部署上保存知识源的作者;在这类部署上复制一个含知识源的整个应用包也会被拒、什么都不复制(这是裁决点名的三处之外的第四处,请批准前读下方的待定问题一节);装包、种子数据、迁移照常通过;出问题可整单撤回。
- 要你做的:批准这次收窄(按审批流程)。

## What changes

Ruling D (maintainer, recorded on objectstack-ai#37983, comment 7220511579) is
implemented in the one predicate every save door asks,
`authoredKnowledgeSourceRefusal`
(`packages/metadata-core/src/knowledge-source-save-admission.ts`):

- **No knowledge service registered + a non-system writer ⇒ refused.**
`resolveKnowledgeService()` answering `undefined` (or `null`) used to
admit the save; it now answers `503 SERVICE_UNAVAILABLE` with a message
that names the item, the reason and the remedy in order: add `requires:
['knowledge']` to the stack (or, on a host that composes its own kernel,
`KnowledgeServicePlugin` and a knowledge store), restart, then save the
source again. Nothing is written.
- **Held as ruled:** the engine's own write (`isSystem`: package
install, seed, migration) is never refused (the `isSystem` check still
runs before the service is resolved); a REGISTERED knowledge service
with no `admitAuthoredSource` (not the platform's, for example
host-mounted) keeps today's accept. The module doc (`:33-34` on main)
now says both, and gains a section on the no-service case.
- **Doors.** No door code changed shape: `PUT /meta/:type/:name` in
`packages/rest` passes `refused.code` through for a non-403
(`SERVICE_UNAVAILABLE`), the runtime dispatcher `PUT` derives
`SERVICE_UNAVAILABLE` from `503`, and the MCP `save_metadata_draft`
passes `refused.code` through for a non-403 (on `main` since objectstack-ai#37306).
Only their comments are updated. Each door is pinned.
- **Why `503 SERVICE_UNAVAILABLE`** (ADR-0112 status table,
`STATUS_TO_STANDARD_CODE` in `packages/spec/src/api/errors.zod.ts`): the
save needs a service this deployment does not run. It is the code this
module already answers for a knowledge service that cannot be reached,
and the code the knowledge service answers at index and search for a
source whose store is not mounted (the same kind of composition fact).
It is also the one code all three doors already carry without a door
change. Rejected: `400 VALIDATION_ERROR` (the item is valid; a
validation code sends the author to fix the item), `403` (not a
permission), `501 NOT_IMPLEMENTED` (the meta door's answer for a
protocol with no `saveMetaItem`), `409 RESOURCE_CONFLICT` and `428
PRECONDITION_REQUIRED` (no conflicting resource, no missing request
precondition), and a new ledger code (a contract change the ruling did
not make). The message carries the remedy and does not say "try again".
- **ADR-0087:** `Metadata-protocol: narrowed` owes a registered entry:
`packages/spec/src/migrations/entries/semantic/19.knowledge-source-save-refused-without-knowledge-service.ts`
(notice only, no D2 conversion: the fix is the deployment's composition,
never the item). The changeset carries `registered` with that id.

## Boot line and docs (ruling items 2 and 4), landed after objectstack-ai#37306

Held off this branch until objectstack-ai#37306 merged (PR objectstack-ai#38026, dbe0716); `main`
is now merged in (1ca3a31) and the held commit is re-applied as
33acf12.

- **Boot line** (`packages/objectql/src/knowledge-source-unserved.ts`):
the line for `knowledge_source` items held with no knowledge service now
names the same remedy as the save refusal, from the item-4 patch's
`UNSERVED_REMEDY`: declare `requires: ['knowledge']` and restart (or, on
a host that composes its own kernel, `KnowledgeServicePlugin` and a
knowledge store). Before, it said "add `KnowledgeServicePlugin` and a
knowledge adapter to the composition". Only the boot-line half of that
patch was taken: objectstack-ai#37306 did not touch this file, so `main` still carried
the old text.
- **What objectstack-ai#37306 changed, and what that changes here.** A source the app
ships in `knowledgeSources` now mounts the service by itself, and
`adapter` is optional. So a source saved at run time (Studio, the
metadata API, MCP) is never one that mounts the service, and the remedy
the maintainer ruled (`requires: ['knowledge']`, restart, then save) is
still the one that fixes such a save. The refusal sentence is unchanged.
The docs now also say that a source saved at run time does not mount the
service. The boot-line module doc says that the items it names are ones
the stack does not ship. Main's `knowledge-rag.mdx` already said "the
token is for an app that ships none and authors its sources at run
time", which matches.
- **Docs.** `content/docs/ai/knowledge-rag.mdx`: a bullet beside
"Without a source or the token", plus a clause on the run-time-authoring
bullet. `content/docs/protocol/knowledge.mdx`: the boot-line paragraph
names the remedy (it named the plugin and an adapter), and a paragraph
under "Who may author one" covers the refusal, the duplicate and the
holds. Rewritten against main's merged text, not patched blindly: `git
am --3way` conflicted on `knowledge-rag.mdx`.
- **Changeset:** gains the `@objectstack/objectql` and
`@objectstack/skills` patch lines and their bullets.
- The MCP draft door on `main` now passes `refused.code` through for a
non-403 (objectstack-ai#37306), so this refusal still arrives there as
`SERVICE_UNAVAILABLE`.

## Open question

The package **duplicate** door (`POST /packages/:id/duplicate`) asks the
same predicate for each knowledge source it copies, so on a deployment
with no knowledge service it now refuses a duplicate of a package that
holds one, `503`, naming the remedy (pinned in
`packages-knowledge-source-gate.test.ts`). The ruling names three doors;
this is the fourth door that saves a source as the caller. Keeping it
refused is the predicate's own reading and the ruling's principle (the
copy would be kept and never served); carving it out needs a new input
on an exported function. Recommendation: keep it.

## Tests

- `packages/metadata-core/src/knowledge-source-save-admission.test.ts`:
refusal with code, status, the reason sentence and the ordered remedy,
for both URL spellings and for `undefined`/`null`; an unnamed item;
`isSystem` not refused and the service never resolved; a registered
service without the member still admits.
- REST `PUT`
(`packages/rest/src/meta-write-door-capability-enumeration.test.ts`):
refused on the kernel's branded "never registered" miss and on a server
with no kernel provider; system write saved; host-mounted service saved.
- Runtime dispatcher `PUT`
(`packages/runtime/src/domains/meta-save-capability-gate.test.ts`):
refused on a real `ObjectKernel` with nothing registered; system write
saved; host-mounted service saved.
- MCP `save_metadata_draft`
(`packages/runtime/src/domains/mcp-authoring.test.ts`): refused, nothing
written, another type still saves; host-mounted service saved.
- Package duplicate
(`packages/runtime/src/domains/packages-knowledge-source-gate.test.ts`):
refused, nothing copied; a package with no source and the engine's own
call copy as before.
- Boot line (`packages/objectql/src/knowledge-source-unserved.test.ts`):
names `Declare requires: ['knowledge'] in the stack and restart`.

Head is now `5bc3ee1a00`. Since `33acf12ec4` it adds only: the
test-harness fix `6e4a904ea1` (the MCP `knowledge_source` contract case
from objectstack-ai#38053 mounts an admitting knowledge service; comment 7232197442),
the skills text, eval expectation, ratchet row and changeset line above,
the module-doc wording at index and search, and two clean merges of
`main` (the second carries objectstack-ai#38091). No runtime or rest code moved after
`33acf12ec4`, so the dogfood battery below stands. On `5bc3ee1a00`: the
skills token ratchet exits 0 (6906, headroom 0; self-test 111 cases
pass), `check:skill-docs` and `check:skill-refs` exit 0, and the
changeset, ADR-0087, NUL-byte and issue-citation gates exit 0. After the
harness fix, runtime reads 12315 passed, 0 failed.

Readings at head `33acf12ec4` (main merged in; shared container; every
build and test through `scripts/pm/os-verify-lock.sh`, verdict
`command-exit 0` each round):

<details><summary>Tests and typecheck at 33acf12</summary>

- Full build (`turbo run build`, all but docs) exit 0,
`packages/runtime/.objectstack` cleared, `@objectstack/spec
check:generated` exit 0.
- `@objectstack/metadata-core` `pnpm test`: Tests 1113 passed;
`typecheck` exit 0.
- `@objectstack/objectql` `knowledge-source-unserved.test.ts`: Tests 7
passed; `typecheck` exit 0.
- `@objectstack/rest`, 4 files (door enumeration, type-write capability,
both org-scope suites): Tests 161 passed; `typecheck` exit 0.
- `@objectstack/runtime`, 10 files (dispatcher save gate, MCP authoring,
package knowledge gate, error passthrough, capability parity, org scope,
ensure-customization, publish-drafts x2, package state store): Tests 304
passed; `typecheck` exit 0.
- On the first head, 5 suites that save a `knowledge_source` as a
capable author with no knowledge service went red: that is the ruled
refusal. Their harnesses now mount a knowledge service that admits every
source. Two door-level `isSystem` cases were dropped because inbound
HTTP never carries `isSystem` (`metaTypeWriteRefusal` answers 401
first); that hold is tested at the predicate instead.
- Narrowed locally: the full rest and runtime suites, `test:repo`, and
the derived families not listed under Gates run in CI.

</details>

<details><summary>Ablations (one per tested behaviour)</summary>

- **The save refusal** (at dd50936): `scripts/ablation-replace.mjs`
replaced the one new line (anchor 1 -> 0, marker 0 -> 1).
`@objectstack/metadata-core` was rebuilt, and `ablation-dist-preflight`
found the marker in `dist/index.js` and `dist/index.cjs`. Exactly these
went red: the predicate test (1 of 9), REST `PUT` (1 of 81), and
dispatcher `PUT`, MCP draft save and package duplicate (3 of 162).
Restored with `git checkout HEAD` (blob back to cd26e8f, `git diff
HEAD` empty), rebuilt, and preflight `--absent` was clean.
- **The boot line** (at 33acf12): the remedy was put back to main's
text (anchor 1 -> 0, marker 0 -> 1; the test imports source, so no build
was needed). Red: `names the item, the missing service and both
remedies` (1 of 7). Restored with `git checkout HEAD` (blob aa50e2e,
`git diff HEAD` empty).
- The docs pages are not ablated.

</details>

<details><summary>Live server (REST door, at dd50936)</summary>

After a full build I ran `pnpm dev:crm -- --fresh -p 38937`; the CRM
stack declares `requires: ['ui', 'automation']` and no knowledge. Signed
in as the seeded admin, `PUT /api/v1/meta/knowledge_source/faq` answered
`503`, `error.code` `SERVICE_UNAVAILABLE`, with the remedy sentence. A
`GET` of the item then answered `404`, so nothing was written. The
server was stopped by its recorded pid. A positive control on a stack
with `requires: ['knowledge']` was not run (NOT MEASURED); the unit
tests cover the admitted path.

</details>

<details><summary>Gates at 33acf12</summary>

Local, exit 0 each: `check-adr-0087-registration` (1 declared-breaking
changeset, with its disposition), `check-changeset-no-major`,
`check-empty-changeset`, spec `check:upgrade-guide`,
`check:spec-changes`, `check:api-surface` (unchanged),
`check:nul-bytes`, `check:doc-authoring`, `check-affected-docs`,
`check:issue-citations`, `check:dispatcher-error-vocabulary`,
`check:startup-registry-verdict`, `check:durability-log-level`. At
dd50936 these were also exit 0: `check:authorable-surface`,
`check:route-envelope`, `check:error-status-conformance`,
`check-closing-keyword-parity`, `check:cross-package-test-inputs`,
`check:test-source-alias`, `check:adr-anchors`. `overlap-check` before
the push: clean against `main` and against objectstack-ai#38043, objectstack-ai#37982 and objectstack-ai#37963.

</details>

<details><summary>Dogfood battery at 33acf12</summary>

The full battery, run as CI runs it (no `OS_TEST_SHARD`, no path), under
`scripts/pm/os-verify-lock.sh`. The build was `turbo run build
--filter='@objectstack/dogfood^...'` and exited 0. The test was `pnpm
--filter @objectstack/dogfood test`.

- Verdict: `VERDICT command-exit 0 · held the lock 1727s (28m47s)`, in
shared-box seconds.
- `Test Files  490 passed | 3 skipped (493)`
- `Tests  4144 passed | 68 skipped (4212)`
- Failures: none.

Recorded in comment 7229739676. CI's `Dogfood Regression Gate` on the PR
reads `OS_DOGFOOD_RESULT: skipped` (the shards run in the merge queue),
so it is not evidence for this head.

</details>

## Acceptance notes

- The note on this PR's first head about objectstack-ai#37306's `400 VALIDATION_ERROR`
arriving at the MCP draft door as `SERVICE_UNAVAILABLE` is obsolete:
objectstack-ai#37306 merged with the MCP door passing `refused.code` through.
- Docs Drift Check (comment 7222797378) is receipted here.
`content/docs/ai/knowledge-rag.mdx` and
`content/docs/protocol/knowledge.mdx` are updated on this branch.
`content/docs/permissions/system-context.mdx` row 46 is re-read and
still true: the refusal is not on the `isSystem` path. The other pages
match on the `SERVICE_UNAVAILABLE` literal only and say nothing about
knowledge sources. The release-owned pages are not edited.
- Contract review 7228262724 (PASS) and L1 7228292666 (REWORK: dogfood
battery only) are receipted here. The battery is recorded in comment
7229739676: green, and the head is unchanged. The review's nits N1 to N5
are left for a follow-up card; none of them is changed on this head.

## Verification

Read first (by risk):
`packages/metadata-core/src/knowledge-source-save-admission.ts` (the
`service === undefined || null` branch, before the member check),
`packages/runtime/src/domains/packages-knowledge-source-gate.test.ts`
(the fourth door), `content/docs/protocol/knowledge.mdx` (the two
paragraphs rewritten against objectstack-ai#37306's text).

Two-minute check: `pnpm --filter @objectstack/metadata-core exec vitest
run src/knowledge-source-save-admission.test.ts` — expect the "no
knowledge service registered" cases green; flip line `if (service ===
undefined || service === null) return
noKnowledgeServiceRefusal(input.item);` out and they go red.

Body refreshed 2026-11-28T03:15Z at head `5bc3ee1a00`; the readings in
the three blocks above were taken at `33acf12ec4`.

---

_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
…nd the dropSource cleanup (objectstack-ai#38050)

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

Fixes objectstack-ai#38022

Clause-②: no
Metadata-protocol: none

## 维护者速读

- 升级到 19 的运维读升级表时,会看到「以下划线开头的知识源 id 要改名并清理旧索引」这一例外,不再被告知「索引原样找回」。
- 为 AI 知识库(epic 37000)的 18 到 19 升级文档补上一处与升级条目不一致的说法。
- 只改文档与报错文案,不影响运行行为,可直接撤回。
- 无。

## What changes

- `content/docs/protocol/knowledge.mdx`: the `id` row of the 18 to 19
table names the underscore exception (`name` refuses it, the source is
rebuilt under a new name) and the `dropSource` cleanup, in the words of
the upgrade entry `knowledge-source-registration-governed`. It states
the memory adapter holds nothing across a restart. The row does not
touch `adapter`, which objectstack-ai#38026 made optional (rows and prose near it
re-read on current main; no contradiction).
- N1: the upgrade entry's reason says the adapter keeps the old index
only where its store outlives the process (Turso, pgvector); the memory
adapter holds nothing across a restart.
- N2: the `id` tombstone in `knowledge-source.zod.ts` says the entry's
manual notices still apply after `os migrate meta --from 18`; the
reference page `content/docs/references/ai/knowledge-source.mdx` carries
the same sentence.
- `.changeset/37304-knowledge-source-governed-type.md` is not edited: it
sits in `.changeset/pre/` (consumed by pre mode). A new patch changeset
covers the spec string change.

## Tests

NOT MEASURED: `knowledge-source.test.ts` and
`retired-key-migrate-sentence.test.ts` (the tombstone still ends with
the migrate sentence and still begins with its pinned prefix), because
the verify lock was never acquired in 4 attempts over about 36 minutes
(holder was a dogfood run; VERDICT queue-timeout exit 99).

## Acceptance notes

- NOT MEASURED: `pnpm gen:docs` regeneration (needs the spec build, same
lock). The reference page was edited by one exact-string substitution
mirroring the zod edit; CI `check:generated` is the judge.

<details><summary>Verification</summary>

- check:doc-authoring, check:doc-anchors, check:doc-frontmatter,
check:docs-nav-label, check:docs-image-tag: exit 0.
check:docs-transcript-drift: exit 3, NOT MEASURED (prerequisite).
- overlap-check at d60a6ce: VERDICT clean exit 0 (main, objectstack-ai#38043,
objectstack-ai#38013, objectstack-ai#37963 merge cleanly).
- Two-minute check: open the knowledge protocol page, 18 to 19 table,
`id` row: it names the underscore exception.

</details>

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

https://claude.ai/code/session_016WV4cwPhGV4g9p1BGQaZbP

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

dependencies Pull requests that update a dependency file documentation Improvements or additions to documentation size/xl tests tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface

Projects

None yet

2 participants