Skip to content

feat(metadata-core)!: a knowledge source is saved only on a deployment that mounts the knowledge service - #38013

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

os-zhuang merged 12 commits into
mainfrom
claude/area-o1C-37983

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 #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 #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 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.
  • 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 #37306

Held off this branch until #37306 merged (PR #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: knowledge_source: adapter becomes optional (the deployment's store), and a knowledge_source item mounts the knowledge service #37306 did not touch this file, so main still carried the old text.
  • What knowledge_source: adapter becomes optional (the deployment's store), and a knowledge_source item mounts the knowledge service #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 (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 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 #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 #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):

Tests and typecheck at 33acf12
  • 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.
Ablations (one per tested behaviour)
  • 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 cd26e8f520, 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 aa50e2ec54, git diff HEAD empty).
  • The docs pages are not ablated.
Live server (REST door, at dd50936)

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.

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, 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 #38043, #37982 and #37963.

Dogfood battery at 33acf12

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.

Acceptance notes

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

…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>
@github-actions github-actions Bot added size/m documentation Improvements or additions to documentation tests tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface labels Nov 27, 2026
@github-actions

github-actions Bot commented Nov 27, 2026 •

Copy link
Copy Markdown
Contributor

📓 Docs Drift Check

This PR changes 5 package(s): @objectstack/metadata-core, @objectstack/objectql, @objectstack/rest, @objectstack/runtime, @objectstack/spec, touching 12 documentable anchor(s).

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

  • content/docs/ai/connect-mcp.mdx (via SERVICE_UNAVAILABLE (literal, a string literal in noKnowledgeServiceRefusal))
  • content/docs/ai/knowledge-rag.mdx (via SERVICE_UNAVAILABLE (literal, a string literal in noKnowledgeServiceRefusal))
  • content/docs/api/client-sdk.mdx (via SERVICE_UNAVAILABLE (literal, a string literal in noKnowledgeServiceRefusal))
  • content/docs/api/error-catalog.mdx (via SERVICE_UNAVAILABLE (literal, a string literal in noKnowledgeServiceRefusal))
  • content/docs/api/index.mdx (via SERVICE_UNAVAILABLE (literal, a string literal in noKnowledgeServiceRefusal))
  • content/docs/automation/webhooks.mdx (via SERVICE_UNAVAILABLE (literal, a string literal in noKnowledgeServiceRefusal))
  • content/docs/deployment/self-hosting.mdx (via SERVICE_UNAVAILABLE (literal, a string literal in noKnowledgeServiceRefusal))
  • content/docs/kernel/runtime-services/email-service.mdx (via SERVICE_UNAVAILABLE (literal, a string literal in noKnowledgeServiceRefusal))
  • content/docs/permissions/authentication.mdx (via SERVICE_UNAVAILABLE (literal, a string literal in noKnowledgeServiceRefusal))
  • content/docs/permissions/authorization.mdx (via SERVICE_UNAVAILABLE (literal, a string literal in noKnowledgeServiceRefusal))
  • content/docs/permissions/sharing-rules.mdx (via SERVICE_UNAVAILABLE (literal, a string literal in noKnowledgeServiceRefusal))
  • content/docs/permissions/system-context.mdx (via authoredKnowledgeSourceRefusal (symbol, a top-level function), handleMetadataRequest (symbol, a top-level function), openWriter (symbol, a top-level function), registerMetaItemWriteRoutes (symbol, a top-level function))
  • content/docs/protocol/kernel/error-handling.mdx (via SERVICE_UNAVAILABLE (literal, a string literal in noKnowledgeServiceRefusal))
  • content/docs/protocol/knowledge.mdx (via SERVICE_UNAVAILABLE (literal, a string literal in noKnowledgeServiceRefusal))
  • content/docs/ui/print-pages.mdx (via SERVICE_UNAVAILABLE (literal, a string literal in noKnowledgeServiceRefusal))

⛔ 11 release-owned page(s) also name something this change touched. These are read-only:

  • content/docs/releases/implementation-status.mdx (via RestServer (symbol, a top-level class))
  • content/docs/releases/v12.mdx (via RestServer (symbol, a top-level class))
  • content/docs/releases/v16.mdx (via RestServer (symbol, a top-level class))
  • content/docs/releases/v17/17-0.mdx (via SERVICE_UNAVAILABLE (literal, a string literal in noKnowledgeServiceRefusal))
  • content/docs/releases/v17/17-3.mdx (via RestServer (symbol, a top-level class), SERVICE_UNAVAILABLE (literal, a string literal in noKnowledgeServiceRefusal))
  • content/docs/releases/v17/17-4.mdx (via SERVICE_UNAVAILABLE (literal, a string literal in noKnowledgeServiceRefusal))
  • content/docs/releases/v17/17-5.mdx (via RestServer (symbol, a top-level class))
  • content/docs/releases/v17/17-7.mdx (via SERVICE_UNAVAILABLE (literal, a string literal in noKnowledgeServiceRefusal))
  • content/docs/releases/v18/18-2.mdx (via SERVICE_UNAVAILABLE (literal, a string literal in noKnowledgeServiceRefusal))
  • content/docs/releases/v18/18-3.mdx (via RestServer (symbol, a top-level class))
  • content/docs/releases/v18/18-5.mdx (via SERVICE_UNAVAILABLE (literal, a string literal in noKnowledgeServiceRefusal))

