Repository navigation
docs(skills): objectstack-ai names the os validate rules for a knowledge_source, each with its fix - #38091
Conversation
… with its fix The knowledge source section lists the five rules os validate and publish report for a source: an unknown object, an unknown field, an object the API does not serve for search, a system object without enable.aiReadable, and the warning for a credential-class or internal member the index never carries. Each comes with its fix, as the rule's own message and hint give it. Restatements are paid down first: the content row's never-indexed clause and egress reason, the name row's identity clause, and the example's adapter comment. The token ratchet row moves 6695 -> 6893 by the measured remainder. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016WV4cwPhGV4g9p1BGQaZbP
|
repo:objectstack#1 · os-elon-musk · session_016WV4czzx9dtSEm3jWWL9c3 Contract-review-claim: session_016WV4czzx9dtSEm3jWWL9c3 · 3626163 · 2026-11-28T02:09Z |
|
repo:objectstack#1 · os-elon-musk · session_016WV4czzx9dtSEm3jWWL9c3 Contract reviewServed-tier: Read: card #37310 (body and its seven comments, the amendments 7221575164 and 7224082428 and the dev report 7232154829 among them), PR #38091 (body, its three-file list, its one comment), the net diff against merge base ① Derived judgments
② Semver level
Clause-②: no. Right: the rules themselves landed with #37971; this diff narrows nothing. ③ Boundary flags
④ Design judgmentskills/objectstack-ai/SKILL.md, each new sentence against
The four deletions leave nothing untaught:
The checked example is otherwise unchanged and scripts/check-skills-token-ratchet.mjs (implementing file). The new comment block agrees with the gate's contract sentence by sentence: what was added, the four deletions with the home each keeps, the ruling and record, the byte arithmetic, and a reproduction line that gives 6893. Nits, none of which moves correctness or the contract:
No must-fix, no should-fix. Not reviewed (lane seat's ACCEPT at Implemented-by: VERDICT: PASS |
|
repo:objectstack#1 · os-elon-musk · session_016WV4czzx9dtSEm3jWWL9c3 L1 verdict (L1-a): ACCEPT at head Review summaryContract review. I adopt record 7232385536 at this head. It is PASS at the contract tier, and
Landing keyword. Gates. All 45 check-runs on the head are done: 29 success, 16 skipped, 0 failed. A conflict to plan for. #38013 now owes an edit to this same section, and the same ratchet row, after main brought in #38053 (REWORK 7232242349). Whichever of the two lands second must merge main and re-measure the ratchet row. If that changes skill text, it needs a delta read. Nits, optional:
Next: this touches |
|
repo:objectstack#1 · os-elon-musk · session_016WV4cwoXEE1amuRAGHdPBs Seat record · 2026-11-28T02:29Z · PR #38091 (Part of #37310) · head 维护者速读
Seat opinion: land. 席位核对 — ACCEPT · repo:objectstack#1 · head
|
|
repo:objectstack#1 · os-elon-musk · session_016WV4cwoXEE1amuRAGHdPBs Approval request · governed @os-zhuang:
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. |
…t that mounts the knowledge service (objectstack-ai#38013) repo:objectstack#1 · os-elon-musk · session_016WV4cwPhGV4g9p1BGQaZbP Fixes objectstack-ai#37983 Clause-②: no (narrowing) Metadata-protocol: narrowed Skills-docs: skills/objectstack-ai/SKILL.md § Knowledge Sources (RAG) — the run-time clause now says that where an app ships no source, a run-time save is refused (`503 SERVICE_UNAVAILABLE`, nothing written) until the stack declares `requires: ['knowledge']` and the server restarts (it said such items are never indexed); the matching eval case in `skills/objectstack-ai/evals/skills-tools-knowledge.json` expects the same; the token-ratchet row moves 6893 → 6906 under ruling record 6513306068, letter B ## 维护者速读 - 作者在没装知识服务的部署上,通过工作台、元数据接口或智能体工具保存知识源时,会当场失败并看到原因和修法(先在应用配置里声明需要知识服务并重启,再保存);以前这种保存显示成功却永远不生效。 - 属于知识库检索这条线,执行您选的方案 D:让作者在保存那一刻就知道,而不是只在看不到的服务器日志里。 - 只影响在这类部署上保存知识源的作者;在这类部署上复制一个含知识源的整个应用包也会被拒、什么都不复制(这是裁决点名的三处之外的第四处,请批准前读下方的待定问题一节);装包、种子数据、迁移照常通过;出问题可整单撤回。 - 要你做的:批准这次收窄(按审批流程)。 ## What changes Ruling D (maintainer, recorded on objectstack-ai#37983, comment 7220511579) is implemented in the one predicate every save door asks, `authoredKnowledgeSourceRefusal` (`packages/metadata-core/src/knowledge-source-save-admission.ts`): - **No knowledge service registered + a non-system writer ⇒ refused.** `resolveKnowledgeService()` answering `undefined` (or `null`) used to admit the save; it now answers `503 SERVICE_UNAVAILABLE` with a message that names the item, the reason and the remedy in order: add `requires: ['knowledge']` to the stack (or, on a host that composes its own kernel, `KnowledgeServicePlugin` and a knowledge store), restart, then save the source again. Nothing is written. - **Held as ruled:** the engine's own write (`isSystem`: package install, seed, migration) is never refused (the `isSystem` check still runs before the service is resolved); a REGISTERED knowledge service with no `admitAuthoredSource` (not the platform's, for example host-mounted) keeps today's accept. The module doc (`:33-34` on main) now says both, and gains a section on the no-service case. - **Doors.** No door code changed shape: `PUT /meta/:type/:name` in `packages/rest` passes `refused.code` through for a non-403 (`SERVICE_UNAVAILABLE`), the runtime dispatcher `PUT` derives `SERVICE_UNAVAILABLE` from `503`, and the MCP `save_metadata_draft` passes `refused.code` through for a non-403 (on `main` since objectstack-ai#37306). Only their comments are updated. Each door is pinned. - **Why `503 SERVICE_UNAVAILABLE`** (ADR-0112 status table, `STATUS_TO_STANDARD_CODE` in `packages/spec/src/api/errors.zod.ts`): the save needs a service this deployment does not run. It is the code this module already answers for a knowledge service that cannot be reached, and the code the knowledge service answers at index and search for a source whose store is not mounted (the same kind of composition fact). It is also the one code all three doors already carry without a door change. Rejected: `400 VALIDATION_ERROR` (the item is valid; a validation code sends the author to fix the item), `403` (not a permission), `501 NOT_IMPLEMENTED` (the meta door's answer for a protocol with no `saveMetaItem`), `409 RESOURCE_CONFLICT` and `428 PRECONDITION_REQUIRED` (no conflicting resource, no missing request precondition), and a new ledger code (a contract change the ruling did not make). The message carries the remedy and does not say "try again". - **ADR-0087:** `Metadata-protocol: narrowed` owes a registered entry: `packages/spec/src/migrations/entries/semantic/19.knowledge-source-save-refused-without-knowledge-service.ts` (notice only, no D2 conversion: the fix is the deployment's composition, never the item). The changeset carries `registered` with that id. ## Boot line and docs (ruling items 2 and 4), landed after objectstack-ai#37306 Held off this branch until objectstack-ai#37306 merged (PR objectstack-ai#38026, dbe0716); `main` is now merged in (1ca3a31) and the held commit is re-applied as 33acf12. - **Boot line** (`packages/objectql/src/knowledge-source-unserved.ts`): the line for `knowledge_source` items held with no knowledge service now names the same remedy as the save refusal, from the item-4 patch's `UNSERVED_REMEDY`: declare `requires: ['knowledge']` and restart (or, on a host that composes its own kernel, `KnowledgeServicePlugin` and a knowledge store). Before, it said "add `KnowledgeServicePlugin` and a knowledge adapter to the composition". Only the boot-line half of that patch was taken: objectstack-ai#37306 did not touch this file, so `main` still carried the old text. - **What objectstack-ai#37306 changed, and what that changes here.** A source the app ships in `knowledgeSources` now mounts the service by itself, and `adapter` is optional. So a source saved at run time (Studio, the metadata API, MCP) is never one that mounts the service, and the remedy the maintainer ruled (`requires: ['knowledge']`, restart, then save) is still the one that fixes such a save. The refusal sentence is unchanged. The docs now also say that a source saved at run time does not mount the service. The boot-line module doc says that the items it names are ones the stack does not ship. Main's `knowledge-rag.mdx` already said "the token is for an app that ships none and authors its sources at run time", which matches. - **Docs.** `content/docs/ai/knowledge-rag.mdx`: a bullet beside "Without a source or the token", plus a clause on the run-time-authoring bullet. `content/docs/protocol/knowledge.mdx`: the boot-line paragraph names the remedy (it named the plugin and an adapter), and a paragraph under "Who may author one" covers the refusal, the duplicate and the holds. Rewritten against main's merged text, not patched blindly: `git am --3way` conflicted on `knowledge-rag.mdx`. - **Changeset:** gains the `@objectstack/objectql` and `@objectstack/skills` patch lines and their bullets. - The MCP draft door on `main` now passes `refused.code` through for a non-403 (objectstack-ai#37306), so this refusal still arrives there as `SERVICE_UNAVAILABLE`. ## Open question The package **duplicate** door (`POST /packages/:id/duplicate`) asks the same predicate for each knowledge source it copies, so on a deployment with no knowledge service it now refuses a duplicate of a package that holds one, `503`, naming the remedy (pinned in `packages-knowledge-source-gate.test.ts`). The ruling names three doors; this is the fourth door that saves a source as the caller. Keeping it refused is the predicate's own reading and the ruling's principle (the copy would be kept and never served); carving it out needs a new input on an exported function. Recommendation: keep it. ## Tests - `packages/metadata-core/src/knowledge-source-save-admission.test.ts`: refusal with code, status, the reason sentence and the ordered remedy, for both URL spellings and for `undefined`/`null`; an unnamed item; `isSystem` not refused and the service never resolved; a registered service without the member still admits. - REST `PUT` (`packages/rest/src/meta-write-door-capability-enumeration.test.ts`): refused on the kernel's branded "never registered" miss and on a server with no kernel provider; system write saved; host-mounted service saved. - Runtime dispatcher `PUT` (`packages/runtime/src/domains/meta-save-capability-gate.test.ts`): refused on a real `ObjectKernel` with nothing registered; system write saved; host-mounted service saved. - MCP `save_metadata_draft` (`packages/runtime/src/domains/mcp-authoring.test.ts`): refused, nothing written, another type still saves; host-mounted service saved. - Package duplicate (`packages/runtime/src/domains/packages-knowledge-source-gate.test.ts`): refused, nothing copied; a package with no source and the engine's own call copy as before. - Boot line (`packages/objectql/src/knowledge-source-unserved.test.ts`): names `Declare requires: ['knowledge'] in the stack and restart`. Head is now `5bc3ee1a00`. Since `33acf12ec4` it adds only: the test-harness fix `6e4a904ea1` (the MCP `knowledge_source` contract case from objectstack-ai#38053 mounts an admitting knowledge service; comment 7232197442), the skills text, eval expectation, ratchet row and changeset line above, the module-doc wording at index and search, and two clean merges of `main` (the second carries objectstack-ai#38091). No runtime or rest code moved after `33acf12ec4`, so the dogfood battery below stands. On `5bc3ee1a00`: the skills token ratchet exits 0 (6906, headroom 0; self-test 111 cases pass), `check:skill-docs` and `check:skill-refs` exit 0, and the changeset, ADR-0087, NUL-byte and issue-citation gates exit 0. After the harness fix, runtime reads 12315 passed, 0 failed. Readings at head `33acf12ec4` (main merged in; shared container; every build and test through `scripts/pm/os-verify-lock.sh`, verdict `command-exit 0` each round): <details><summary>Tests and typecheck at 33acf12</summary> - Full build (`turbo run build`, all but docs) exit 0, `packages/runtime/.objectstack` cleared, `@objectstack/spec check:generated` exit 0. - `@objectstack/metadata-core` `pnpm test`: Tests 1113 passed; `typecheck` exit 0. - `@objectstack/objectql` `knowledge-source-unserved.test.ts`: Tests 7 passed; `typecheck` exit 0. - `@objectstack/rest`, 4 files (door enumeration, type-write capability, both org-scope suites): Tests 161 passed; `typecheck` exit 0. - `@objectstack/runtime`, 10 files (dispatcher save gate, MCP authoring, package knowledge gate, error passthrough, capability parity, org scope, ensure-customization, publish-drafts x2, package state store): Tests 304 passed; `typecheck` exit 0. - On the first head, 5 suites that save a `knowledge_source` as a capable author with no knowledge service went red: that is the ruled refusal. Their harnesses now mount a knowledge service that admits every source. Two door-level `isSystem` cases were dropped because inbound HTTP never carries `isSystem` (`metaTypeWriteRefusal` answers 401 first); that hold is tested at the predicate instead. - Narrowed locally: the full rest and runtime suites, `test:repo`, and the derived families not listed under Gates run in CI. </details> <details><summary>Ablations (one per tested behaviour)</summary> - **The save refusal** (at dd50936): `scripts/ablation-replace.mjs` replaced the one new line (anchor 1 -> 0, marker 0 -> 1). `@objectstack/metadata-core` was rebuilt, and `ablation-dist-preflight` found the marker in `dist/index.js` and `dist/index.cjs`. Exactly these went red: the predicate test (1 of 9), REST `PUT` (1 of 81), and dispatcher `PUT`, MCP draft save and package duplicate (3 of 162). Restored with `git checkout HEAD` (blob back to cd26e8f, `git diff HEAD` empty), rebuilt, and preflight `--absent` was clean. - **The boot line** (at 33acf12): the remedy was put back to main's text (anchor 1 -> 0, marker 0 -> 1; the test imports source, so no build was needed). Red: `names the item, the missing service and both remedies` (1 of 7). Restored with `git checkout HEAD` (blob aa50e2e, `git diff HEAD` empty). - The docs pages are not ablated. </details> <details><summary>Live server (REST door, at dd50936)</summary> After a full build I ran `pnpm dev:crm -- --fresh -p 38937`; the CRM stack declares `requires: ['ui', 'automation']` and no knowledge. Signed in as the seeded admin, `PUT /api/v1/meta/knowledge_source/faq` answered `503`, `error.code` `SERVICE_UNAVAILABLE`, with the remedy sentence. A `GET` of the item then answered `404`, so nothing was written. The server was stopped by its recorded pid. A positive control on a stack with `requires: ['knowledge']` was not run (NOT MEASURED); the unit tests cover the admitted path. </details> <details><summary>Gates at 33acf12</summary> Local, exit 0 each: `check-adr-0087-registration` (1 declared-breaking changeset, with its disposition), `check-changeset-no-major`, `check-empty-changeset`, spec `check:upgrade-guide`, `check:spec-changes`, `check:api-surface` (unchanged), `check:nul-bytes`, `check:doc-authoring`, `check-affected-docs`, `check:issue-citations`, `check:dispatcher-error-vocabulary`, `check:startup-registry-verdict`, `check:durability-log-level`. At dd50936 these were also exit 0: `check:authorable-surface`, `check:route-envelope`, `check:error-status-conformance`, `check-closing-keyword-parity`, `check:cross-package-test-inputs`, `check:test-source-alias`, `check:adr-anchors`. `overlap-check` before the push: clean against `main` and against objectstack-ai#38043, objectstack-ai#37982 and objectstack-ai#37963. </details> <details><summary>Dogfood battery at 33acf12</summary> The full battery, run as CI runs it (no `OS_TEST_SHARD`, no path), under `scripts/pm/os-verify-lock.sh`. The build was `turbo run build --filter='@objectstack/dogfood^...'` and exited 0. The test was `pnpm --filter @objectstack/dogfood test`. - Verdict: `VERDICT command-exit 0 · held the lock 1727s (28m47s)`, in shared-box seconds. - `Test Files 490 passed | 3 skipped (493)` - `Tests 4144 passed | 68 skipped (4212)` - Failures: none. Recorded in comment 7229739676. CI's `Dogfood Regression Gate` on the PR reads `OS_DOGFOOD_RESULT: skipped` (the shards run in the merge queue), so it is not evidence for this head. </details> ## Acceptance notes - The note on this PR's first head about objectstack-ai#37306's `400 VALIDATION_ERROR` arriving at the MCP draft door as `SERVICE_UNAVAILABLE` is obsolete: objectstack-ai#37306 merged with the MCP door passing `refused.code` through. - Docs Drift Check (comment 7222797378) is receipted here. `content/docs/ai/knowledge-rag.mdx` and `content/docs/protocol/knowledge.mdx` are updated on this branch. `content/docs/permissions/system-context.mdx` row 46 is re-read and still true: the refusal is not on the `isSystem` path. The other pages match on the `SERVICE_UNAVAILABLE` literal only and say nothing about knowledge sources. The release-owned pages are not edited. - Contract review 7228262724 (PASS) and L1 7228292666 (REWORK: dogfood battery only) are receipted here. The battery is recorded in comment 7229739676: green, and the head is unchanged. The review's nits N1 to N5 are left for a follow-up card; none of them is changed on this head. ## Verification Read first (by risk): `packages/metadata-core/src/knowledge-source-save-admission.ts` (the `service === undefined || null` branch, before the member check), `packages/runtime/src/domains/packages-knowledge-source-gate.test.ts` (the fourth door), `content/docs/protocol/knowledge.mdx` (the two paragraphs rewritten against objectstack-ai#37306's text). Two-minute check: `pnpm --filter @objectstack/metadata-core exec vitest run src/knowledge-source-save-admission.test.ts` — expect the "no knowledge service registered" cases green; flip line `if (service === undefined || service === null) return noKnowledgeServiceRefusal(input.item);` out and they go red. Body refreshed 2026-11-28T03:15Z at head `5bc3ee1a00`; the readings in the three blocks above were taken at `33acf12ec4`. --- _Generated by [Claude Code](https://claude.ai/code/session_016WV4cwPhGV4g9p1BGQaZbP)_ --------- Co-authored-by: Claude <noreply@anthropic.com>
repo:objectstack#1 · os-elon-musk · session_016WV4cwPhGV4g9p1BGQaZbP
Part of #37310
Clause-②: no
Metadata-protocol: none
维护者速读
What changes
skills/objectstack-ai/SKILL.md§ Knowledge Sources (RAG) now lists whatos validateand publish report for aknowledge_source, by rule id, with the fix for each. I took the wording from the rules' own messages and hints inpackages/lint/src/validate-knowledge-source.tsonmain, not from the card:knowledge-source-object-unknown:source.objectis no object of the stack or its packages. On the CLI it is a warning while the manifest declares a dependency thatpackages[]does not carry. Fix: name a defined object, or declare and install its package.knowledge-source-field-unknown: acontent/metadataFieldsmember is no field of the object;idand the injected system columns resolve. Fix: correct the spelling, or remove the member.knowledge-source-object-not-searchable: the API does not serve the object forsearch. Fix: leaveenable.apiEnabledon; anenable.apiMethodslist must grantlist, withenable.searchablenot false.knowledge-source-system-object-not-ai-readable: asys_object withoutenable.aiReadable: true. Fix: index a business object.knowledge-source-field-never-indexed(warning): a credential-class orinternal: truemember, which the index never carries. Fix: remove it.The section says that an error refuses the publish.
Token ratchet. Raise path: the standing maintainer ruling 2026-10-27 「A:先削重复,余额按实测提高」 (ruling record 6513306068, letter B).
Paid down first: four restatements in the same section.
source.contentrow's "credential-class andinternalfields are never indexed". The-field-never-indexedline now says it.namerow's "with the package, its identity". The intro says it.// no adapter: the deployment's storecomment. Theadapterrow says it.Then the row moves
6695 -> 6893(+198), by the measured remainder only:Changeset:
.changeset/37310-skill-knowledge-source-validate-rules.md,'@objectstack/skills': patch.Skill size readings (
skills/**).skills/objectstack-ai/SKILL.md: 471 -> 487 lines, 26806 -> 27596 bytes, 6695 -> 6893 tokens.Tests
All readings are at
36261634ad.os validateon the section's example: exit 0,"valid": true, zero knowledge-source findings.kb, with objectkb_article(title,body,category,published,sharingModel: 'private') and the example's source verbatim.examples/app-todo, then the directory was deleted.enable: { apiEnabled: false }, content['title', 'bodyy', 'secret']and aField.secretmember. Exit 1, with:knowledge-source-object-not-searchable(error,source.object);knowledge-source-field-unknown(error,content[1]);knowledge-source-field-never-indexed(warning,content[2]).objectstack-ai/skills-tools-knowledge#14, an app that ships no source and authors one at run time), 1 rep per arm:requires: ['knowledge'];Acceptance notes
grep -o 'knowledge-source-[a-z-]*' skills/objectstack-ai/SKILL.md | sort | uniq -cgives each of the five once.os validatewith zero knowledge-source findings (Tests).Part of #37310, notFixes: the card's create seed still waits for knowledge_source: a Studio form to create and edit a knowledge source (object, content fields, metadata fields, where, split) #37309, which is the Studio form that buildssourcefrom the author's input.knowledge_sourcestays onKNOWN_UNSEEDEDwith that reason.Verification
Skill gates under the verify lock (VERDICT command-exit 0)
pnpm turbo run build --filter='@objectstack/cli...' --concurrency=2: exit 0check:skill-docs: exit 0, "Skill docs in sync"check:skill-refs: exit 0, "10 generated files in sync with packages/spec"check:yaml-examples: exit 0, "19 tagged YAML example(s) across 1 file(s) validate"node scripts/check-skills-token-ratchet.mjs: exit 0, "61 authored bundle file(s) within their ceilings"Local subset of the derived gate families (28, each exit 0)
dispatch-gates --commands --repo objectstack-ai/objectstackderives 67 families at36261634ad. I ran 28 of them locally, each exit 0: the ratchet with its self-test,check:nul-bytes,check-empty-changeset,check-adr-0087-registration,check-changeset-no-major,check:doc-authoring,check:skill-links,check:skill-identifier-liveness,check:skill-compatibility,check:skill-frame-sync,check:published-filesand the rest of that set. CI runs the full set.Read first.
skills/objectstack-ai/SKILL.md, the new rule list just above the example. Risk: a fix that departs from the rule's hint.scripts/check-skills-token-ratchet.mjs, the6695 -> 6893comment. Check its arithmetic.Two-minute check. Run
node scripts/check-skills-token-ratchet.mjs | grep objectstack-ai/SKILL. Expect6893 / 6893.Generated by Claude Code