Skip to content

spec 契约文档漂移:ISharingService 模块头仍称 canEdit() 回答 update/delete,ADR-0111 D3 已把 delete 拆给 canDelete() #5817

Description

@baozhoutao

packages/spec/src/contracts/sharing-service.ts 顶部的模块头文档(第 15-17 行,origin/main @ 5ab0842)写:

  1. Per-record gating — canEdit() answers the access question for update / delete operations. Returns true when the caller may modify the record, false otherwise.

但同一文件第 139-161 行的 canDelete()(ADR-0111 D3)说的正好相反 —— delete 是一道故意比 canEdit 窄的独立门:

The verb boundary: a share widens which rows a principal reaches, never which verbs they may use — so delete is ownership (widened by write DEPTH) or the modifyAllRecords super-user bypass ONLY, and an edit share does NOT confer it

实现侧同样是两道门(packages/plugins/plugin-sharing/src/sharing-service.ts:canEdit 在 366 行、canDelete 在 424 行,后者不含 share 分支)。所以模块头是 ADR-0111 D3 拆分 canDelete 之前的遗留文字,今天与它下面 20 行的方法文档直接矛盾。

影响:这个模块头正是跨包调用方进文件后读到的第一段。照它写的做,会以为"删除也走 canEdit",于是既可能给 delete 用错门(把 edit share 当成删除授权,即 ADR-0111 D3 明确拒绝的语义),也可能反过来以为不存在 canDelete 这道门。没有 schema / 类型变化,纯文档。

修法:一句话 —— 把第 2 条拆成 canEdit()(update)与 canDelete()(delete,更窄),措辞与下方两个方法文档对齐。

发现于 #5125(其 PR 的任务书把改动面限定为 canEdit 的 doc comment,故不并入)。未认领。

Activity

  1. os-zhuang commented on Aug 6, 2026

    @os-zhuang
    Contributor

    存量裁决轮(维护者 2026-08-06 委托,session_01LeEfA7CFwbJb7JJmXm2KM3):裁定入队,并按落点锚定改标 domain:spec-tooling → domain:spec(文件是 packages/spec/src/contracts/sharing-service.ts 源码文档,spec 单一所有者面;spec-tooling 按 #5469 裁决为临时 program 车道且 ⛔ 不碰 spec src)。前提经 origin/main 核实仍成立:模块头 15-17 行仍写 canEdit() 回答 update/delete,与同文件 canDelete()(ADR-0111 D3)直接矛盾。一句话文档修复,适合搭 spec 车道任一过路棒。维护者可否决。


    Generated by Claude Code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions