docs(spec): ISharingService 模块头按 ADR-0111 D3 拆出 canDelete() 门 - #6066
Merged
Conversation
模块头的 "Per-record gating" 一条写于 D3 拆分之前,仍称 `canEdit()` 回答 `update` / `delete`,与同文件 140 行之下的 `canDelete()` 文档 直接矛盾 —— D3 的动词边界是:share 只放宽可及的行,不放宽可用的动词, delete = ownership(写 DEPTH 放宽)或 `modifyAllRecords` 旁路,`edit` share 不授予。模块头是跨包调用方进文件读到的第一段,照它做会把 `edit` share 当成删除授权,或以为 `canDelete` 不存在。 改为一条两门:`canEdit()` 管 `update`,`canDelete()` 管 `delete` 且 显式更窄,措辞与下方两个方法文档对齐。纯注释,无 schema/类型/行为变化。 同文件已有 #5125 / #5858 的散文钉先例,补一枚同款轻量钉:读文件级 leading comment(而非 interface 成员文档),断言模块头点名 `canDelete()`,且 `canEdit()` 那一段不再声称 `delete` 动词;两条 反空断言防止改写把断言掏空。 Fixes #5817 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011M7UwH25Unfi73UHim7ajY
|
The latest updates on your projects. Learn more about Vercel for GitHub. 1 Skipped Deployment
|
Contributor
📓 Docs Drift CheckThis PR changes 1 package(s): 112 hand-written doc(s) reference the affected code and may need an implementation-accuracy re-verification:
|
test.yml 的 rerun attempt 落在 GitHub 平台 20:01Z 冻结窗口内,卡在预排队 limbo:409 不可取消、零 job 实例化。调度层已恢复但只对新触发生效,故用空提交 换 head 重新调度。 无任何文件改动(--allow-empty),不含 merge / rebase。 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011M7UwH25Unfi73UHim7ajY
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 #5817
问题
packages/spec/src/contracts/sharing-service.ts的模块头第 2 条("Per-record gating")写于 ADR-0111 D3 拆分之前,仍然说:这与同一文件 140 行之下的
canDelete()方法文档直接矛盾。D3 定下的动词边界是:share 只放宽一个主体够得着的"行",从不放宽它能用的"动词" —— 所以 delete 只有 ownership(写 DEPTH 放宽)或modifyAllRecords超级用户旁路两条路,editshare 不授予删除权(Salesforce 的 Read/Write 不能删,Dataverse 的Delete是独立权限,Odoo 把write/unlink分开)。实现侧也是两道门:plugin-sharing 的canEdit/canDelete,后者根本没有 share 分支。为什么值得改:模块头是跨包调用方进这个文件读到的第一段。照它做,要么把
editshare 当成删除授权(D3 明确拒绝的语义),要么根本不知道存在canDelete。错的散文比沉默更糟 —— 它看上去权威。改法
把第 2 条拆成两道门,措辞与下方
canEdit()/canDelete()两个方法文档对齐:canEdit()管update(ownership /editshare /modifyAllRecords旁路),canDelete()管delete且显式更窄并点名 ADR-0111 D3。纯注释改动,零 schema / 类型 / 行为变化。
范围严格限定在模块头这一处:未碰 #5973(#5858)新落的
HierarchyScopeContext/resolveOwnerIds段,未碰 #5125 已修的canEdit方法 doc,未顺手改其它散文。钉子
同文件已有 #5125 / #5858 的 AST 散文钉先例,补一枚同款轻量钉(加在既有
sharing-service.test.ts里,不新建文件)。与前两枚不同的是,它钉的是文件级 leading comment 而非 interface 成员文档,所以走ts.getLeadingCommentRanges(text, 0)、用模块路径行认出模块头。两条断言 + 两条反空(anti-vacuity)守卫:
canDelete()。canEdit()到canDelete()之间那一段不得再出现delete动词(两个下标按序解析,切片不会为空 —— 排除"空切片假绿")。delete仍在模块头里(只是改挂到canDelete()名下),所以负钉不是靠"这个词整体消失"而通过的。反向验证(方向为预期的"红"):把 D3 之前那句话原样放回去,新钉子变红,报错落在
canDelete()那条正钉上,同文件其余 6 条既有测试全绿 —— 既证明钉子真的咬住了这处漂移,也证明既有的钉子覆盖不到它。验证
pnpm --filter @objectstack/spec check:generated— 10/10 全部 up to date,零生成物漂移(如预期:模块头不进content/docs/references/)。pnpm --filter @objectstack/spec typecheck— 通过(tsc --noEmit+check:test-typecheck,debt 账本未增长)。pnpm --filter @objectstack/spec test— 全量见 CI;定向跑src/contracts/sharing-service.test.ts:7 passed。node scripts/check-nul-bytes.mjs— OK;两个改动文件另做了越过该 gate 盲区的控制字符自查,零命中。Changeset
建议
skip-changeset:comment-only + test-only,不发布任何东西,不产生 user-visible 变更。Generated by Claude Code