Repository navigation
docs(skills): service-registry examples call the contracts they annotate - #31879
Conversation
Basic Usage typed the objectql service as IDataEngine and called
db.object(...).find(), which IDataEngine does not declare; it now calls
db.find('account'). Optional Services called IRealtimeService.publish with
two arguments; it now awaits publish with one RealtimeEventPayload.
Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QsR2jQuso4hiuicJq7WSEz
|
domain:skills#3 · zhuangjianguo · session_01QsR2jULfPnqQFGcZUtKDFH Contract-review-claim: session_01QsR2jULfPnqQFGcZUtKDFH · head 738209c · 2026-11-09T09:08Z The lane seat's isolated Fable reviewer runs the |
|
domain:skills#3 · zhuangjianguo · session_01QsR2jULfPnqQFGcZUtKDFH Contract reviewServed-tier: Read: card #31112 (body and all 20 comments, the slice-6 claim 6735852486 and dev report 6736276885 included), PR #31879 body, file list and the net diff against Check-runs on the head at record time: every concluded run is success or skipped (Build Core, Test UI, Live E2E UI, Dogfood Regression Gate, Type Check · source gates, Type Check · workspace, Type Check · debt ledger, every Lint job, Governed Surface Queue Guard, Check Changeset, Check PR Size, PR-body guards). ① Derived judgments
② Semver level
Clause-②: no — right. The diff narrows no declared capability and declares no new one; plain ③ Boundary flagsDev-report
Dev-report
④ Design judgment
Nothing in the diff implements or enforces the rule (no gate, no validator, no schema), so there is no implementing file to judge; the changeset is release metadata and is covered in ②. Implemented-by: VERDICT: PASS |
The No Error Handling for Optional Service pair called realtime.publish with two arguments; both halves now pass one RealtimeEventPayload, the same shape as the Optional Services example. The API intro now counts the four methods its block lists. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QsR2jQuso4hiuicJq7WSEz
|
domain:skills#3 · zhuangjianguo · session_01QsR2jULfPnqQFGcZUtKDFH Contract-review-claim: session_01QsR2jULfPnqQFGcZUtKDFH · head 08f5d7c · 2026-11-09T09:24Z The lane seat's isolated Fable reviewer runs the |
|
domain:skills#3 · zhuangjianguo · session_01QsR2jULfPnqQFGcZUtKDFH Contract reviewServed-tier: Delta round on PR comment 6736459920 (PASS on 738209c: F1 should-fix, F2 nit). The seat accepted F2 as is and ordered F1 fixed plus the L7 method count. The only change since is the single commit 08f5d7c on top of 738209c (git diff 738209c 08f5d7c: 2 files, 5 insertions, 5 deletions): Read: card #31112 (body and every comment, the slice-6 claim 6735852486, the first dev report 6736276885, the rework report 6736563359 and the previous record included), PR #31879 body (the replaced v2 body), file list and the net diff at 08f5d7c, the check-runs on 08f5d7c, and in the live tree on Check-runs on the head at record time: every concluded run is success or skipped (Build Core, Test UI, Live E2E UI, Dogfood Regression Gate, Type Check · source gates, Type Check · workspace, Type Check · debt ledger, Type Check · consumer gates, Lint · PM dispatch-gates, Lint · ESLint, Lint · CI, release & engine gates, Lint · scoped (three jobs), Governed Surface Queue Guard, Check Changeset, Check PR Size, PR-body guards). ① Derived judgments
② Semver level
Clause-②: no — right. The delta narrows no declared capability and declares no new one; plain ③ Boundary flagsRework report 6736563359
④ Design judgment
Nothing in the diff implements or enforces the rule (no gate, no validator, no schema), so there is no implementing file to judge; the changeset is release metadata and is covered in ②. No must-fix and no should-fix: nits alone, so the round ends on this record. Implemented-by: VERDICT: PASS |
|
domain:skills#3 · zhuangjianguo · session_01QsR2jULfPnqQFGcZUtKDFH 维护者速读
席位核对Head-sha:
|
…les compile against the kernel Plugin contract (objectstack-ai#32191) <!-- claude-projects-attribution: {"github_login":"huangyiirene"} --> _Requested by **Irene** · [project thread](https://claude.ai/code/project/chan_01TJXtQ1tVD26ecLDZxFS67x?thread=cmsg_01TJXtQ1tVD26ecLDZxFS67xCnkH8ikcdEEh14bVjmhM89)_ Part of objectstack-ai#31112 Slice 9 of the card: item 4, the objectstack-platform example blocks that slice 6 left (SKILL.md, `references/bootstrap.md`, `references/operations.md`, `references/plugin-development.md`). ## 维护者速读 **需要你做的:** 本 PR 为 **Tier H**(`skills/**`,`check-governed-merges.mjs --test` 实测 GOVERNED),保持 draft;当前 head 还欠契约审查(contract review),由 skills 席位按 `CONTRACT_REVIEW_TIER` 做记录审查,通过后席位再请你批准。 改了什么:platform SKILL.md 的 manifest 示例包进 `defineStack({ manifest })` 并加 `<!-- os:check -->`,现在由 `check:skill-examples` 编译(343 → 344)。 修了一行错误示例:`plugin-development.md` 的完整插件示例写 `type: 'plugin'`,不在 `PluginType` 封闭集合里,`kernel.use()` 启动时会拒绝;改为 `'standard'`。 Plugin Interface 概览块的 import 与其声明冲突,并缺 `PluginType`,一并修正。 其余 21 块依赖 `@objectstack/core`、运行时包或项目本地模块,或是片段,检查器只解析 `@objectstack/spec`,所以不加标记;另有 2 块加包装后能编译,但 token 行没有余量,按席位裁定不加标记。 四个 token 行都没有超过上限,没有改动任何上限。 ## What changes - **`skills/objectstack-platform/SKILL.md` § Manifest Reference:** the bare `manifest: { … }` fragment is now `defineStack({ manifest: { … } })` with its import, under `<!-- os:check -->`. The cost is paid inside the block. The comment padding is gone. The `engines` comment "Metadata-protocol major this app targets" is cut, because the `manifest.engines.protocol` paragraph directly below states the same thing. "Optional description" is shortened to "Optional". - **`references/plugin-development.md` § Complete Example (L191):** `type: 'plugin'` → `type: 'standard'`. Against core's `.d.ts` this is TS2322: `PluginType` is the closed set `'standard'` plus the core plugin types, and `'plugin'` is not in it. `kernel.use()` runs `PluginSchema` over every plugin object and raises `PLUGIN_CONTRACT_VIOLATION` for this value, so the copied plugin would not boot. - **`references/plugin-development.md` § Plugin Interface (L71):** the block imported `Plugin` and then declared `interface Plugin` (TS2440), and used `PluginType` without importing it (TS2304). The import is now `{ PluginContext, PluginType }`. The interface shape is unchanged. ### Cut list, with surviving homes | Cut | Surviving home | |:--|:--| | SKILL.md manifest block: `// Metadata-protocol major this app targets` on `engines` | the `**manifest.engines.protocol:**` paragraph directly below the block ("the metadata-protocol major the app is authored against") | | SKILL.md manifest block: `// Optional description` → `// Optional` | same line: the key is `description`, the comment keeps "Optional" | | SKILL.md manifest block: alignment spaces before the comments | none needed: whitespace | No rule is cut. No line changed here is pinned: `packages/*/src/**/*.test.ts` and `skills/objectstack-platform/evals/*.json` were grepped for the changed lines (`config-plugins-ops.json` case 1 expects `engines: { protocol: '^18' }`, which stays). § Manifest Reference is not a registered exhaustive section in `check-skill-identifier-liveness.mjs`. ### Diffs ```diff @@ skills/objectstack-platform/SKILL.md · § Manifest Reference +<!-- os:check --> ```typescript -manifest: { - id: 'com.example.crm', // Reverse domain unique ID - version: '1.0.0', // Semver - type: 'app', // app | plugin | driver | module | ... - name: 'Acme CRM', // Human-readable display name - description: 'CRM system', // Optional description - engines: { protocol: '^18' }, // Metadata-protocol major this app targets -} +import { defineStack } from '@objectstack/spec'; +export default defineStack({ manifest: { + id: 'com.example.crm', // Reverse domain unique ID + version: '1.0.0', // Semver + type: 'app', // app | plugin | driver | module | ... + name: 'Acme CRM', // Human-readable display name + description: 'CRM system', // Optional + engines: { protocol: '^18' }, +} }); ``` @@ skills/objectstack-platform/references/plugin-development.md · § Plugin Interface -import type { Plugin, PluginContext } from '@objectstack/core'; +import type { PluginContext, PluginType } from '@objectstack/core'; @@ skills/objectstack-platform/references/plugin-development.md · § Complete Example version: '1.0.0', - type: 'plugin', + type: 'standard', ``` ### Marks, before → after (column-0 `ts`/`typescript` fences) | File | before | after | |:--|:--|:--| | SKILL.md | 0/4 | 1/4 | | references/bootstrap.md | 1/6 | 1/6 | | references/operations.md | 0/1 | 0/1 | | references/plugin-development.md | 0/12 | 0/12 | | **platform total (with slice 6's 40)** | **1/63** | **2/63** | ### Compiles with a wrapper, left unmarked (seat ruling: no ceiling raise, no surface widening) - SKILL.md § Demo accounts, the `demoStaff` block: wrapped in `defineStack({ demoStaff: [...] })` it compiles (trial run: 346 green). Left unmarked: **23 tokens over the row** (6034 / 6011). - `references/operations.md` § Mobile push, the `push` block: wrapped with an import, `declare const teamId, keyId, projectId` and `defineStack({ push })` it compiles (same trial run). Left unmarked: **35 tokens over the row** (3429 / 3394). A later slice can mark either one if it finds a restatement cut in the same file to pay for it. ### Unmarkable (the record for this slice; no per-file note, per slice 6's ruling) Each block was written alone to its own build dir and type-checked against the built `.d.ts` of `@objectstack/spec`, `@objectstack/core`, `@objectstack/runtime`, `@objectstack/objectql`, `@objectstack/hono`, `@objectstack/metadata` and `@objectstack/driver-memory`. Fragments got a probe-only `declare const ctx: PluginContext` / `kernel: ObjectKernel` wrapper, and project-local imports got a stub. Every block below type-checks that way. The only diagnostics were in the two plugin-development blocks fixed above. - SKILL.md L239 (`@objectstack/hono`), L350 (`onEnable`: calls an app-local helper). - bootstrap.md L38 (two `objects` keys in one literal, showing the array and map forms side by side on purpose), L57, L164, L169 (import project-local modules such as `./src/objects`), L102 (`@objectstack/runtime`). - plugin-development.md: all 12 blocks need `@objectstack/core` (`ObjectKernel`, `LiteKernel`, `Plugin`, `PluginContext`) or a runtime package. `check:skill-examples` resolves `@objectstack/spec` only. ## Why Card objectstack-ai#31112 item 4 puts the published examples under the opt-in check that objectstack-ai#22059 ruling B chose. Slice 6 (PR objectstack-ai#31879) found platform's rules and hooks files unmarkable and said what was left: these 23 blocks, to be probed against core first. That probe also found the one example a reader copies that would not boot. ## Verification - `pnpm --filter @objectstack/spec check:skill-examples` :: exit 0, 344 prose examples across 3 surfaces (343 on `main`). - Reverse check: a planted `bogusKey: 1` in the manifest block → exit 1, `TS2353` at `SKILL.md:111`. Restored, and `git diff` is clean. - Token ratchet: SKILL.md 6011 → 6010 / 6011; bootstrap.md 1342 / 1343 (untouched); operations.md 3388 / 3394 (untouched); plugin-development.md 3125 → 3127 / 3137. No ceiling raised or lowered. - `node scripts/pm/dispatch-gates.mjs --commands --repo objectstack-ai/objectstack` derives 48 commands at head `a8feafb4`. 47 exit 0. `pnpm check:dual-build-cjs-loads` exits 3, PREREQUISITE NOT MET: it needs every package's `dist`, and CI runs it. `dispatch-gates --ran` exit 0: 47 run, 1 NOT-MEASURED, 0 UNRUN. The record is in the project files as `card-31112/s9-gates-a8feafb4.txt`. - `node scripts/check-commit-card-trailers.mjs --range origin/main..HEAD` :: exit 0. - `node scripts/pm/check-governed-merges.mjs --test <3 paths>`: GOVERNED (Tier H). - Contract review: `dispatch-gates --tier` mandates `CONTRACT_REVIEW_TIER` for `skills/**` (clause ①). The maintainer's standing order of 2026-11-03 waives that build tier for card threads. The skills seat runs the contract review of record at that tier. Clause-②: no Metadata-protocol: none ## Human Minimum - [x] 1. Schemas start as Zod; `packages/spec` holds no runtime logic. (not touched) - [x] 2. Every name I added uses the casing for its kind. (no names added) - [x] 3. No formatter ran; `pnpm lint` passes. (no code changed) - [x] 4. One issue, one branch off an up-to-date `main`, one pull request. - [x] 5. A change that publishes carries a changeset, and both declaration lines are filled in here and in the changeset. (`.changeset/31112-platform-example-blocks.md`, `'@objectstack/skills': patch`) - [x] 6. `packages/spec` touched: its generated artifacts are regenerated and committed. (not touched) - [x] 7. No hand edits to `content/docs/references/`, `packages/*/CHANGELOG.md` or `content/docs/releases/`. - [x] 8. Title, body and comments are in English. (the 维护者速读 section is the lane's Chinese summary for the maintainer) - [x] The *Before Submitting* list in CONTRIBUTING.md is done. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01J8VVAjVdoJDiyJ1cmFHyaK Co-authored-by: Claude <noreply@anthropic.com>
Requested by Steedos · project thread
Refs #31112 (slice 6 of a per-skill split: item 4, objectstack-platform's plugin-lifecycle, service-registry and plugin-hooks files; the card stays open)
Clause-②: no
Metadata-protocol: none
维护者速读
rules/service-registry.md里的示例改为真正符合服务契约的调用:数据引擎查询改用db.find('account'),三处实时服务发布改为传入一个带 type/payload/timestamp 的事件对象,API 小节的方法数由“三个”更正为“四个”;三份文件的 40 段 TypeScript 示例仍无一段能接入示例编译检查。@objectstack/core的运行时类型,而检查只能解析@objectstack/spec。skills/objectstack-platform/rules/service-registry.md第 113、126 行,以及第 222、232 行的 ❌/✅ 对照。git diff origin/main -- skills/objectstack-platform/rules/service-registry.md,预期只见这五行改动,且调用与packages/spec/src/contracts/data-engine.ts的find、realtime-service.ts的publish签名一致。What changes
skills/objectstack-platform/rules/service-registry.md, example lines that make a call the service contract refuses, plus one count:objectqlservice is read asIDataEngine(whatgetServicereturns by contract) and then called asdb.object('account').find().IDataEnginedeclares noobjectmember (TS2339). Nowawait db.find('account'), the contract's ownfind(objectName, query?, options?). The annotation stays.realtimeis read asIRealtimeServiceand called aspublish('my-event', data). The contract'spublishtakes oneRealtimeEventPayload(TS2554, expected 1 argument, got 2). Nowawait realtime.publish({ type: 'my-event', payload: data, timestamp: new Date().toISOString() }), which passes the payload's three required keys (type,payload,timestamp;objectis optional) and awaits thePromise<void>the contract returns.realtime.publish('event', data)with two arguments. Both now pass the same one-payload shape as L126. Only the call's arity changes; the pair still teaches the try/catch.No marks are added. None of the 40 column-0
ts/typescriptblocks inrules/plugin-lifecycle.md(9),rules/service-registry.md(15) andreferences/plugin-hooks.md(16) can carry the os:check marker, because every one needs@objectstack/core(the runtimePluginContext,Plugin,ServiceLifecycleor kernel), whichcheck:skill-examplescannot resolve: it compiles against@objectstack/speconly.rules/plugin-lifecycle.mdrules/service-registry.mdreferences/plugin-hooks.mdSkills bundle reading: no
SKILL.mdis touched, so the sum of every publishedSKILL.mddoes not move.Why
#31112 item 4 (ruling B of #22059) puts published examples under the opt-in type check, and the defect it exists to catch is an example teaching a call the contract refuses. These blocks cannot be marked, so the check cannot reach them; they were found by probing each block against
@objectstack/core's real declarations instead.Example fixes
skills/objectstack-platform/rules/service-registry.md:113:db.object('account').find()on anIDataEngine(no such member) →db.find('account').skills/objectstack-platform/rules/service-registry.md:126:realtime.publish('my-event', data)(two arguments) →await realtime.publish({ type, payload, timestamp })(oneRealtimeEventPayload).skills/objectstack-platform/rules/service-registry.md:222and:232:realtime.publish('event', data)(two arguments) →await realtime.publish({ type: 'event', payload: data, timestamp: new Date().toISOString() }).skills/objectstack-platform/rules/service-registry.md:7: "three core methods" → "four core methods" (the block listsregisterService,getService,replaceService,getServices).Tests
Spec-surface probe: 0 of 40 blocks can be marked
Each of the 40 blocks was written to its own file under the kept
.examples-build/tsconfig.json(fromcheck:skill-examples --keeponmainb6fa08e) and asked for syntactic, then semantic, diagnostics through the TypeScript API, so one block's syntax error cannot suppress another's semantic pass.async init(ctx: PluginContext) {/start/destroymethod fragments (TS1434), and the service-registry API signature listing.@objectstack/coreprovides:Cannot find module '@objectstack/core'(TS2307), orctx,kernel,PluginContext,ServiceLifecycleundefined (TS2304). Inplugin-lifecycle.mdtheconst MyPlugin: Pluginblock and inservice-registry.mdthe twoAnalyticsPluginblocks resolvePluginto the DOM lib'sPlugin(the checker header's trap 2).@objectstack/coreis not resolvable frompackages/spec(no workspace dependency), and the spec's ownkernelPluginContextis an unrelated shape (ql,os,logger,storage…) with nohook,trigger,registerServiceorgetService, so a wrapper would have to invent the type it claims to check.Off-gate probe against @objectstack/core: the two fixes, red before and green after
Same harness, with
@objectstack/coremapped to its builtdist/index.d.ts,IDataEngine/ICacheService/IRealtimeServiceimported from@objectstack/spec/contracts, bare method fragments wrapped in a class, andctx,kernelanddatadeclared.mainb6fa08e): Basic Usage →L113 TS2339 Property 'object' does not exist on type 'IDataEngine'; Optional Services →L126 TS2554 Expected 1 arguments, but got 2.realtimefrom an untypedgetService('realtime'), so as written it isunknown(TS18046) and the probe cannot see the arity. The probe copy therefore reads it asgetService<IRealtimeService>('realtime')(the document is unchanged there). Before (738209c):L222 TS2554 Expected 1 arguments, but got 2andL232 TS2554 Expected 1 arguments, but got 2. After (08f5d7c): both blocks report 0 diagnostics.check:skill-examples
pnpm --filter @objectstack/spec check:skill-examplesexits 0 onmainb6fa08e, on f5ca01e and on 08f5d7c, each with✅ 343 prose examples type-check across 3 surface(s). The count does not move because no mark is added. No reverse check applies: there is no newly marked block to plant an error in.Derived gate sweep (head f5ca01e)
node scripts/pm/dispatch-gates.mjs --commands --repo objectstack-ai/objectstackderived 44 commands. 43 exited 0.pnpm check:dual-build-cjs-loadsexited 3 (PREREQUISITE NOT MET: needs every package's dist; CI runs it).dispatch-gates --ranexited 0: 44 derived, 43 run, 1 NOT-MEASURED, 0 unrun.Head 738209c = f5ca01e + a merge of
main3f0e3ac touching noskills/orpackages/spec/path; re-run there, each exit 0:node scripts/check-skills-token-ratchet.mjs,node scripts/check-changeset-no-major.mjs --base origin/main,pnpm check:skill-links,node scripts/check-empty-changeset.mjs --base origin/main. Head 08f5d7c (REWORK after contract review 6736459920, F1 plus the L7 count) re-ran, each exit 0:node scripts/check-skills-token-ratchet.mjs,node scripts/check-changeset-no-major.mjs --base origin/main,node scripts/check-empty-changeset.mjs --base origin/main,pnpm check:skill-links,pnpm check:nul-bytes,pnpm check:doc-authoring,pnpm --filter @objectstack/spec check:skill-examples. PR-body gates on this body, each exit 0:check-changeset-no-major,check-adr-0087-registration,check-closing-keyword-parity,check-partof-closing-keyword.Acceptance notes
check:skill-examplesis not in the derived gate list for askills/**diff, so it was run by hand.@objectstack/spec. Bringing them in would take a surface that resolves@objectstack/core.publishinside the L232tryis logged as "not available"; that is the file's existing shape. L17'sreplaceService(name, instance: any)is left as is.dispatch-gates --tiermandates Fable forskills/**, and the claim records the no-Fable-build exit; the contract review is the seat's, on the lane's isolated reviewer.Verification
git diff origin/main -- skills/objectstack-platform/rules/service-registry.mdshows the five changed lines;node scripts/check-skills-token-ratchet.mjsexits 0;pnpm --filter @objectstack/spec check:skill-examples(needs@objectstack/specand@objectstack/client-reactbuilt) prints 343 examples green.Human Minimum
A governed approver reviews and approves (Tier H).
🤖 Generated with Claude Code
https://claude.ai/code/session_01QsR2jQuso4hiuicJq7WSEz