You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* ⚠️ **Descriptive, NOT an authorization input.** A hook may READ this to
* describe the caller — forwarding it as the sharing service's evaluation
* context (`services.sharing.canEdit(..., { positions })`, the shape both
* `content/docs/kernel/runtime-services/` pages teach), tailoring a
* message, logging — and nothing more.
它引用的文档现状已反转。 注释说这是「both content/docs/kernel/runtime-services/ pages teach」的形状。PR docs(kernel): runtime-services 的 hook 示例改教真实通道 —— 去掉不存在的 ctx.services (#5720) #5938 之后:sharing-service.mdx 新增了一整节 "Enforcement is automatic — do not re-check it in a hook",并把 Example 改成由持有该服务的代码(ISharingService 入参)调用;examples.mdx 第 2 节改教 ctx.api。也就是说这两页现在教的正好相反。
把举例通道换成 hook 真实拿得到的:保留「可以读来描述调用者」的结论,例子改为 ctx.api 侧的业务判断 / 定制消息 / 日志,并删掉「the shape both content/docs/kernel/runtime-services/ pages teach」这句已反转的交叉引用(或改指 sharing-service.mdx 的 "do not re-check it in a hook" 一节)。
事实(对
origin/main核实,628b028)packages/spec/src/data/hook.zod.ts,session.positions的 JSDoc(约 415-418 行):这段注释在两个层面都已过时:
它举的动作在 hook 里做不到。 [docs] runtime-services 的 hook 示例在教
ctx.services—— hook 上下文从来没有这个键,照抄的 hook 会拒掉每一次写入 #5720 已实测钉死:引擎逐键构造 hook 上下文(object/event/input/session/provenance/user/api/transaction/ql,见packages/objectql/src/engine.ts4796 / 4929 / 5505 / 6059),buildSandboxContext(packages/runtime/src/sandbox/body-runner.ts)同样只产input/previous/user/session/event/object/result/api/log/crypto—— 两条路径都没有services键。所以「a hook may READ positions … forwarding it asservices.sharing.canEdit(…)」举的正例,恰恰是 [docs] runtime-services 的 hook 示例在教ctx.services—— hook 上下文从来没有这个键,照抄的 hook 会拒掉每一次写入 #5720 认定会无条件拒掉每一次写入的那个形状(ctx.services?.sharing?.canEdit(…)短路成undefined,if (!ok) throw全拒)。它引用的文档现状已反转。 注释说这是「both
content/docs/kernel/runtime-services/pages teach」的形状。PR docs(kernel): runtime-services 的 hook 示例改教真实通道 —— 去掉不存在的ctx.services(#5720) #5938 之后:sharing-service.mdx新增了一整节 "Enforcement is automatic — do not re-check it in a hook",并把 Example 改成由持有该服务的代码(ISharingService入参)调用;examples.mdx第 2 节改教ctx.api。也就是说这两页现在教的正好相反。为什么值得记一笔
packages/spec的 JSDoc 是 AI 与人照抄的语料(它还会被/api/v1/meta/types/hook与 Studio 表单读到,见同文件 22 行附近的说明)。这里留着的不是措辞旧,而是一个被点名修掉的缺陷形状仍被当作正例在契约里挂着 —— 与 #5720 / #5944 同族,只是藏在 spec 的注释里,不在content/docs/下,所以 #5938、#5995 的派发面都够不着。注意本单不主张改
positions的语义结论(「描述性、非授权输入」是对的,不动);要改的只是它选用的那个举例通道。建议修法
把举例通道换成 hook 真实拿得到的:保留「可以读来描述调用者」的结论,例子改为
ctx.api侧的业务判断 / 定制消息 / 日志,并删掉「the shape bothcontent/docs/kernel/runtime-services/pages teach」这句已反转的交叉引用(或改指sharing-service.mdx的 "do not re-check it in a hook" 一节)。关联
ctx.services—— hook 上下文从来没有这个键,照抄的 hook 会拒掉每一次写入 #5720 / PR docs(kernel): runtime-services 的 hook 示例改教真实通道 —— 去掉不存在的ctx.services(#5720) #5938(同族源头,已定模式)services.data页的 Example 也是 hook 语境混搭 ——ctx.input.contact_id配上 hook 拿不到的services.data#5944 / PR docs(kernel): services.data 页的 Example 去掉 hook 语境混搭,并说清 Canonical source 为何是 SDK (#5944) #5995(data-service.mdx,本单是在做该页时越界发现的,按 PD chore: version packages #10 未夹带)未认领、未标
pm:queue,交 PM 分诊定级。