content/docs/releases/ is RELEASE-OWNED (AGENTS.md "Documentation Guardrails"): release
notes are written centrally at release time, and a code PR that edits them is the exact PR
that guardrail exists to stop. They are still audited — read-only. If one of them is actually
wrong, file an issue or open a dedicated docs-only PR; do not edit it here.

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

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

Which tree this was computed on

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

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

# while this PR is open — GitHub drops the merge commit once it closes
git fetch origin 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

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

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

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

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

Contract-review-claim: session_016WV4czzx9dtSEm3jWWL9c3 · 33acf12 · 2026-11-27T21:08Z

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

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

Contract review

Served-tier: CONTRACT_REVIEW_TIER
Head-sha: 33acf12ec4b1c5a7d50fe55b99864f867d9e1812
Local-runs: none
Scope: packages/spec/src/migrations/entries/semantic/19.knowledge-source-save-refused-without-knowledge-service.ts + packages/metadata-core/src/knowledge-source-save-admission.ts, packages/objectql/src/knowledge-source-unserved.ts, packages/rest/src/meta-item-write-routes.ts, packages/rest/src/rest-server.ts, packages/runtime/src/domains/meta.ts, packages/runtime/src/domains/mcp-authoring.ts, and the eleven test files of the diff (narrowing face: every path outside the prose faces). Read in the cited code, not reviewed: packages/runtime/src/domains/packages.ts (the duplicate door), packages/runtime/src/http-dispatcher.ts (resolveServiceOrLoud, classifyService), packages/rest/src/rest-api-plugin.ts (kernelServiceProvider), packages/services/service-knowledge/src/knowledge-service.ts and knowledge-service-plugin.ts, packages/spec/src/kernel/platform-capabilities.ts, packages/spec/src/api/errors.zod.ts, packages/spec/src/migrations/types.ts, packages/rest/src/meta-item-history-routes.ts.

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 main (merge base 8d34c44, which is origin/main), and the check-runs on the head: 59 success, 12 skipped (opt-in and queue-only jobs), 0 failure, 0 pending.

① Derived judgments

  • Accept set, narrowed, right: authoredKnowledgeSourceRefusal answered undefined (admit) on main when resolveKnowledgeService answered undefined or null for a non-system writer; at this head it answers a 503 SERVICE_UNAVAILABLE refusal. One new line decides it, placed after the isSystem return and the resolve try/catch and before the member check. This is the narrowing ruling D item 1 orders, and the PR declares it.
  • Accept set, held, right: isSystem === true returns before the service is resolved (ruling item 2); a registered service with no admitAuthoredSource still admits (the claim's fold-or-serial line: only "no knowledge service registered" is ruled). Both are pinned at the predicate.
  • Public surface, unchanged, right: the exported function's signature, AuthoredKnowledgeSourceRefusal, KnowledgeSourceSaveAdmitter and KNOWLEDGE_SOURCE_ADMISSION_SERVICE are untouched; noKnowledgeServiceRefusal is module-private; UNSERVED_REMEDY in objectql is module-private. No Zod schema changes. The spec package gains one semantic migration entry (discovered by file name, id unique in the tree).
  • Doors, right: no door changes shape. REST PUT passes refused.code through for a non-403; the dispatcher PUT answers deps.error(message, 503); the MCP draft save passes refused.code through for a non-403; each is pinned with code, status, the reason sentence, the ordered remedy and a zero-write assertion.
  • Derived and wider than the ruling's enumerated doors: the package duplicate door (refuseDuplicatedKnowledgeSources, not in the diff) asks the same predicate, so a non-system duplicate of a package holding a source is refused 503 on a no-service deployment. Declared in the changeset, the entry's surface, the protocol docs page and a pin. See ③.
  • Boot line, right: text only; describeUnservedKnowledgeSources keeps its signature and its warn, never-refuse posture (ADR-0078 §4, ruling item 2). UNSERVED_REMEDY is a const declared below the function that reads it; it is read at call time, after module evaluation, so there is no temporal-dead-zone fault.

② Semver level

  • Clause-②: no (narrowing) and Metadata-protocol: narrowed appear line-initial in both the PR body and the changeset body. narrowed is the right kind ("a value refused or a requirement tightened"): an author's knowledge_source save that main accepts is refused. no is right: no published export or schema moves (check:api-surface unchanged per the green Lint families).
  • Level: @objectstack/metadata-core minor satisfies "a kind takes at least minor on a package the diff moves"; @objectstack/objectql patch (a log sentence) and @objectstack/spec patch (one upgrade-guide entry) are right for what those packages publish. packages/rest and packages/runtime change comments only and carry no line; nothing they publish moves except through the metadata-core dependency.
  • BREAKING banner, the ! title, the FROM to TO mapping and exactly one ADR-0087 marker (registered knowledge-source-save-refused-without-knowledge-service) are present, and the id matches the entry. Both Check Changeset runs and Lint & Repo Gates are green on this head.

③ Boundary flags

  • Open question (both dev reports, PR body): keep the package duplicate door refused? Answer: A, keep it, as pushed. It is a non-system save of the same item through the one predicate; the ruling's rule sentence reads "at each door that saves one", and its reasoning (ADR-0078 §1) applies to the copy equally; a carve-out needs a new input on an exported function, which the ruling did not order. ESCALATED all the same, because the ruling's parenthesis enumerates three doors and this is a fourth: the refusal blocks the duplicate of a whole package (objects, pages, flows) because it holds one source, and the PR body's maintainer summary does not name it. The Tier H approval is where it is decided; the approver should read the "Open question" section before approving. Not a finding against this head.
  • Dev flag, two door-level isSystem cases dropped: accepted. Inbound HTTP carries no isSystem; the hold is pinned at the predicate, with the resolver asserted never called.
  • Dev flag, five collateral suites now mount an admitting knowledge service: accepted. Each harness change is confined to the knowledge name and keeps the branded not-registered miss for every other name.
  • Dev flag, dogfood battery NOT MEASURED locally: answered by the check-run Dogfood Regression Gate, success on this head.
  • Dev flag, positive live control with requires: ['knowledge'] NOT MEASURED: accepted; the admitted path is unchanged code, pinned by the CONTROL cases, and Test Core 1 to 10 are green.
  • Deviations (commit trailers, a throwaway dev-server session token printed to a transcript and the server stopped): no contract effect; noted, nothing owed here.
  • security_findings: none in both reports: this review found none either. The fail direction stays closed; no accept is widened.
  • SQL push-down: no query, no id materialisation and no in-app join is added anywhere in the diff.
  • Author: user.login is objectstack-fleet[bot]; no relay bypass.
  • Tier: ruling item 3 fixes the landing as Tier H by authorised approval. This record does not replace that approval.

④ Design judgment

No must-fix, no should-fix.

Hits file, 19.knowledge-source-save-refused-without-knowledge-service.ts, against ruling D and its first consumer (the upgrade guide, os migrate meta TODOs):

  • Notice-only with no conversionIds is correct: no key or value of the item changes, and the repair is the deployment's composition, so there is no D2 rewrite to judge. The shape matches SemanticMigration (id, surface, replacement, reason, acceptanceCriteria).
  • replacement and reason agree with the code sentence by sentence: 503 SERVICE_UNAVAILABLE, nothing written, system writes held, a host-registered service answering for its own sources, stored items neither rewritten nor refused at boot (the boot path in knowledge-source-unserved.ts only warns).
  • The remedy is real: platform-capabilities.ts lists knowledge as a requested token that mounts the service and the deployment's store, and KnowledgeServicePlugin registers under the name the doors resolve (KNOWLEDGE_SERVICE, 'knowledge').
  • N1 (nit) — surface, acceptanceCriteria and the changeset's FROM line describe the affected deployment as one whose stack "does not declare requires: ['knowledge']". Since knowledge_source: adapter becomes optional (the deployment's store), and a knowledge_source item mounts the knowledge service #37306 a stack that ships a knowledgeSources entry also mounts the service (mountedBy: { collection: 'knowledgeSources' }), and saves there are accepted. The entry over-includes that deployment; following it there adds a redundant token and breaks nothing. Accepted deviation, or a follow-up docs-face card.

