Skip to content

fix(knowledge): on a deployment with no knowledge service, duplicating a package copies its knowledge sources unserved - #39383

Draft
objectstack-fleet[bot] wants to merge 2 commits into
mainfrom
claude/project-thread-krwejw
Draft

objectstack-fleet[bot] wants to merge 2 commits into
mainfrom
claude/project-thread-krwejw

Conversation

@objectstack-fleet

@objectstack-fleet objectstack-fleet Bot commented Dec 3, 2026 •

Copy link
Copy Markdown
Contributor

Requested by Bill · project thread

Fixes #39346

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

维护者速读

  • 用户能看到什么变化:没有知识服务的自建环境里,管理员复制一个带知识源的应用(比如从市场装的基础模板)不再整包被拒;副本带着知识源但不生效,以后配好知识服务,原包和副本一起生效。
  • 为什么做:属于「知识检索平台化」专题,执行您对「没有知识服务的环境要不要放行复制」的裁定;基础模板带知识源那张卡在等它。
  • 出错会怎样:最坏是这类环境上复制时少核对了一项检索权限,这是裁定里明说的让步,管理知识源的权限照常要;直接在这类环境保存知识源仍然被拒;可以直接撤回。
  • 要你做什么:无。

What changes

The second of the card's two PRs. The dated note it builds is ADR-0161 K8's note of 2026-12-03 (PR #39354), on ruling 7380897321 on #38374.

  • packages/metadata-core/src/knowledge-source-save-admission.ts: authoredKnowledgeSourceRefusal answers undefined for door: 'duplicate' when resolveKnowledgeService answers nothing. One branch. noKnowledgeServiceRefusal loses its door parameter and its duplicate wording, which nothing reaches any more. No door value added, no exported input added, signature unchanged.
  • packages/runtime/src/domains/packages.ts, packages/runtime/src/knowledge-service-lookup.ts: docblocks only.
  • packages/spec/src/migrations/entries/semantic/19.knowledge-source-save-refused-without-knowledge-service.ts: the package duplicate leaves the entry's surface; reason says a duplicate copies a source unserved.
  • content/docs/protocol/knowledge.mdx: the paragraph "A deployment with no knowledge service saves no source" no longer says a duplicate is refused, and a new paragraph says what a duplicate does there.
  • One changeset: @objectstack/metadata-core, @objectstack/runtime, @objectstack/spec, patch.

Unchanged, and pinned as unchanged: the save doors and the package move-in on a no-service deployment (503), the capability gate at the duplicate, the scoped-factory miss and the unresolvable service at the duplicate (503).

Tests

  • packages/metadata-core/src/knowledge-source-save-admission.test.ts: door: 'duplicate' with no service answers undefined; the same item at door: 'save' is still refused 503.
  • packages/runtime/src/domains/packages-knowledge-source-gate.test.ts: the pin "a host with no knowledge service refuses a duplicate" is flipped. On a no-service host the duplicate answers 200 and the writer runs once; a manage_metadata-only caller is still refused 403; PUT /meta/knowledge_source/faq and POST /packages/pkg-a/move-in are still refused 503 SERVICE_UNAVAILABLE and neither writer runs.
Runs at d39f7c2 (the two commits on main at 8157fd7), and the ablation
  • pnpm --filter @objectstack/metadata-core exec vitest run --maxWorkers=2 src/knowledge-source-save-admission.test.ts: 12 passed.
  • pnpm --filter @objectstack/runtime exec vitest run --maxWorkers=2 src/domains/packages-knowledge-source-gate.test.ts: 89 passed.
  • pnpm --filter @objectstack/metadata-core test: 31 files, 1163 passed (before the move onto the new main, at de99f05; the later commit is comments, docs and the changeset). typecheck of metadata-core and runtime: exit 0.
  • pnpm --filter @objectstack/spec exec vitest run --maxWorkers=2 src/migrations: 255 passed, 2 todo. check:generated: exit 0.
  • Ablation (run before the move onto the new main, same code), through scripts/ablation-replace.mjs with the fix committed first: the branch put back to return noKnowledgeServiceRefusal(input.item), metadata-core rebuilt, ablation-dist-preflight found the marker in dist/. Both pins went red: 1 failed of 12, and 1 failed of 89 (the flipped pin). Restored, blob equal to HEAD, rebuilt, preflight --absent passed, both green again.
  • NOT-MEASURED pnpm --filter @objectstack/runtime test :: the package suite did not finish inside the container's 10-minute foreground cap; it is CI's Test Core.
The card's premise on a booted kernel

Read before the first edit, on main at 850d240b with the Starter of PR #39340 (head ca114a34) laid over the tree, on the Starter's install-test host (no requires), with a scratch test that was never committed.

Acceptance notes

  • The migration ledger's rule on a landed entry. packages/spec/src/migrations/entries/README.md and ADR-0087 state no rule that forbids editing a landed entry's text, and the registration gate (check-adr-0087-registration) judges added entries only. Entry 19 sits in the current protocol major, and the upgrade guide and spec-changes are generated from the registry at publish. So the entry is edited in place under the same id: its surface stops naming a refusal the runtime no longer gives. A new entry was not added, because nothing new is refused or required. check:upgrade-guide and check:spec-changes pass.
  • The whole service verdict goes unasked with no service, not only the permission arm: the adapter and retrieval-mode checks of admitAuthoredSource are the service's too. The texts say so.
  • A deps without the classified lookup (classifyServiceOrLoud): resolveKnowledgeServiceForSave then answers both misses as "nothing registered", so on such a deps a scoped registration with no instance for the environment now copies at the duplicate. The platform's dispatcher supplies the classified lookup, and the scoped refusal at the duplicate stays pinned through it. Stated in the lookup's docblock and the changeset.
  • packages/runtime is in the changeset for its docblocks only; no runtime code path changes there.
  • Three derived local gates answered PREREQUISITE NOT MET, which is not a verdict: check-plugin-teardown-shape --self-test (a shallow clone cannot reach its pinned fixture commit) and check:dual-build-cjs-loads (needs a whole-workspace build). Both are CI's. check:skill-examples refused first for a missing client-react build and passed after it.

Verification

Read first: the branch in authoredKnowledgeSourceRefusal (search for "the dated note of 2026-12-03" in knowledge-source-save-admission.ts), then the flipped pin in packages-knowledge-source-gate.test.ts, then entry 19's surface.

Two-minute check: pnpm --filter @objectstack/runtime exec vitest run --maxWorkers=2 src/domains/packages-knowledge-source-gate.test.ts prints 89 passed.

Local gates: the 121 commands node scripts/pm/dispatch-gates.mjs --commands derived for the diff. 118 exit 0; check:skill-examples exit 0 on re-run; two not measured as above.

Claim: comment 7383707710 on #39346 names this PR's branch, claude/project-thread-krwejw. The first claim (7381239738) named the backup branch the PR 2 commits waited on while PR 1 held this branch.


Generated by Claude Code

…e duplicate copies each knowledge source unserved

Claude-Session: https://claude.ai/code/session_01Utp6CXDYNpike5DVnd7xXE
Co-authored-by: Claude <noreply@anthropic.com>
…, and that the service's whole verdict goes unasked with no service

Claude-Session: https://claude.ai/code/session_01Utp6CXDYNpike5DVnd7xXE
Co-authored-by: Claude <noreply@anthropic.com>
@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 Dec 3, 2026
@github-actions

github-actions Bot commented Dec 3, 2026

Copy link
Copy Markdown
Contributor

📓 Docs Drift Check

This PR changes 3 package(s): @objectstack/metadata-core, @objectstack/runtime, @objectstack/spec, touching 2 documentable anchor(s). ⚠️ 2 changed file(s) yielded no anchor (packages/runtime/src/domains/packages.ts, packages/runtime/src/knowledge-service-lookup.ts), so the pages documenting them are NOT COVERED by this run — this is not a clean bill of health for those files.

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

  • content/docs/permissions/system-context.mdx (via authoredKnowledgeSourceRefusal (symbol, a top-level function))
What this run could not see
  • 2 changed file(s) yielded no anchor (packages/runtime/src/domains/packages.ts, packages/runtime/src/knowledge-service-lookup.ts) — pages documenting those are invisible to this run
  • 2 name(s) were too generic to anchor anything (single lowercase words)
  • the SDK route bridge reached 71 of 256 client-bound route-ledger rows — the other 185 have no registrar path: tail to select them, so pages documenting THEIR client methods cannot appear above, on this or any run. Of those 185: 0 are remediable by widening that discovery convention (an in-repo file declares the path; the convention did not scan it); 60 are structural — on a ledger where NOT ONE row is declared in-repo, so no discovery change reaches them at any price; 125 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 — 190 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 8157fd7127a659e2147524f3f8e4bd3bccd6eeee → packageMentionDocs.

Which tree this was computed on

This run read content/docs from 6ec46bb33e8fb89bc86361385b43d91bb18b27af — the merge of head d39f7c28b985d085c0b958af07498d57d6275fe9 into base 8157fd7127a659e2147524f3f8e4bd3bccd6eeee, 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 6ec46bb33e8fb89bc86361385b43d91bb18b27af && git checkout 6ec46bb33e8fb89bc86361385b43d91bb18b27af
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin 8157fd7127a659e2147524f3f8e4bd3bccd6eeee d39f7c28b985d085c0b958af07498d57d6275fe9 && git checkout -B drift-repro 8157fd7127a659e2147524f3f8e4bd3bccd6eeee && git merge --no-ff d39f7c28b985d085c0b958af07498d57d6275fe9

node scripts/docs-audit/affected-docs.mjs --json 8157fd7127a659e2147524f3f8e4bd3bccd6eeee

⚠️ 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 8157fd7127a659e2147524f3f8e4bd3bccd6eeee → pass the list as
args.docs, on the commit named under Which tree this was computed on.

This branch has not been deployed

No deployments
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

2 participants