Skip to content

docs(skills): service-registry examples call the contracts they annotate - #31879

Merged
os-zhuang merged 3 commits into
mainfrom
claude/project-thread-tn1n85
Nov 9, 2026
Merged

os-zhuang merged 3 commits into
mainfrom
claude/project-thread-tn1n85

Conversation

@objectstack-fleet

@objectstack-fleet objectstack-fleet Bot commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

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

维护者速读

  • 改了什么:objectstack-platform 技能包 rules/service-registry.md 里的示例改为真正符合服务契约的调用:数据引擎查询改用 db.find('account'),三处实时服务发布改为传入一个带 type/payload/timestamp 的事件对象,API 小节的方法数由“三个”更正为“四个”;三份文件的 40 段 TypeScript 示例仍无一段能接入示例编译检查。
  • 为什么改:这些示例调用了契约里没有或签名不符的方法,AI 照抄后编译即报错;接不进检查的原因是这 40 段全部依赖 @objectstack/core 的运行时类型,而检查只能解析 @objectstack/spec。
  • 风险与回滚:只改发布技能包里的五行文字,不动任何运行时代码,token 用量 1764 → 1808(上限 2331,未抬)。回滚即 revert 本 PR。
  • 先看: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 签名一致。
  • 需要你做的:作为受管面审批人审阅并批准本 PR(skills/** 属 Tier H)。

What changes

skills/objectstack-platform/rules/service-registry.md, example lines that make a call the service contract refuses, plus one count:

  • L113, Basic Usage: the objectql service is read as IDataEngine (what getService returns by contract) and then called as db.object('account').find(). IDataEngine declares no object member (TS2339). Now await db.find('account'), the contract's own find(objectName, query?, options?). The annotation stays.
  • L126, Optional Services: realtime is read as IRealtimeService and called as publish('my-event', data). The contract's publish takes one RealtimeEventPayload (TS2554, expected 1 argument, got 2). Now await realtime.publish({ type: 'my-event', payload: data, timestamp: new Date().toISOString() }), which passes the payload's three required keys (type, payload, timestamp; object is optional) and awaits the Promise<void> the contract returns.
  • L222 and L232, the "No Error Handling for Optional Service" ❌/✅ pair: both halves called 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.
  • L7: "three core methods" → "four core methods", the number the block below it lists.

No marks are added. None of the 40 column-0 ts/typescript blocks in rules/plugin-lifecycle.md (9), rules/service-registry.md (15) and references/plugin-hooks.md (16) can carry the os:check marker, because every one needs @objectstack/core (the runtime PluginContext, Plugin, ServiceLifecycle or kernel), which check:skill-examples cannot resolve: it compiles against @objectstack/spec only.

File marked before → after / blocks tokens before → after / ceiling lines before → after
rules/plugin-lifecycle.md 0 → 0 / 9 1787 (untouched) / 2408 262 (untouched)
rules/service-registry.md 0 → 0 / 15 1764 → 1808 / 2331 260 → 260
references/plugin-hooks.md 0 → 0 / 16 2413 (untouched) / 2628 290 (untouched)

Skills bundle reading: no SKILL.md is touched, so the sum of every published SKILL.md does 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 an IDataEngine (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 }) (one RealtimeEventPayload).
  • skills/objectstack-platform/rules/service-registry.md:222 and :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 lists registerService, 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 (from check:skill-examples --keep on main b6fa08e) and asked for syntactic, then semantic, diagnostics through the TypeScript API, so one block's syntax error cannot suppress another's semantic pass.

  • 22 blocks do not parse at top level: bare async init(ctx: PluginContext) { / start / destroy method fragments (TS1434), and the service-registry API signature listing.
  • The other 18 fail on names only @objectstack/core provides: Cannot find module '@objectstack/core' (TS2307), or ctx, kernel, PluginContext, ServiceLifecycle undefined (TS2304). In plugin-lifecycle.md the const MyPlugin: Plugin block and in service-registry.md the two AnalyticsPlugin blocks resolve Plugin to the DOM lib's Plugin (the checker header's trap 2).
  • @objectstack/core is not resolvable from packages/spec (no workspace dependency), and the spec's own kernel PluginContext is an unrelated shape (ql, os, logger, storage …) with no hook, trigger, registerService or getService, 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/core mapped to its built dist/index.d.ts, IDataEngine / ICacheService / IRealtimeService imported from @objectstack/spec/contracts, bare method fragments wrapped in a class, and ctx, kernel and data declared.

  • Before (main b6fa08e): Basic Usage → L113 TS2339 Property 'object' does not exist on type 'IDataEngine'; Optional Services → L126 TS2554 Expected 1 arguments, but got 2.
  • After (commit f5ca01e): both blocks report 0 diagnostics, with no diagnostic code filtered.
  • The L222/L232 pair reads realtime from an untyped getService('realtime'), so as written it is unknown (TS18046) and the probe cannot see the arity. The probe copy therefore reads it as getService<IRealtimeService>('realtime') (the document is unchanged there). Before (738209c): L222 TS2554 Expected 1 arguments, but got 2 and L232 TS2554 Expected 1 arguments, but got 2. After (08f5d7c): both blocks report 0 diagnostics.
check:skill-examples

pnpm --filter @objectstack/spec check:skill-examples exits 0 on main b6fa08e, 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/objectstack derived 44 commands. 43 exited 0. pnpm check:dual-build-cjs-loads exited 3 (PREREQUISITE NOT MET: needs every package's dist; CI runs it). dispatch-gates --ran exited 0: 44 derived, 43 run, 1 NOT-MEASURED, 0 unrun.

Head 738209c = f5ca01e + a merge of main 3f0e3ac touching no skills/ or packages/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-examples is not in the derived gate list for a skills/** diff, so it was run by hand.
  • Observation, not filed: the platform skill's plugin examples sit outside the checker's reach as long as it compiles prose only against @objectstack/spec. Bringing them in would take a surface that resolves @objectstack/core.
  • Accepted as is per the contract review (F2): a rejected publish inside the L232 try is logged as "not available"; that is the file's existing shape. L17's replaceService(name, instance: any) is left as is.
  • No ceiling was raised or lowered; the ratchet printed no lowering instruction.
  • This build ran on the default tier: dispatch-gates --tier mandates Fable for skills/**, 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.md shows the five changed lines; node scripts/check-skills-token-ratchet.mjs exits 0; pnpm --filter @objectstack/spec check:skill-examples (needs @objectstack/spec and @objectstack/client-react built) prints 343 examples green.

Human Minimum

A governed approver reviews and approves (Tier H).

🤖 Generated with Claude Code

https://claude.ai/code/session_01QsR2jQuso4hiuicJq7WSEz

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

Copy link
Copy Markdown
Contributor Author

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 CONTRACT_REVIEW_TIER review (maintainer 2026-11-08 16:12Z 「有 fable 车道就可以契约复审啊」); the director seat is off duty.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

domain:skills#3 · zhuangjianguo · session_01QsR2jULfPnqQFGcZUtKDFH

Contract review

Served-tier: CONTRACT_REVIEW_TIER
Head-sha: 738209c256c8bee944f0929fc4094831f2541ca4
Local-runs: none
Scope: skills/objectstack-platform/rules/service-registry.md + none

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 main at 3f0e3ac (2 files: the rules file, 2 lines changed; one new changeset), the check-runs on the head, and in the live tree packages/spec/src/contracts/data-engine.ts, realtime-service.ts, cache-service.ts, objectql-engine.ts, packages/core/src/types.ts, packages/objectql/src/plugin.ts and engine.ts, packages/services/service-realtime/src/realtime-service-plugin.ts and in-memory-realtime-adapter.ts, packages/spec/scripts/check-skill-examples.ts, packages/spec/package.json, scripts/check-skills-token-ratchet.mjs, skills/objectstack-platform/references/plugin-development.md, skills/objectstack-platform/evals/config-plugins-ops.json, and the three platform files on main. Code outside the diff was read, not reviewed.

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). Type Check · consumer gates (the lint.yml job typecheck-consumers, which runs pnpm --filter @objectstack/spec run check:skill-examples) has concluded: success. Still in progress at the last read: Test Core (1/8) and (2/8), which this prose-only diff cannot move.

① Derived judgments

  • No accept-set change: the diff touches no schema, no zod, no runtime code, no gate. Right.
  • Public surface moved: the published skill bundle @objectstack/skills (packages/skills) ships a changed rules/service-registry.md, two example lines. Right, and the changeset names it.
  • Basic Usage, L113: db is annotated IDataEngine and now calls db.find('account'). IDataEngine.find(objectName: string, query?: EngineQueryOptions, options?: BaseEngineOptions): Promise of any[] (data-engine.ts:401); the result then feeds cache.set('accounts', result), and ICacheService.set of T(key: string, value: T, ttl?: number) (cache-service.ts:43) takes it. The concrete service behind the objectql key is ObjectQLPlugin's this.ql (plugin.ts:852), class ObjectQL implements IObjectQLEngine (engine.ts:451), and IObjectQLEngine extends IDataEngine (objectql-engine.ts:298), so find('account') is true against the annotation and against the runtime. The old db.object('account').find() compiled only against the concrete class (ObjectQL.object(name): ObjectRepository, engine.ts:10274) and never against the annotated contract (TS2339); the sibling reference plugin-development.md:103 uses the same IDataEngine annotation, so the file now agrees with it. Right.
  • Optional Services, L126: realtime is annotated IRealtimeService; publish(event: RealtimeEventPayload): Promise of void (realtime-service.ts:100), and RealtimeEventPayload requires type: string, payload: Record of string to unknown, timestamp: string (ISO 8601) with object? optional (realtime-service.ts:19-28). The new call passes exactly the three required keys and awaits the promise. The runtime realtime key is registered by realtime-service-plugin.ts:77 with InMemoryRealtimeAdapter implements IRealtimeService (in-memory-realtime-adapter.ts:75), so the shape is true against the runtime too. data is a free name in the block before and after, as in every other block of the file. Right.
  • Teaching unchanged beyond truth: Basic Usage still teaches "resolve services in start() and use them"; Optional Services still teaches "try getService, degrade in catch". Neither fix adds a rule, removes one, or changes the ❌/✅ contrast. Right.
  • The 0/40 finding holds. On main the three files carry 9 + 15 + 16 = 40 column-0 ts/typescript fences and no os:check marker. Every one of them either names ctx, PluginContext, Plugin, kernel, ServiceLifecycle or LiteKernel from @objectstack/core, or is a bare method fragment (plugin-lifecycle.md L156 async destroy() on this, TS1434 at top level). The skills surface of check-skill-examples.ts compiles under resolutionDir: SPEC_DIR with selfPackages: [SPEC_DIR] (L558-563); packages/spec/package.json depends on zod and pg-connection-string only, so @objectstack/core does not resolve (TS2307); spec's own PluginContext (packages/spec/src/kernel/plugin.zod.ts:55, an alias of PluginContextData) is a different shape with no hook, getService or registerService. No wrapper of a few lines can mark any of them. Right.
  • Token ratchet: the CEILINGS row for the file is 2331 (check-skills-token-ratchet.mjs:918) and the diff does not touch it; the dev reports 1764 to 1777. The ratchet step (lint.yml node scripts/check-skills-token-ratchet.mjs) sits in a concluded green job. Right.
  • check:skill-examples count: no block gains a mark, so 343 before and after; the reverse check is not owed. Right.
  • Skill links: check-skill-links.mjs:417 pins this file's moved-registry anchors; the diff changes no link. Right.
  • PR body and dev report account: both match the tree (two lines, no mark, changeset only). Judged from the tree, not the account.

② Semver level

.changeset/31112-platform-service-registry-examples.md: '@objectstack/skills': patch, with Clause-②: no and Metadata-protocol: none on both the changeset and the PR body. The diff publishes a prose correction inside a published skill file and nothing else, so patch is the level, exactly as the card's Acceptance section fixes it for every slice and as slices 1 to 5 wrote it. The changeset body's claims (two examples, which contracts, 0 of 40 marked before and after, why) each check against the tree. Right.

Clause-②: no — right. The diff narrows no declared capability and declares no new one; plain no, not no (narrowing).

③ Boundary flags

Dev-report deviations:

  • "check:skill-examples is not in the derived list; run by hand" — answered: CI runs it in Type Check · consumer gates (lint.yml typecheck-consumers), which concluded success on this head.
  • "seat ruling (thread, 08:53Z): no fragment/core note lines; file surface narrowed to service-registry.md plus one changeset" — answered: the diff matches the ruling (one rules file, one changeset, no note lines added, plugin-lifecycle.md and plugin-hooks.md untouched).
  • "no ceiling raised or lowered" — answered: the CEILINGS map is not in the diff.
  • "default tier, no Fable build" — answered: this record is the CONTRACT_REVIEW_TIER review the claim amendment 6724423900 promised in its place.

Dev-report out_of_scope_findings:

  • "service-registry.md L222 and L232 (the optional-service pair) also call realtime.publish('event', data) with two arguments · carrier: seat" — escalated, not accepted as out of scope: see F1 below.
  • "platform plugin examples stay outside check:skill-examples while it resolves only @objectstack/spec · carrier: none" — answered: agreed and not for this PR. The checker's own header (check-skill-examples.ts L386-413) says a page needing something neither surface carries is a new surface question, and spec depending on core would invert the direction the surface models. A follow-up card, if the seat wants one; not a flag on this head.

open_questions: none in the report. No ruling on the card is contradicted by the diff.

④ Design judgment

skills/objectstack-platform/rules/service-registry.md against the card's eval set (config-plugins-ops.json, eval 1 expects a plugin whose init(ctx) calls ctx.registerService('audit', ...) and ctx.hook(...); no eval asserts on the two changed lines) and against the contracts it teaches on main:

  • Both changed lines hold against the cited code, sentence by sentence (section ① above). Tried to break them: find('account') with no query is allowed (query?); set takes any value type; publish refuses a missing timestamp or payload, and the new literal supplies both; object is optional and omitted; await on a Promise of void is well typed. Nothing breaks.

  • F1 · should-fix · L222 and L232 (the "No Error Handling for Optional Service" ❌/✅ pair). Both halves still call realtime.publish('event', data) with two arguments: the same method on the same realtime service whose call shape L126 corrects, one hundred lines below it in the same file. Against the contract and the runtime (InMemoryRealtimeAdapter implements IRealtimeService) that call is refused. The pair's lesson is try/catch around getService, not the publish shape, so correcting the arity to the one-argument payload blunts nothing; left as is, the file teaches two shapes for one call, and the ✅ half is the one an agent copies. getService('realtime') with no type argument infers T as unknown, so the block would not compile either way, but the teaching is what is read. The pair sits inside the claim's file surface, the ratchet has 554 tokens of headroom, and the PR exists to make this file's examples call the contracts they annotate. A fix moves the head and earns a delta review; it does not change what any rule teaches.

  • F2 · nit · L126 adds await inside the try whose catch logs "Realtime service not available — skipping", so a rejected publish is now reported as unavailability. The contract returns a promise, so awaiting it is right and the un-awaited call was a floating promise; the misattribution is the pre-existing shape of the pattern (the ✅ half at L229-236 scopes its try the same way) and has no effect on the contract. Accepted deviation, or folded into F1's edit if the seat wants the publish outside the try.

  • Observation, pre-existing, outside the hunks, not graded for this PR: L7 says the context "provides three core methods" and the block below lists four; replaceService in packages/core/src/types.ts:48 is replaceService of T(name, implementation: T) where L17 writes instance: any. For a later edit of this file.

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: claude/project-thread-tn1n85
Reviewed-by: session_01QsR2jULfPnqQFGcZUtKDFH

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

Copy link
Copy Markdown
Contributor Author

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 CONTRACT_REVIEW_TIER review (maintainer 2026-11-08 16:12Z 「有 fable 车道就可以契约复审啊」); the director seat is off duty.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

domain:skills#3 · zhuangjianguo · session_01QsR2jULfPnqQFGcZUtKDFH

Contract review

Served-tier: CONTRACT_REVIEW_TIER
Head-sha: 08f5d7cbbe698b735d2a3c5fe046eaab76e254ed
Local-runs: none
Scope: skills/objectstack-platform/rules/service-registry.md + none

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): skills/objectstack-platform/rules/service-registry.md L7, L222 and L232, and the changeset's summary line and body. This record judges that delta in full and carries every other judgment of 6736459920 forward by reference; none of them is touched by the delta, since no other line of the rules file, no other file, and no gate or cited contract moved. The net diff against main (merge-base 3f0e3ac) is still 2 files: the rules file (now 5 lines changed) and the one new changeset.

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 main packages/spec/src/contracts/realtime-service.ts (IRealtimeService L95-100, RealtimeEventPayload L19-28), packages/core/src/types.ts (PluginContext L16-59), scripts/check-skills-token-ratchet.mjs (CEILINGS L986) and .github/workflows/lint.yml (L5433-5439, the ratchet step inside typecheck-source-gates). Code outside the diff was read, not reviewed.

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). Type Check · consumer gates (the lint.yml job typecheck-consumers, which runs check:skill-examples) has concluded: success. Type Check · source gates, which carries the published-skills token ratchet step, is success, so the ratchet accepts the file at this head. Still in progress at the last read: Lint · docs & code guards, Lint · repo & tooling gates, Test Core (1/8) and (2/8), which this prose-only delta cannot move (no test pins the changed lines, ① below).

① Derived judgments

  • No accept-set change: the delta touches prose and example lines in one rules file and the changeset text; no schema, no zod, no runtime code, no gate. Right.
  • Public surface moved: @objectstack/skills ships a changed rules/service-registry.md, now five lines against main (L7, L113, L126, L222, L232). Right, and the changeset names the file and each change.
  • F1 fix, L222 and L232 (the "No Error Handling for Optional Service" ❌/✅ pair): both halves now read await realtime.publish({ type: 'event', payload: data, timestamp: new Date().toISOString() }). Against the contract, IRealtimeService.publish(event: RealtimeEventPayload): Promise of void (realtime-service.ts:100) and RealtimeEventPayload requiring type: string, payload: Record of string to unknown, timestamp: string with object? optional (realtime-service.ts:19-28): one argument, the three required keys present, the optional one omitted, the promise awaited inside an async start. It is the same one-payload shape as the reviewed L126 fix, differing only in the event name ('event', the pair's pre-existing literal, against L126's 'my-event'). Only the arity of the call changes: the ❌ half still shows an unguarded getService and the ✅ half still wraps it in try/catch, the comments on both halves are untouched. Right.
  • L7: "The PluginContext provides four core methods" now matches the block below it, which lists registerService, getService, replaceService and getServices. All four exist on PluginContext in packages/core/src/types.ts (L22, L37, L48, L59); the interface also carries registerServiceFactory (L29, taught under Factory Registration through kernel.registerServiceFactory) and getServiceScoped (L54), so "four" counts the block, as ordered, not the whole interface. Right.
  • Teaching unchanged beyond truth: the pair's lesson is still try/catch around an optional service; the API section still introduces the same four signatures. No rule added, removed or inverted. Right.
  • Lane trap checked: no test under packages/** or scripts/** pins skills/objectstack-platform, "three core methods" or the pair's publish lines (git grep on main), so the delta can turn no test red. Nothing is cut in the delta, so nothing is payable as a trim. Right.
  • Token ratchet: the CEILINGS row for the file stays 2331 (check-skills-token-ratchet.mjs:986) and is not in the diff; the dev reports 1764 to 1808. Not re-measured here; the ratchet step sits in Type Check · source gates, success on this head. Right.
  • check:skill-examples count: the delta adds no fence and no os:check marker, so 15 blocks in the file and 0 of 40 marked across the three platform files hold exactly as judged in 6736459920. Right.
  • Skill links: the delta changes no link or anchor. Right.
  • PR body v2 and rework report against the tree: the body's 维护者速读 says five lines, three realtime publish sites and a three-to-four count, and its What changes and Example fixes list L7, L113, L126, L222, L232, which is the tree; the rework report's example_fixes and files_changed match the tree too. One stale sentence remains in the body, F3 below. Judged from the tree, not the account.

② Semver level

.changeset/31112-platform-service-registry-examples.md: '@objectstack/skills': patch, Clause-②: no, Metadata-protocol: none, unchanged in level. The delta rewrites the summary line ("examples now call the service contracts they use") and adds two sentences: the ❌/✅ pair "made the same two-argument publish call and now passes the same one-payload shape; the pair still teaches the try/catch", and "The API section's intro now counts the four methods its block lists". Both sentences check against the tree; the earlier claims (two typed examples, which contracts, 0 of 40 marked before and after, why) were verified in 6736459920 and are unchanged. A prose correction inside a published skill file is a patch, as the card's Acceptance fixes it for every slice. Right.

Clause-②: no — right. The delta narrows no declared capability and declares no new one; plain no, not no (narrowing).

③ Boundary flags

Rework report 6736563359 deviations:

  • "check:skill-examples is not in the derived list; run by hand" — answered: CI runs it in Type Check · consumer gates, which concluded success on this head.
  • "F2 and L17 replaceService(instance: any) left as is per the seat" — answered: both are pre-existing shapes 6736459920 graded nit or left ungraded, and the seat accepted them; neither is in the delta.
  • "PR body v2 is at a project-files path for the seat to apply (os-dev may not PATCH it)" — answered: the PR body read on 08f5d7c is the v2 body (it names L222, L232 and L7); the replacement happened.
  • "no ceiling raised or lowered; default tier, no Fable build" — answered: the CEILINGS map is not in the diff; this record is the CONTRACT_REVIEW_TIER review the claim promised.

out_of_scope_findings: "platform plugin examples stay outside check:skill-examples while it resolves only @objectstack/spec · carrier: none" — answered in 6736459920 (agreed, not for this PR; a follow-up card if the seat wants one). Unchanged.

open_questions: none in the report. The previous record's F1 is resolved by the delta and its L7 observation is resolved by the delta; no ruling on the card is contradicted.

④ Design judgment

skills/objectstack-platform/rules/service-registry.md, the delta lines, against the contract they teach on main and the scenario the pair is accepted against (an agent copying the ✅ half to call an optional service):

  • F1 resolved · L222 and L232. The call now holds against IRealtimeService.publish and RealtimeEventPayload sentence by sentence (① above). Tried to break it: publish refuses a missing timestamp or payload, and the literal supplies both; object is optional and omitted; the promise is awaited in an async method; the file now teaches one shape for publish at all three sites (L126, L222, L232), so the ✅ half an agent copies is the true one. Carried from 6736459920 and unchanged: getService('realtime') with no type argument infers T as unknown, so as written the block would not compile either way (TS18046); the pre-existing untyped getService is the file's shape in four other blocks (L139, L192, L206, L257), is not what the pair teaches, and is not graded.
  • L7 resolved. "four core methods" is the number the block lists; nothing else on the line moved.
  • F2 · nit · carried as accepted. L232's await sits inside the try whose catch logs "Realtime service not available", so a rejected publish is reported as unavailability; the same pre-existing shape as L126, accepted by the seat on 738209c. No effect on the contract.
  • F3 · nit · PR body only, not the tree. The body's Verification section still says git diff origin/main -- skills/objectstack-platform/rules/service-registry.md "shows the two lines", while the same body's 维护者速读 and What changes say five, and the tree has five. A reader running the two-minute check sees five hunks and a sentence that promises two. Prose face: a body edit does not move the head and this record still covers it. Accepted deviation if the seat prefers; no effect on correctness or the contract.

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: claude/project-thread-tn1n85
Reviewed-by: session_01QsR2jULfPnqQFGcZUtKDFH

VERDICT: PASS

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

domain:skills#3 · zhuangjianguo · session_01QsR2jULfPnqQFGcZUtKDFH

维护者速读

  • 改了什么:objectstack-platform 技能 rules/service-registry.md 里有五行示例调用了服务契约里没有的方法,或参数个数不对,现已改正。数据引擎查询改为 db.find('account');三处实时服务发布改为传入一个带 type/payload/timestamp 的事件对象;API 小节的方法数由“三个”改为“四个”。
  • 为什么改:AI 照抄这些示例会写出编译不过的插件代码。这三份文件的 40 段示例本该接入示例编译检查(skills: one home per rule — the same rule written in three skills, "moved verbatim" stubs in data and upgrade SKILL.md, an undocumented user-invocable frontmatter key, and <!-- os:check --> coverage of 1/63 (platform) and 0/42 (query) example blocks #31112 第 4 项),但全部依赖 @objectstack/core 的运行时类型,而检查只能解析 @objectstack/spec,所以一段都接不进。这几处错误是对照 core 的真实类型逐段探测出来的。
  • 风险与回滚:只改技能文档,不动运行时,token 1764 → 1808(上限 2331,未抬)。每处改动只让调用符合契约,规则教的写法不变。回滚即 revert 本 PR。
  • 先看:skills/objectstack-platform/rules/service-registry.md 第 113、126 行,以及第 222、232 行的 ❌/✅ 对照。
  • 两分钟验证:对照 packages/spec/src/contracts/data-engine.ts 的 find 和 realtime-service.ts 的 publish(event: RealtimeEventPayload),五行调用都与签名一致。
  • 需要你做的:批准本 PR(Approve review)。契约复审 PASS 记录是评论 6736459920(全量)和 6736676545(增量,修复 F1),Head-sha 08f5d7cbbe698b735d2a3c5fe046eaab76e254ed。批准后由席位落地。
  • 席位意见:ACCEPT。席位读了 diff:IDataEngine.find、IRealtimeService.publish 与 RealtimeEventPayload 的三个必填键都对得上;运行时的 objectql 与 realtime 服务也实现了这两个契约。本 head 上的检查全部通过。

席位核对

Head-sha: 08f5d7cbbe698b735d2a3c5fe046eaab76e254ed

  1. Shape: draft, base main, body Refs #31112 (slice 6 of a per-skill split; the card stays open), Clause-②: no, Metadata-protocol: none, changeset '@objectstack/skills': patch. 2 files, +15/−5. Tier H (skills/**).
  2. Premise measured: the slice-5 release note 6735715711 counted platform at 1/63 on main b6fa08e. The dev's isolated probe shows the three claimed files' 40 column-0 ts blocks cannot be marked: 22 do not parse at top level, and 18 need @objectstack/core names. The checker compiles prose against @objectstack/spec alone, and spec's own kernel PluginContext is an unrelated shape. The review confirmed the 0/40. A probe against core's real declarations was red before the fix (L113 TS2339, L126 TS2554, and with the result typed, L222 and L232 TS2554) and green after.
  3. Gates: dev gates 44 derived, 43 exit 0; dual-build-cjs-loads exit 3 (needs a full build; no build input touched). check:skill-examples 343 → 343 exit 0, since no mark is added. Token ratchet exit 0 (service-registry 1808/2331). Check-runs on this head at ACCEPT: 32 success, 19 skipped, 0 failure, 0 running.
  4. Accepted deviations: seat ruling 2026-11-09T08:56Z on the 0/40 reading: no note lines, and the two wrong examples are fixed instead. The surface narrowed from three files to service-registry.md plus the changeset. Review F2 (nit), accepted as is: L232's await inside the try logs a rejected publish as "not available", the file's existing shape. Left as is: L17's replaceService(name, instance: any), where core's signature is generic. Delta F3 (body prose, "shows the two lines") was corrected in the body by the seat. Model: opus build under the standing no-Fable-build rule, Fable review (claim 6735852486).
  5. Out of scope / Skills-docs: the platform skill's plugin examples cannot be checked until the checker gets a surface that resolves @objectstack/core. That is a tooling question for a follow-up card, not this PR. The other 23 platform blocks (SKILL.md, bootstrap, operations, plugin-development) are still unmeasured. Metadata-protocol: none, so no Skills-docs: line is owed.
  6. Landing: Tier H. pm:awaiting-merge + reviewers os-zhuang, hotlong; stays draft until an authorized approval or a maintainer merge. K = 4 first-parent merges since merge-base 3f0e3ace; none touches skills/objectstack-platform/, and the merge with main is clean. Refs, not Fixes: after the merge the seat releases the card to pm:queue with the remaining counts.

@objectstack-fleet objectstack-fleet Bot added the pm:awaiting-merge PR only: landing waits on the maintainer's own review and merge (SKILL.md 复核 ②); never on an issue label Nov 9, 2026
@os-zhuang
os-zhuang marked this pull request as ready for review November 9, 2026 12:10
@os-zhuang
os-zhuang added this pull request to the merge queue Nov 9, 2026
Merged via the queue into main with commit 45f5712 Nov 9, 2026
57 checks passed
@os-zhuang
os-zhuang deleted the claude/project-thread-tn1n85 branch November 9, 2026 12:40
@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 9, 2026
rajeev-kumar-se pushed a commit to rajeev-kumar-se/objectstack that referenced this pull request Nov 10, 2026
…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>
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/s 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.

2 participants