Repository navigation
feat(metadata-core)!: a knowledge source is saved only on a deployment that mounts the knowledge service - #38013
Conversation
…ployment with no knowledge service Claude-Session: https://claude.ai/code/session_016WV4cwPhGV4g9p1BGQaZbP Co-authored-by: Claude <noreply@anthropic.com>
…y door that saves a knowledge_source Claude-Session: https://claude.ai/code/session_016WV4cwPhGV4g9p1BGQaZbP Co-authored-by: Claude <noreply@anthropic.com>
…nowledge_source save refusal Claude-Session: https://claude.ai/code/session_016WV4cwPhGV4g9p1BGQaZbP Co-authored-by: Claude <noreply@anthropic.com>
… mounts a knowledge service; the door isSystem hold lives at the predicate Claude-Session: https://claude.ai/code/session_016WV4cwPhGV4g9p1BGQaZbP Co-authored-by: Claude <noreply@anthropic.com>
📓 Docs Drift CheckThis PR changes 5 package(s): 15 hand-written doc(s) NAME something this change touched and may need an implementation-accuracy re-verification:
⛔ 11 release-owned page(s) also name something this change touched. These are read-only:
What this run could not see
Coarse fallback — 184 page(s) merely mention a changed package (the pre-#9192 predicate, kept for the deliberately-wide backstop): Which tree this was computed onThis run read A worktree cut from an older # while this PR is open — GitHub drops the merge commit once it closes
git fetch origin b447ce4e281d5c4e2b95d9d8242a4fcf1318f43a && git checkout b447ce4e281d5c4e2b95d9d8242a4fcf1318f43a
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin bbe4258649c1ea8492364413c0669f47140f7707 5bc3ee1a00c4ca0982856ab07cb550ab855dc8e6 && git checkout -B drift-repro bbe4258649c1ea8492364413c0669f47140f7707 && git merge --no-ff 5bc3ee1a00c4ca0982856ab07cb550ab855dc8e6
node scripts/docs-audit/affected-docs.mjs --json bbe4258649c1ea8492364413c0669f47140f7707
|
…s mounted; the boot line names the same remedy Claude-Session: https://claude.ai/code/session_016WV4cwPhGV4g9p1BGQaZbP Co-authored-by: Claude <noreply@anthropic.com>
|
repo:objectstack#1 · os-elon-musk · session_016WV4czzx9dtSEm3jWWL9c3 Contract-review-claim: session_016WV4czzx9dtSEm3jWWL9c3 · 33acf12 · 2026-11-27T21:08Z |
|
repo:objectstack#1 · os-elon-musk · session_016WV4czzx9dtSEm3jWWL9c3 Contract reviewServed-tier: Inputs: card #37983 body and all four comments (ruling 7220511579, claim 7220546046, dev reports 7222789795 and 7228132286; no earlier contract-review record), PR #38013 body and file list, the net diff against ① Derived judgments
② Semver level
③ Boundary flags
④ Design judgmentNo must-fix, no should-fix. Hits file,
Implementing files, against the ruling:
Observation outside the diff, not graded: Implemented-by: VERDICT: PASS |
|
repo:objectstack#1 · os-elon-musk · session_016WV4czzx9dtSEm3jWWL9c3 L1 review — REWORK (dogfood battery only); merits acceptedHead: Merits: accepted. The contract-tier review is record 7228262724: PASS, no must-fix, no should-fix, five nits. The record verifies at tier. The predicate change matches ruling D: the no-service refusal comes after the system-identity return and before the member check. Each of the three ruled doors, plus the package-duplicate door, passes The l1-face changeset flag is answered. The REWORK — one item. The title carries
To close it, run the full battery on For the Tier H approval: the contract review escalates one boundary item rather than grading it. The package-duplicate door is a fourth refusing door, while the ruling's parenthesis names three. The area ruled to keep it refused, because the rule sentence covers every door that saves one. That refusal blocks duplicating a whole package because of one source, and the body's maintainer summary does not mention it. The approver should read the PR's Open question section. Nits from the record, optional, for a follow-up card: N1 entry 19's surface text includes stacks that already mount the service by shipping a source; N3 a scoped-factory miss would get the no-service sentence; N4 the |
|
repo:objectstack#1 · os-elon-musk · session_016WV4cwPhGV4g9p1BGQaZbP Dogfood battery — head
|
|
repo:objectstack#1 · os-elon-musk · session_016WV4czzx9dtSEm3jWWL9c3 L1 verdict (L1-a): ACCEPT at head Review summaryThe REWORK item is closed. The full dogfood battery ran on this head under the verify lock (comment 7229739676). It used CI's command: the build of the dogfood closure, then
Nothing was pushed, so the merits acceptance in 7228292666 and contract record 7228262724 (PASS, no must-fix, no should-fix) cover this head as they stand. The duplicate door is named. The body's maintainer summary now names the fourth refusing door, the package duplicate, and points the approver to the Open question section. This answers the contract review's escalation. Gates. All 62 check-runs on this head were green earlier. Check Changeset and PR-body guards are re-running after the body edit and must finish green before landing. Next: this is a narrowing, so it goes to the seat for the Tier H approval. The PR is still a draft. |
|
repo:objectstack#1 · os-elon-musk · session_016WV4cwoXEE1amuRAGHdPBs Seat record · 2026-11-27T23:02Z · PR #38013 (Fixes #37983) · head 维护者速读
Seat opinion: land. 席位核对 — ACCEPT · repo:objectstack#1 · head
|
|
repo:objectstack#1 · os-elon-musk · session_016WV4cwoXEE1amuRAGHdPBs Approval request · @os-zhuang: this implements the maintainer's ruling D on #37983. On a deployment with no knowledge service mounted, a
Every check is green or expected-skip. An APPROVED review on this head lets seat repo:objectstack#1 ready and land it; nothing else is asked. |
⛔ merge queue 构建失败 — 先分诊,再决定要不要重排队列构建 46094344439 红了。队列跑的是全量套件(PR 侧 CI 只跑 affected 子集), 分类: 失败的 job(日志抽取,best effort):
跨 PR 相同签名(24h,按失败测试文件聚合):
历史信号:
分诊清单:
Generated by Claude Code · merge-queue-triage workflow (#4859) |
|
repo:objectstack#1 · os-elon-musk · session_016WV4cwPhGV4g9p1BGQaZbP Merge-queue failure: cause and fix (head
|
Before the fix (e8f21758b0) |
After the fix | |
|---|---|---|
| runtime | 1 failed, 12314 passed, 25 skipped (12340) — the queue's case | 12315 passed, 0 failed, 25 skipped (12340); mcp-authoring.test.ts 75 passed |
| rest | — | 8974 passed, 351 skipped (9325) |
| metadata-core | — | 1113 passed (1113) |
| typecheck | — | runtime, rest and metadata-core all exit 0 |
Runtime's typecheck needed @objectstack/driver-turso built first: three unchanged test files import it. With it built, check:test-typecheck is OK.
Gates.
- overlap-check against
origin/main(f72f335393) and 5 open PR heads:VERDICT clean exit 0. - These local gates exited 0:
check-adr-0087-registration,check-changeset-no-major,check-empty-changeset,check-issue-citations,check-nul-bytes. - The pre-push commit-trailer check passed.
Generated by Claude Code
|
repo:objectstack#1 · os-elon-musk · session_016WV4czzx9dtSEm3jWWL9c3 L1 verdict (L1-a): REWORK at head Review summaryThe delta. Merge e8f2175 brings in main through #38021, and fix 6e4a904 follows it. I compared every file of the PR's net diff against the earlier head, and the only change is the harness setup in What the merge made false: the skills-docs declaration. The body says
With this PR, the first one is no longer true. On a deployment with no knowledge service, the save is refused
Owed after the fix:
The dogfood battery 7229739676 at 33acf12 stands for the merits. The seat decides whether the merged head needs it again, because main moved under it. |
…one is refused until the stack declares the knowledge token The objectstack-ai skill's Knowledge Sources section said an app that ships no source and authors sources at run time "needs requires: ['knowledge'], or its items are never indexed". On such a deployment the save is now refused 503 SERVICE_UNAVAILABLE and nothing is written, so the clause says that instead: the save is refused until the stack declares the token and the server restarts. The matching eval expectation is updated. The token-ratchet row moves by the measured remainder (6695 -> 6709) under the standing raise ruling, and the changeset gains the skills patch line. Claude-Session: https://claude.ai/code/session_016WV4cwPhGV4g9p1BGQaZbP Co-authored-by: Claude <noreply@anthropic.com>
…nowledge service's 503 to index and search The module doc said 503 SERVICE_UNAVAILABLE is the code the knowledge service answers for a store that is not mounted. That holds at index and search; a save that names an unmounted store may be answered otherwise, so the sentence now says where it holds. Comment only. Claude-Session: https://claude.ai/code/session_016WV4cwPhGV4g9p1BGQaZbP Co-authored-by: Claude <noreply@anthropic.com>
# Conflicts: # scripts/check-skills-token-ratchet.mjs
|
repo:objectstack#1 · os-elon-musk · session_016WV4czzx9dtSEm3jWWL9c3 Contract-review-claim: session_016WV4czzx9dtSEm3jWWL9c3 · 5bc3ee1 · 2026-11-28T03:16Z |
|
repo:objectstack#1 · os-elon-musk · session_016WV4czzx9dtSEm3jWWL9c3 Contract reviewServed-tier: Delta of record 7228262724 (head 33acf12, PASS, nits only). Inputs: card #37983 and PR #38013 threads (L1 REWORK 7232242349 and the area's queue-failure note 7232197442 included), the PR body as refreshed at this head, the net diff against Check-runs when read (2026-11-28, about 03:30Z): 17 success, 11 skipped, 23 in progress, 0 failure. Green so far: both ① Derived judgments
② Semver level
③ Boundary flags
④ Design judgmentNo must-fix, no should-fix.
Against #38060, sentence by sentence:
Earlier findings: N1 to N5 of record 7228262724 are nits on files this delta does not change; they stand as accepted deviations or follow-up cards, none reopened. The observation on the publish and rollback doors stands as written there. Implemented-by: VERDICT: PASS |
|
repo:objectstack#1 · os-elon-musk · session_016WV4czzx9dtSEm3jWWL9c3 L1 verdict (L1-a): ACCEPT on merits at head Review summaryContract review. I adopt delta record 7232994044 at this head. It is PASS at the contract tier, and
Dogfood. No runtime or rest code moved, so I accept that battery 7229739676 stands under the seat's rule. CI. It was still running at this reading: 20 success, 12 skipped, 38 in progress, 0 failed. The next step waits for all of it to finish green on this head. Out of scope, noted. #38053's changeset still says such items are "never indexed". That changeset was consumed into Next: this is a narrowing and touches |
|
repo:objectstack#1 · os-elon-musk · session_016WV4cwoXEE1amuRAGHdPBs Seat record · 2026-11-28T03:43Z · PR #38013 (Fixes #37983) · head This record replaces the hand-off at 维护者速读
Seat opinion: land. 席位核对 — ACCEPT · repo:objectstack#1 · head
|
|
repo:objectstack#1 · os-elon-musk · session_016WV4cwoXEE1amuRAGHdPBs Approval request · @os-zhuang: a fresh hand-off; the one at
Every check is green or expected-skip. Ruling D item 3 needs an authorised approval on record, and the earlier queue entries had none, so please submit an APPROVED review on this head; that lets seat repo:objectstack#1 ready and land it. Nothing else is asked. |
repo:objectstack#1 · os-elon-musk · session_016WV4cwPhGV4g9p1BGQaZbP
Fixes #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 declaresrequires: ['knowledge']and the server restarts (it said such items are never indexed); the matching eval case inskills/objectstack-ai/evals/skills-tools-knowledge.jsonexpects the same; the token-ratchet row moves 6893 → 6906 under ruling record 6513306068, letter B维护者速读
What changes
Ruling D (maintainer, recorded on #37983, comment 7220511579) is implemented in the one predicate every save door asks,
authoredKnowledgeSourceRefusal(packages/metadata-core/src/knowledge-source-save-admission.ts):resolveKnowledgeService()answeringundefined(ornull) used to admit the save; it now answers503 SERVICE_UNAVAILABLEwith a message that names the item, the reason and the remedy in order: addrequires: ['knowledge']to the stack (or, on a host that composes its own kernel,KnowledgeServicePluginand a knowledge store), restart, then save the source again. Nothing is written.isSystem: package install, seed, migration) is never refused (theisSystemcheck still runs before the service is resolved); a REGISTERED knowledge service with noadmitAuthoredSource(not the platform's, for example host-mounted) keeps today's accept. The module doc (:33-34on main) now says both, and gains a section on the no-service case.PUT /meta/:type/:nameinpackages/restpassesrefused.codethrough for a non-403 (SERVICE_UNAVAILABLE), the runtime dispatcherPUTderivesSERVICE_UNAVAILABLEfrom503, and the MCPsave_metadata_draftpassesrefused.codethrough for a non-403 (onmainsince knowledge_source: adapter becomes optional (the deployment's store), and a knowledge_source item mounts the knowledge service #37306). Only their comments are updated. Each door is pinned.503 SERVICE_UNAVAILABLE(ADR-0112 status table,STATUS_TO_STANDARD_CODEinpackages/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 nosaveMetaItem),409 RESOURCE_CONFLICTand428 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".Metadata-protocol: narrowedowes 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 carriesregisteredwith that id.Boot line and docs (ruling items 2 and 4), landed after #37306
Held off this branch until #37306 merged (PR #38026, dbe0716);
mainis now merged in (1ca3a31) and the held commit is re-applied as 33acf12.packages/objectql/src/knowledge-source-unserved.ts): the line forknowledge_sourceitems held with no knowledge service now names the same remedy as the save refusal, from the item-4 patch'sUNSERVED_REMEDY: declarerequires: ['knowledge']and restart (or, on a host that composes its own kernel,KnowledgeServicePluginand a knowledge store). Before, it said "addKnowledgeServicePluginand a knowledge adapter to the composition". Only the boot-line half of that patch was taken: knowledge_source: adapter becomes optional (the deployment's store), and a knowledge_source item mounts the knowledge service #37306 did not touch this file, somainstill carried the old text.knowledgeSourcesnow mounts the service by itself, andadapteris 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'sknowledge-rag.mdxalready said "the token is for an app that ships none and authors its sources at run time", which matches.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 --3wayconflicted onknowledge-rag.mdx.@objectstack/objectqland@objectstack/skillspatch lines and their bullets.mainnow passesrefused.codethrough for a non-403 (knowledge_source: adapter becomes optional (the deployment's store), and a knowledge_source item mounts the knowledge service #37306), so this refusal still arrives there asSERVICE_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 inpackages-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 forundefined/null; an unnamed item;isSystemnot refused and the service never resolved; a registered service without the member still admits.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.PUT(packages/runtime/src/domains/meta-save-capability-gate.test.ts): refused on a realObjectKernelwith nothing registered; system write saved; host-mounted service saved.save_metadata_draft(packages/runtime/src/domains/mcp-authoring.test.ts): refused, nothing written, another type still saves; host-mounted service saved.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.packages/objectql/src/knowledge-source-unserved.test.ts): namesDeclare requires: ['knowledge'] in the stack and restart.Head is now
5bc3ee1a00. Since33acf12ec4it adds only: the test-harness fix6e4a904ea1(the MCPknowledge_sourcecontract case from #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 ofmain(the second carries #38091). No runtime or rest code moved after33acf12ec4, so the dogfood battery below stands. On5bc3ee1a00: the skills token ratchet exits 0 (6906, headroom 0; self-test 111 cases pass),check:skill-docsandcheck:skill-refsexit 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 throughscripts/pm/os-verify-lock.sh, verdictcommand-exit 0each round):Tests and typecheck at 33acf12
turbo run build, all but docs) exit 0,packages/runtime/.objectstackcleared,@objectstack/spec check:generatedexit 0.@objectstack/metadata-corepnpm test: Tests 1113 passed;typecheckexit 0.@objectstack/objectqlknowledge-source-unserved.test.ts: Tests 7 passed;typecheckexit 0.@objectstack/rest, 4 files (door enumeration, type-write capability, both org-scope suites): Tests 161 passed;typecheckexit 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;typecheckexit 0.knowledge_sourceas 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-levelisSystemcases were dropped because inbound HTTP never carriesisSystem(metaTypeWriteRefusalanswers 401 first); that hold is tested at the predicate instead.test:repo, and the derived families not listed under Gates run in CI.Ablations (one per tested behaviour)
scripts/ablation-replace.mjsreplaced the one new line (anchor 1 -> 0, marker 0 -> 1).@objectstack/metadata-corewas rebuilt, andablation-dist-preflightfound the marker indist/index.jsanddist/index.cjs. Exactly these went red: the predicate test (1 of 9), RESTPUT(1 of 81), and dispatcherPUT, MCP draft save and package duplicate (3 of 162). Restored withgit checkout HEAD(blob back to cd26e8f520,git diff HEADempty), rebuilt, and preflight--absentwas clean.names the item, the missing service and both remedies(1 of 7). Restored withgit checkout HEAD(blob aa50e2ec54,git diff HEADempty).Live server (REST door, at dd50936)
After a full build I ran
pnpm dev:crm -- --fresh -p 38937; the CRM stack declaresrequires: ['ui', 'automation']and no knowledge. Signed in as the seeded admin,PUT /api/v1/meta/knowledge_source/faqanswered503,error.codeSERVICE_UNAVAILABLE, with the remedy sentence. AGETof the item then answered404, so nothing was written. The server was stopped by its recorded pid. A positive control on a stack withrequires: ['knowledge']was not run (NOT MEASURED); the unit tests cover the admitted path.Gates at 33acf12
Local, exit 0 each:
check-adr-0087-registration(1 declared-breaking changeset, with its disposition),check-changeset-no-major,check-empty-changeset, speccheck: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-checkbefore the push: clean againstmainand against #38043, #37982 and #37963.Dogfood battery at 33acf12
The full battery, run as CI runs it (no
OS_TEST_SHARD, no path), underscripts/pm/os-verify-lock.sh. The build wasturbo run build --filter='@objectstack/dogfood^...'and exited 0. The test waspnpm --filter @objectstack/dogfood test.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)Recorded in comment 7229739676. CI's
Dogfood Regression Gateon the PR readsOS_DOGFOOD_RESULT: skipped(the shards run in the merge queue), so it is not evidence for this head.Acceptance notes
400 VALIDATION_ERRORarriving at the MCP draft door asSERVICE_UNAVAILABLEis obsolete: knowledge_source: adapter becomes optional (the deployment's store), and a knowledge_source item mounts the knowledge service #37306 merged with the MCP door passingrefused.codethrough.content/docs/ai/knowledge-rag.mdxandcontent/docs/protocol/knowledge.mdxare updated on this branch.content/docs/permissions/system-context.mdxrow 46 is re-read and still true: the refusal is not on theisSystempath. The other pages match on theSERVICE_UNAVAILABLEliteral only and say nothing about knowledge sources. The release-owned pages are not edited.Verification
Read first (by risk):
packages/metadata-core/src/knowledge-source-save-admission.ts(theservice === undefined || nullbranch, 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 #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 lineif (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 at33acf12ec4.Generated by Claude Code