Implementing files, against the ruling:

  • knowledge-source-save-admission.ts: holds. Order of checks is type, isSystem, resolve (throw answers the pre-existing unavailable 503), absent service (new refusal), member check, verdict. The message names the item, the reason and the remedy in the ruled order (token, restart, save) and does not say "try again". The module doc's claim that the knowledge service answers the same code for a store that is not mounted is true (UNMOUNTED_ADAPTER_CODE is SERVICE_UNAVAILABLE, status 503). Tried to break: an unnamed or non-object item (handled, pinned); null service (handled, pinned); a resolver that throws (unchanged path).
  • N2 (nit) — code choice. errors.zod.ts glosses SERVICE_UNAVAILABLE as "temporarily unavailable", and this condition lasts until the stack changes. The ruling left the code open ("a coded refusal (ADR-0112)"), the knowledge service already uses the same code for the same kind of composition fact, and no door needs a new mapping. Accepted deviation.
  • N3 (nit) — on the dispatcher transport and the duplicate door resolveServiceOrLoud also answers undefined for the no-instance-in-scope classification, which would be told "this deployment runs no knowledge service". The platform plugin registers a plain instance (ctx.registerService), so the platform's service cannot reach that state; a host that registers a scoped knowledge factory answering nothing for a scope could. Follow-up card at most.
  • knowledge-source-unserved.ts: holds. The line names the same remedy as the refusal (ruling item 2) and keeps "or remove the item(s)". The module doc's account of where such items come from (a system write after boot, or a save made before the refusal) agrees with the predicate.
  • meta-item-write-routes.ts, rest-server.ts, meta.ts, mcp-authoring.ts: comment-only hunks, each true of the code beside it. REST resolveKnowledgeService answers undefined on no provider and on the branded not-registered miss, and rethrows anything else. N4 (nit) — the reworded jsdoc on OpenAuthoringWriter.itemSaveRefusal ("..., or on a deployment with no knowledge service, or undefined ...") no longer parses as a sentence.
  • N5 (nit) — through the duplicate door the predicate's sentence is appended verbatim, so a caller duplicating a package is told to "save the source again" and that "Nothing was written" after "nothing was copied". Wording only.
  • Tests: the new pins assert code, status, reason, ordered remedy and zero writes at the predicate, REST PUT (branded miss and no provider), dispatcher PUT (real kernel and a double), MCP draft save and the duplicate; the host-mounted accept is pinned at each door. The suites that mount an admitting service do so to stay on their own subject and say so.

Observation outside the diff, not graded: POST /meta/:type/:name/publish and /rollback (meta-item-history-routes.ts) write an item without asking this predicate, as on main. After this change no new draft of a source can be created on a no-service deployment, so the residue is rows that predate the refusal, which the boot line names. A follow-up card can decide whether those doors ask too.

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

VERDICT: PASS

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

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

L1 review — REWORK (dogfood battery only); merits accepted

