docs(mcp): diagnoseEmptyRead 的 TSDoc 更正一句被证伪的事实 —— MetadataFacade.getObject 就是 get('object', n) - #6948
Merged
os-project-manager merged 7 commits intoAug 9, 2026
Conversation
…Facade.getObject (#6724) The TSDoc justified its extra miss-path read with two grounds; the factual one was false. SchemaRegistry.getItem special-cases 'object'/'objects' straight back to getObject, so the facade's get('object', n) resolves through the same lookup and the item?.content ?? item unwrap is a no-op (a merged ServiceObject has no content key). Measured: identical object reference on a hit, both undefined on a miss — pinned across all three implementations by PR #6839, and documented on IMetadataService.getObject by PR #6723. Keeps the still-valid ground (no documented equivalence at #6055 time, so presuming one at a consumer is the private dialect PD #12 forbids) and states explicitly that this correction does not decide whether the resolver changes. Comments only, zero behaviour change. Same claim restated in mcp-server-runtime.metadata-outage.test.ts is corrected with it. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017uFVNMmTxLpmfQYiuKM1Yx
…object-tsdoc-correction
… not a live divergence (#6724) Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017uFVNMmTxLpmfQYiuKM1Yx
…object-tsdoc-correction
|
The latest updates on your projects. Learn more about Vercel for GitHub. 1 Skipped Deployment
|
Contributor
📓 Docs Drift CheckThis PR changes 1 package(s): 12 hand-written doc(s) reference the affected code and may need an implementation-accuracy re-verification:
|
…comment (#6724) Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017uFVNMmTxLpmfQYiuKM1Yx
…object-tsdoc-correction
…object-tsdoc-correction
os-project-manager
marked this pull request as ready for review
August 9, 2026 08:13
os-project-manager
deleted the
claude/issue-6724-getobject-tsdoc-correction
branch
August 9, 2026 08:29
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #6724
这张卡改的是什么
packages/mcp/src/mcp-server-runtime.ts里diagnoseEmptyRead的 TSDoc(#6055,由 PR #6051 落地)为一次刻意的设计选择给出了两条理由:不把object_schema的解析器从getObject(name)换成getDiagnosed('object', name),而是在空答案之后再跑一次仅取结论的探针。两条理由里,事实那一条是错的:
同一句话在
mcp-server-runtime.metadata-outage.test.ts里被复述过一次。两处都改了,只改注释,零行为变化。卡片上每一条继承来的事实,都在今天的
main上重新测过mcp-server-runtime.ts:164:162-165(函数体在:187);内容逐字一致...metadata-outage.test.ts:286:285-287那段注释,内容逐字一致SchemaRegistry.getItem特判 object 类型,在registry.ts:1536:1680,分支体在:1682-1684:if (type === 'object' || type === 'objects') { return this.getObject(name) ... }MetadataFacade.get之后跟着item?.content ?? item解包metadata-facade.ts:51-53;getObject在:104-105直接return this.registry.getObject(name)ServiceObject没有content键)还做了一次全仓搜索,确认这句话只有这两处(
does not hold in general/different shape from its own/is NOT `get(),没有第三个落点要另外开 issue。运行时探针(临时,测完即删)
临时 vitest 用例
packages/objectql/src/tmp-6724-probe.test.ts,用registry.registerObject播种一个对象,然后同时问 facade 的两个成员。已删除,不在本 PR 的 diff 里。三件事同时成立,而且是最强的形式:
===,不只是深相等);content,所以item?.content ?? item确实是空操作;undefined。顺带印证了 PR #6723 契约 TSDoc 里的 "runtime-effective object" 说法:回来的键含
nameField/_packageId/_provenance,是物化接缝(registerObject→resolveObject)加上去的。已落地的证据:PR #6839
不重新推导 —— PR #6839(为 #6745,
a8b66ea,已于 01:50Z 合并进main,merge commit7a5ef0008)新增了packages/objectql/src/metadata-service-getobject-equivalence.test.ts,把这条等价关系在三个实现(MetadataManager的注册表命中与 loader 回退两条路径、createMemoryMetadata、MetadataFacade)上钉成了门禁,断言用的是toBe(引用相等)而不是深相等,命中与未命中两条路径都覆盖。更正后的措辞直接引用这个文件,而不是引用我自己的一次性探针。反向验证:这里没有红可制造,也不该造一个
观察类改动,零行为变化。 改的是两段注释,没有任何可执行语句改变,因此:
getObject(n)=get('object', n)across all three IMetadataService implementations #6839 那个文件 —— 哪个实现让这对成员分歧,它会先变红。本 PR 让注释与那道门禁、以及 PR docs(spec): declare whatIMetadataService.getObjectanswers with (#6505) #6723 的契约 TSDoc 三者说同一句话。因此本 PR 交付的验证是:上面的运行时探针 + #6839 的引用 +
packages/mcp的干净门禁。保留了仍然成立的那半条理由
更正不是"所以当初应该换解析器"。原 TSDoc 的另一半是站得住的,原样保留并写得更清楚:
getObject是IMetadataService自己的成员,在 #6055 当时它并没有被文档化的等价关系,在消费端擅自假定一条,正是 Prime Directive #12 禁止的私有方言。所以解析器当初没有被换掉,这个判断本身没有被本次更正推翻。新的措辞额外交代了时间线,免得读者把它读成与契约矛盾:那条等价关系自 PR #6723(#6505)起已经写进
IMetadataService.getObject的 TSDoc,所以"没有文档化"是关于 #6055 那时仓库的事实,不是今天的。⛔ 本 PR 明确不作出下一个判断:那个 miss 路径上的额外读究竟该留还是该换成
getDiagnosed('object', name),是一次独立的取舍(多一次未命中读 vs. 换一个解析器),由接手的人按其自身利弊去做。更正记录与作出决定是两件事,这里只做前一件 —— 正文里也是这么写的。同一段末尾那条 "on a host that implements
getDiagnosedand agetObjectresolving somewhere else" 的残余风险项没有删,但补了一句:自 PR #6723 起契约已经用声明排除了这种宿主,所以它读作"针对一次契约违反的残余风险",而不是"今天真有这么一个实现"。门禁(真实输出)
pnpm --filter @objectstack/mcp typecheck→tsc --noEmit,无输出pnpm --filter @objectstack/mcp test --maxWorkers=2→Test Files 10 passed (10)/Tests 114 passed (114)(合并origin/main之后重跑过一遍,数字不变 —— 本 PR 不增删用例)pnpm lint→ 无输出check:nul-bytes→OK (scanned 6440 tracked text file(s); … no raw ASCII control bytes)check:empty-changeset→✓ No empty-frontmatter changeset introduced by this diff (1 declaring changeset(s) added)check:slot-lookup/check:route-envelope/check:error-code-casing/check:engine-double-contract/check:doc-authoring/check:published-files/check:release-notes/check:release-body→ 全部 PASSchangeset
patch,@objectstack/mcp。TSDoc 会随包一起发布进.d.ts,一句被证伪的事实是消费者看得见的东西,所以按卡片要求写了 changeset(非空 frontmatter),没有走skip-changeset。刻意没做
packages/spec的契约 TSDoc:那半边由 PR docs(spec): declare whatIMetadataService.getObjectanswers with (#6505) #6723 负责,IMetadataService.getObject has no declared relationship to get('object', name), and its two implementations disagree #6505 的裁定把范围划在那里。objectql的任何实现或测试:等价关系的门禁由 PR test(objectql): pingetObject(n)=get('object', n)across all three IMetadataService implementations #6839 承担,本 PR 只引用它。Refs #6505, #6055, #6745, PR #6051, PR #6723, PR #6839.
🤖 Generated with Claude Code
https://claude.ai/code/session_017uFVNMmTxLpmfQYiuKM1Yx
Generated by Claude Code