Head: 33acf12ec4b1c5a7d50fe55b99864f867d9e1812 (card #37983, ruling D 7220511579)

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 503 SERVICE_UNAVAILABLE through, and each door is pinned with its code, status, remedy and zero writes. The boot line names the same remedy. The declarations, levels and ADR-0087 entry 19 agree with the diff. All 62 check-runs on the head are green, with 12 skipped by design.

The l1-face changeset flag is answered. The @objectstack/rest and @objectstack/runtime hunks change comments only and no behavior, so they owe no entry, and Check Changeset is green.

REWORK — one item. The title carries ! and the body declares Clause-②: no (narrowing), so the full dogfood battery is owed on this head and recorded under dogfood_battery. That has not happened yet.

  • The report says the local battery is NOT MEASURED.
  • Dogfood Regression Gate shows success on this head, but its job reads OS_DOGFOOD_RESULT: skipped and OS_VERIFY_RESULT: skipped. The three shards and Dogfood Verify CLI did not run on the PR; they run in the merge queue.
  • So no run of the battery is pinned to this head.

To close it, run the full battery on 33acf12ec4 and record it. If the head does not move and the battery is green, the merits acceptance stands and no delta read is owed. A red result that needs a fix moves the head, and the moved head needs a delta read.

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 itemSaveRefusal jsdoc no longer parses; N5 a duplicating caller is told to save the source again. A second follow-up candidate, outside the diff: the meta publish and rollback routes write an item without asking the predicate. The same is true on main.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

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

Dogfood battery — head 33acf12ec4

This answers the L1 REWORK item (7228292666). The head did not move: 33acf12ec4b1c5a7d50fe55b99864f867d9e1812, and the worktree was clean at the start and at the end.

  • Command, as CI runs it with no OS_TEST_SHARD and no path, under scripts/pm/os-verify-lock.sh (slot dev-37983):
    • NODE_OPTIONS=--max-old-space-size=4096 pnpm exec turbo run build --filter='@objectstack/dogfood^...' --concurrency=2, which exited 0;
    • then pnpm --filter @objectstack/dogfood test, which exited 0.
  • Verdict: VERDICT command-exit 0 · held the lock 1727s (28m47s) · waited 366s (6m06s). These are shared-box seconds. The slot had queued for about 63 minutes across eight tries, and seven of those ended in a queue-timeout, which is not a result.
  • Counts:
    • Test Files 490 passed | 3 skipped (493)
    • Tests 4144 passed | 68 skipped (4212)
    • Duration 1725.09s
  • Failures: none.

The battery is green, so nothing needs a fix and no push follows.


Generated by Claude Code

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

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

L1 verdict (L1-a): ACCEPT at head 33acf12ec4b1c5a7d50fe55b99864f867d9e1812 (Fixes #37983). Delta read answering REWORK 7228292666. The head is unmoved.

Review summary

The 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 pnpm --filter @objectstack/dogfood test. The result was VERDICT command-exit 0:

  • 490 files passed and 3 skipped.
  • 4144 tests passed and 68 skipped.
  • 0 failed.

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.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

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

Seat record · 2026-11-27T23:02Z · PR #38013 (Fixes #37983) · head 33acf12ec4b1c5a7d50fe55b99864f867d9e1812 · Clause-②: no (narrowing) + Metadata-protocol: narrowed — lands as Tier H

维护者速读

  • 做什么:执行你在 2026-11-27T14:12Z 选的方案 D(「D 拒绝保存并说明」)。部署上没装知识服务时,作者通过工作台、元数据接口或智能体工具保存知识源会当场失败,并看到原因和修法。以前这种保存显示成功,却永远不会生效。
  • 风险:21 个文件 +348/−51,大多是各个保存入口的测试,另有一条语义迁移条目和升级说明。装包、种子数据、迁移照常通过。另外,在这类部署上复制一个含知识源的应用包也会被拒,这是裁决点名三处之外的第四处,专区判定保持拒绝,PR 的待定问题一节有说明。
  • 要你做什么:审批人批准即可。契约审核 PASS 7228262724,Head-sha 33acf12ec4b1c5a7d50fe55b99864f867d9e1812;批准后座位自主落地。
  • 不批会怎样:作者在没装知识服务的部署上保存知识源仍显示成功,但什么都检索不到,原因只留在服务器日志里。

Seat opinion: land.

席位核对 — ACCEPT · repo:objectstack#1 · head 33acf12ec4

  1. Shape. Draft, base main, 21 files (+348/−51): packages/metadata-core/src/knowledge-source-save-admission.ts (the save predicate refuses where no knowledge service is mounted) + test; the save doors on both transports, MCP authoring and the package door (rest/src/meta-item-write-routes.ts, rest-server.ts, runtime/src/domains/meta.ts, mcp-authoring.ts) and their pins; objectql/src/knowledge-source-unserved.ts (boot line); semantic migration entry 19.knowledge-source-save-refused-without-knowledge-service.ts; two docs pages; .changeset/37983-knowledge-source-save-needs-the-service.md. Body: Clause-②: no (narrowing), Metadata-protocol: narrowed, Skills-docs: none (reason recorded). check-governed-merges.mjs --pr 38013: no governed path; the narrowing declaration routes it the Tier H way.
  2. Premise measured. Implements the maintainer's ruling D on knowledge: what a knowledge_source saved at run time does on a deployment that mounted no knowledge service (split from #37306 item 4) #37983 (seat ruling record on the card). The package-duplicate door also refuses: the area ruled A (keep it refused), because the rule covers every door that saves an item. It is named in the brief and the PR's Open question section for the approver. Card acceptance met.
  3. Gates (check-runs at this head). 65 success, 16 skipped, 0 failed; the one cancelled row is a Check Changeset run superseded by the body edit, whose re-run passed. mergeable clean. Full dogfood battery green at this head, feat(metadata-core)!: a knowledge source is saved only on a deployment that mounts the knowledge service #38013 comment 7229739676.
  4. Accepted deviations. The fourth door, as above.
  5. Out of scope → where it went. Nits N1–N5 → one follow-up card filed by area o1-C. Security-touching: yes: this PR changes when a save is admitted. The hardening is stated here at rule level only; anything further is with the security seat.
  6. Landing terms. L1-a ACCEPT 7229764783 + contract review PASS 7228262724 (CONTRACT_REVIEW_TIER, same head) ⇒ ②③ in one --handoff stroke. After an authorised APPROVED, seat 1 lands it (maintainer's seat-thread line 2026-11-26T13:33Z 「审批人批准后的 Tier H PR 你可以自主落地」). A head move other than a clean main merge withdraws the hand-off.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

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

Approval request · Clause-②: no (narrowing), Metadata-protocol: narrowed (Tier H) · PR #38013 (Fixes #37983) · head 33acf12ec4b1c5a7d50fe55b99864f867d9e1812

@os-zhuang: this implements the maintainer's ruling D on #37983. On a deployment with no knowledge service mounted, a knowledge_source save through Studio, the meta API or the MCP authoring tools is refused with the reason and the fix, where it used to report success and never take effect. Package install, seed and migration are unchanged. For your judgement: the package-duplicate door refuses too, a fourth door beyond the three the ruling names; the area kept it refused (see the PR's Open question section). Records on this head:

  • L1-a ACCEPT 7229764783
  • contract review PASS 7228262724 (CONTRACT_REVIEW_TIER)
  • full dogfood battery green (7229739676)
  • seat record ACCEPT above

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.

@github-actions

Copy link
Copy Markdown
Contributor

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

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

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

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

  • Test Core (3/10) — 失败步骤: Run this shard's tests

    @objectstack/runtime:test:  FAIL   local  src/domains/mcp-authoring.test.ts > done when: an OAuth author saves an app-crm flow draft with no routable trigger and gets that finding in the same reply > 
      ↳ 失败原因: @objectstack/runtime:test: AssertionError: {"error":{"code":"SERVICE_UNAVAILABLE","message":"The knowledge source 'crm_opportunity_notes' was not saved: this deployment runs no knowledge service, so n
    

↳ 失败原因 是判读的关键:超时(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,按失败测试文件聚合):

历史信号:

  • ⚠️ 本 PR 过去 24h 已在队列失败 3 次(不含本次)。 内容未变而反复失败 ⇒ 高度怀疑 flaky 测试或与同组 PR 的语义冲突,重排不解决。
  • 过去 24h 队列共有 38 个失败构建(不含本次)。

分诊清单:

  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 failure: cause and fix (head 6e4a904ea1)

Cause. Queue build 46088642964 failed in Test Core 3/10 on exactly one case, in packages/runtime/src/domains/mcp-authoring.test.ts:

done when: an OAuth author saves an app-crm flow draft with no routable trigger … > [ADR-0161 K4, K5] the knowledge_source contract serves the content rule and no create seed …

That case came from #38053 (776af349). It saves a knowledge_source draft through save_metadata_draft on a harness that runs no knowledge service. On this branch the save is refused 503 SERVICE_UNAVAILABLE ("The knowledge source 'crm_opportunity_notes' was not saved: this deployment runs no knowledge service"), so the case's save assertion failed. That refusal is the ruled one, behaving as ruled. The other shards were cancelled, not failed.

Fix: harness setup only.

  • origin/main (815e882be9) is merged in, with no rebase: e8f21758b0.
  • 6e4a904ea1 changes that one case's authorThroughDomain call. It now mounts a knowledge service that admits the source (knowledge: { admitAuthoredSource: async () => ({ admitted: true }) }), the same pattern as the file's existing CONTROL case. The case keeps its subject: the served contract, the content rule and the tombstones.
  • The refusal, the predicate, the doors, the changeset and the docs are unchanged. No contract moves.

Sweep. I listed every test that names knowledge_source in runtime, rest, metadata-core, qa/dogfood and app-shell: 17 files. Of these, only mcp-authoring.test.ts changed on main since 33acf12ec4. I also checked the test files main added up to f72f335393 that name knowledge sources (lint, service-knowledge, a spec pin). None of them saves through a door without the service. No dogfood file changed.

Readings. All runs used scripts/pm/os-verify-lock.sh (shared-box seconds), with the closure build exit 0.

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

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

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

L1 verdict (L1-a): REWORK at head 6e4a904ea1db76b7dc04618fb8fcd80e04bccc04 (Fixes #37983). This is a delta read of ACCEPT 7229764783 at 33acf12.

Review summary

The 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 packages/runtime/src/domains/mcp-authoring.test.ts. The MCP knowledge_source contract case from #38053 now mounts an admitting knowledge service, the same pattern as the file's control case. That fix is right, and the refusal, predicate, doors, changeset and docs are unchanged.

What the merge made false: the skills-docs declaration. The body says Skills-docs: none — no page under skills/** teaches saving a knowledge_source at run time. That was true at 33acf12, but #38053 has since landed on main and is in this head. skills/objectstack-ai/SKILL.md § Knowledge Sources now teaches the run-time save. Two sentences there:

  • "an app that ships none and authors sources at run time needs requires: ['knowledge'], or its items are never indexed"
  • "A run-time save needs manage_knowledge_sources beside manage_metadata, and is refused, naming the object or field, ..."

With this PR, the first one is no longer true. On a deployment with no knowledge service, the save is refused 503 SERVICE_UNAVAILABLE, naming the remedy; the item is not saved and left unindexed. This narrowing changes what the skill teaches, so the skill must change in the same PR:

  • Rewrite that clause to say the save is refused and names the remedy.
  • Optionally, add the refusal to the list of run-time save refusals.
  • Change the Skills-docs: line to name the page.
  • Move the token-ratchet row under the standing ruling, if the text grows.

Owed after the fix:

  • A delta contract-tier record on the new head. The head moved, and a narrowing's record must name the head it lands on.
  • A delta L1, then the seat's fresh Tier H hand-off.

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
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

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

Contract-review-claim: session_016WV4czzx9dtSEm3jWWL9c3 · 5bc3ee1 · 2026-11-28T03:16Z

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

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

Contract review

Served-tier: CONTRACT_REVIEW_TIER
Head-sha: 5bc3ee1a00c4ca0982856ab07cb550ab855dc8e6
Local-runs: none
Scope: packages/spec/src/migrations/entries/semantic/19.knowledge-source-save-refused-without-knowledge-service.ts, skills/objectstack-ai/SKILL.md, skills/objectstack-ai/evals/skills-tools-knowledge.json + scripts/check-skills-token-ratchet.mjs, packages/metadata-core/src/knowledge-source-save-admission.ts, packages/runtime/src/domains/mcp-authoring.test.ts, and every other non-prose path of the diff (unchanged since the first record, see ①). Read in the cited code, not reviewed: packages/services/service-knowledge/src/knowledge-service.ts (admitAuthoredSource, the unmounted-adapter refusals), packages/spec/src/kernel/platform-capabilities.ts, packages/skills/package.json.
Security-touching: yes

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 main (merge base 9726bd8; origin/main at bbe4258 does not touch the files below), and the check-runs on this head.

Check-runs when read (2026-11-28, about 03:30Z): 17 success, 11 skipped, 23 in progress, 0 failure. Green so far: both Check Changeset, Governed Surface Queue Guard, both PR-body guards, Lint · ESLint, Lint · docs & code guards, Type Check · source gates, Spec property liveness, Dogfood Regression Gate, Check Documentation Links. Still running: Test Core 1 to 10, Build Core, Build Docs, Lint · repo & tooling gates, Lint · CI, release & engine gates, Lint · PM dispatch-gates, the three scoped lints, three Type Check families, Live E2E UI. This record judges the contract; it does not stand in for the gates still running, and landing waits for every one of them.

① Derived judgments

  • The net diff outside the named files is unchanged, right. Compared file by file (changed lines of the net diff at 33acf12 against base 8d34c44, and at this head against base 9726bd8): 18 files are identical, including entry 19, both docs pages, the objectql boot line, the four door files and every test but one. Six files differ, and they are exactly the ones the area names: the changeset, knowledge-source-save-admission.ts, mcp-authoring.test.ts, scripts/check-skills-token-ratchet.mjs, skills/objectstack-ai/SKILL.md, skills/objectstack-ai/evals/skills-tools-knowledge.json.
  • Accept set, unchanged since the first record: the predicate's code is byte-identical; the only hunk in that file is one module-doc sentence.
  • mcp-authoring.test.ts, right: the case that arrived with docs(skills): objectstack-ai teaches knowledge_source as metadata (shipped vs run-time mount, package-scoped identity) #38053 saves a knowledge_source draft on a harness with no knowledge service, which this PR refuses as ruled; it now mounts an admitting service, the pattern of the file's own CONTROL case, and keeps its subject.
  • Taught surface, changed, right: the skill said that an app shipping no source and authoring at run time "needs requires: ['knowledge'], or its items are never indexed". At this head that is false (nothing is saved), and the clause now says the save is refused until the token is declared and the server restarts.
  • No public export, schema or door moves in the delta.

② Semver level

  • Clause-②: no (narrowing) and Metadata-protocol: narrowed are still line-initial in the PR body and the changeset, and still right: the delta adds no accept-set change of its own.
  • '@objectstack/skills': patch is right: packages/skills is the released package that ships skills/**, and the delta moves its text only. The kind's "at least minor on a package the diff moves" is still carried by @objectstack/metadata-core. The changeset's new bullet states the skill and eval change accurately. One ADR-0087 marker, unchanged.
  • Skills-docs: on the body now names the page, the clause, the eval file and the ratchet move; it agrees with the diff.
  • Both Check Changeset runs are green on this head.

③ Boundary flags

  • L1 REWORK 7232242349 (the skill clause made false by this PR once docs(skills): objectstack-ai teaches knowledge_source as metadata (shipped vs run-time mount, package-scoped identity) #38053 merged): answered. The clause is rewritten, the eval expectation follows, the Skills-docs: line names the page, the ratchet row moves by the measured remainder.
  • Security-touching: yes is meant as a hold, not as a report of a defect: the diff's hunks sit inside the save-admission gate and under the docs heading "Who may author one", and ruling D item 3 fixes the landing as Tier H by authorised approval. This record must not move the PR onto the low-risk skills arm. No security weakness was found in the delta.
  • The ratchet raise cites ruling record 6513306068, letter B. That record is outside this review's inputs; the citation matches the form the script's other rows use, and the arithmetic is checked in ④. Lint · repo & tooling gates, which runs the ratchet, was still in progress when read.
  • The fourth door (package duplicate), escalated in the first record, is unchanged and still for the Tier H approval to decide.
  • SQL push-down: the delta adds no query, id materialisation or in-app join.
  • Author: objectstack-fleet[bot].

④ Design judgment

No must-fix, no should-fix.

skills/objectstack-ai/SKILL.md, the new sentence against the predicate and doors at this head, word by word:

  • "A shipped item mounts the knowledge service and its store": true (mountedBy: { collection: 'knowledgeSources' }).
  • "where an app ships none, a run-time save is refused": true for an author's save through each door when no knowledge service is registered; the engine's own writes are not "run-time saves" in the skill's sense and are not refused.
  • "503 SERVICE_UNAVAILABLE, nothing written": the predicate's status and code, and each door returns before the protocol write.
  • "until you add requires: ['knowledge'] to the stack and restart the server": the refusal's own remedy, in its order.
  • N6 (nit) — the sentence names two of the three ways the service comes to be mounted. A host that composes its own kernel with KnowledgeServicePlugin (which the same paragraph names as a second door) also saves without the token. The compression costs a reader nothing wrong: adding the token there is harmless. Accepted deviation.

skills/objectstack-ai/evals/skills-tools-knowledge.json, case 14: the expected output now says the save is refused (503, nothing written) until the stack declares the token and the server restarts, which is the skill's sentence and the code. Its assertions (requires: ['knowledge'] in either quoting; no contentFields:) are untouched and still fit.

scripts/check-skills-token-ratchet.mjs: the arithmetic reproduces from the trees. SKILL.md is 27596 bytes at the merge base and on origin/main, 27650 at this head; less the 27-byte stamp line that is 27569 to 27623 priced bytes; ceil(27569 / 4) is 6893 and ceil(27623 / 4) is 6906; the row moves 13, pinned at the measurement. The replaced clause was removed, not kept beside the new one.

knowledge-source-save-admission.ts, the one changed sentence: "the code the knowledge service answers at index and search for a store that is not mounted". True at this head: UNMOUNTED_ADAPTER_CODE is SERVICE_UNAVAILABLE with status 503 on the index and search paths, while the save-time refusal that #38060 added to admitAuthoredSource (a source naming no adapter where several are registered and none is the deployment's) is 400 VALIDATION_ERROR. The earlier wording ("itself answers") would have blurred the two; this one does not.

Against #38060, sentence by sentence:

  • Order: the no-service refusal is decided in the predicate before the service is asked, and the 400 is the service's own verdict, so the 400 can only arise where a service is registered. The two never compete, and no sentence of this PR states an order that the code contradicts.
  • Entry 19, the changeset, the boot line and both docs pages name 503 only for the no-service case and for a verdict or service that cannot be reached; none says that every non-403 save refusal is a 503. knowledge-rag.mdx and knowledge.mdx carry the 400 case in main's own text beside this PR's paragraphs, without conflict. The mcp-authoring.ts comment already names the 400 VALIDATION_ERROR pass-through.

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: claude/area-o1C-37983
Reviewed-by: session_016WV4czzx9dtSEm3jWWL9c3

VERDICT: PASS

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

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

L1 verdict (L1-a): ACCEPT on merits at head 5bc3ee1a00c4ca0982856ab07cb550ab855dc8e6 (Fixes #37983). This is a delta read that answers REWORK 7232242349. Landing waits for every check on this head to be green.

Review summary

Contract review. I adopt delta record 7232994044 at this head. It is PASS at the contract tier, and verify-review-tier passes. It has no must-fix and no should-fix, and adds one nit, N6.

  • The PR's own net diff moved in exactly six files. Those are the changeset, one module-doc sentence in knowledge-source-save-admission.ts (the code is byte-identical), the harness case in mcp-authoring.test.ts, the ratchet row, SKILL.md, and the eval file. The other 18 files are line-identical to 33acf12.
  • The skill clause this PR made false now reads true, word by word, against the predicate and the doors. A run-time save on a deployment with no knowledge service is refused with 503, nothing is written, and the remedy is given in the ruled order. The eval expectation follows the clause, and the ratchet reproduces 6893 to 6906.
  • Nothing added contradicts feat(knowledge)!: refuse a knowledge_source save that names an adapter the running deployment does not mount #38060. The no-service 503 is decided before the service is asked. The unmounted-adapter 400 is the service's own verdict, so the two never compete. The reworded module-doc sentence is accurate: 503 at index and search, 400 at save.
  • The changeset levels still hold. '@objectstack/skills': patch is joined to the existing levels. Clause-②: no (narrowing) and Metadata-protocol: narrowed are unchanged. The Skills-docs: line names the page.

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 .changeset/pre/ by the version commit and is published, so it cannot be corrected as a pending changeset. The current text lives in the skill, which this PR fixes.

Next: this is a narrowing and touches skills/**, so it goes to the seat for a fresh Tier H hand-off once CI is green. The package-duplicate escalation to the approver stands.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

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

Seat record · 2026-11-28T03:43Z · PR #38013 (Fixes #37983) · head 5bc3ee1a00c4ca0982856ab07cb550ab855dc8e6 · Clause-②: no (narrowing) + Metadata-protocol: narrowed + governed skills/** — lands as Tier H

This record replaces the hand-off at 33acf12ec4, which was withdrawn when the head moved.

维护者速读

  • 做什么:执行你在 2026-11-27T14:12Z 选的方案 D(「D 拒绝保存并说明」)。部署上没装知识服务时,作者通过工作台、元数据接口或智能体工具保存知识源会当场失败,并看到原因和修法。以前这种保存显示成功,却永远不会生效。这一版还把给 AI 编程助手看的技能文档同步改了,那里原来写的是「不声明就永远不会被索引」,现在改成「保存会被拒绝」。
  • 风险:主体和上次一样(各保存入口、一条语义迁移条目、两页文档)。新增的只有一处测试装配、技能文档一句话、一条测评期望和 token 棘轮一行,运行时代码没动。在这类部署上复制含知识源的应用包也会被拒,这是裁决点名三处之外的第四处,PR 的待定问题一节有说明。
  • 要你做什么:审批人批准即可。契约审核 PASS 7232994044,Head-sha 5bc3ee1a00c4ca0982856ab07cb550ab855dc8e6;批准后座位自主落地。
  • 不批会怎样:作者在没装知识服务的部署上保存知识源仍显示成功,但什么都检索不到,原因只留在服务器日志里。

Seat opinion: land.

席位核对 — ACCEPT · repo:objectstack#1 · head 5bc3ee1a00

  1. Shape. Base main (merge base 9726bd83bb). Against 33acf12ec4, 18 files are line-identical. Six moved: the changeset (adds '@objectstack/skills': patch), one module-doc sentence in knowledge-source-save-admission.ts (code byte-identical), the harness case in packages/runtime/src/domains/mcp-authoring.test.ts, skills/objectstack-ai/SKILL.md, skills/objectstack-ai/evals/skills-tools-knowledge.json, and the scripts/check-skills-token-ratchet.mjs row (6893 → 6906). Body: Clause-②: no (narrowing), Metadata-protocol: narrowed, Skills-docs: names the page. skills/** ⇒ Tier H on its own too.
  2. Premise measured. The queue reds (46088642964, 46091770163, 46094344439) were this PR's refusal meeting the case main gained from docs(skills): objectstack-ai teaches knowledge_source as metadata (shipped vs run-time mount, package-scoped identity) #38053; cause and fix in 7232197442. The skill clause docs(skills): objectstack-ai teaches knowledge_source as metadata (shipped vs run-time mount, package-scoped identity) #38053 taught (an undeclared run-time save is "never indexed") is false under this PR and now says the save is refused, with the remedy in the ruled order. The two refusals do not compete with feat(knowledge)!: refuse a knowledge_source save that names an adapter the running deployment does not mount #38060: the no-service 503 is decided before the service is asked.
  3. Gates (check-runs at this head). Read at hand-off: see the request below. The seat lands only on an all-green head.
  4. Accepted deviations. The fourth door (package duplicate) stays refused, as before. Dogfood: no runtime or rest code moved since battery 7229739676 at 33acf12ec4; the seat also asked for a battery on this head, because the queue's dogfood gate reads non-merge commits after the battery.
  5. Out of scope → where it went. Nits N1–N5 → the follow-up card filed by area o1-C; N6 optional. docs(skills): objectstack-ai teaches knowledge_source as metadata (shipped vs run-time mount, package-scoped identity) #38053's published changeset keeps "never indexed": it was consumed into a release and cannot change; the live text is the skill, fixed here. Security-touching: yes: this PR changes when a save is admitted; stated at rule level only, anything further is with the security seat.
  6. Landing terms. L1-a delta ACCEPT 7233005038 + contract review delta PASS 7232994044 (CONTRACT_REVIEW_TIER, same head) ⇒ ②③ in one --handoff stroke. After an authorised APPROVED, seat 1 lands it (maintainer's seat-thread line 2026-11-26T13:33Z 「审批人批准后的 Tier H PR 你可以自主落地」). A head move other than a clean main merge withdraws the hand-off. For the record: the earlier queue entries (00:34Z and 01:03Z) were added by os-zhuang directly, with no review on file; ruling D item 3 asks for an authorised approval, so this request asks for an APPROVED review on this head before the seat lands it.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

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

Approval request · Clause-②: no (narrowing), Metadata-protocol: narrowed, governed skills/** (Tier H) · PR #38013 (Fixes #37983) · head 5bc3ee1a00c4ca0982856ab07cb550ab855dc8e6

@os-zhuang: a fresh hand-off; the one at 33acf12ec4 is withdrawn. This still implements the maintainer's ruling D on #37983: with no knowledge service mounted, a knowledge_source save through Studio, the meta API or the MCP authoring tools is refused with the reason and the fix. Since your last look: one test harness case now mounts an admitting service (the queue failure), and skills/objectstack-ai now teaches the refusal instead of "never indexed" (@objectstack/skills patch, ratchet 6893 → 6906). Still for your judgement: the package-duplicate door refuses too, a fourth door beyond the three the ruling names. Records on this head:

  • L1-a delta ACCEPT 7233005038
  • contract review delta PASS 7232994044 (CONTRACT_REVIEW_TIER)
  • seat record ACCEPT above

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.

@os-zhuang
os-zhuang added this pull request to the merge queue Nov 28, 2026
Merged via the queue into main with commit d59478f Nov 28, 2026
74 checks passed
@os-zhuang
os-zhuang deleted the claude/area-o1C-37983 branch November 28, 2026 04:51
@objectstack-fleet objectstack-fleet Bot removed the pm:awaiting-merge PR only: landing waits on the maintainer's own review and merge (SKILL.md 复核 ②); never on an issue label Nov 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

knowledge: what a knowledge_source saved at run time does on a deployment that mounted no knowledge service (split from #37306 item 4)

3 participants