Commit 042b9ee
`positions` 的边界结论不变 —— 描述性、非授权输入。变的是它旁边那个例子,
因为例子本身是缺陷形状:
FROM「forwarding it as the sharing service's evaluation context
(`services.sharing.canEdit(..., { positions })`,两页 runtime-services
文档都这么教)」
TO 一个 hook 真拿得到的通道 —— 定制消息、经 `ctx.api` 跑业务判断、日志 ——
并写明 hook 上下文没有 `services` 键。
#5720 已实测钉死:hook 上下文逐键构造,ObjectQL 的 buildSession() 与
buildSandboxContext()(runtime/src/sandbox/body-runner.ts —— input /
previous / user / session / event / object / result / api / log / crypto)
都不设 `services`。于是 `services.sharing.canEdit(…)` 在 hook 里是
`undefined()`,外面惯常包的 `if (!ok) throw` 会拒掉每一次写。文档举为正例的
那个形状,恰是对全量流量 fail-close 的那个。
被引用的两页文档在 PR #5938 后已反转(sharing-service.mdx 新增
「Enforcement is automatic — do not re-check it in a hook」;examples.mdx
改教 `ctx.api`),这段 JSDoc 是最后一处还在教已撤回形状的地方。交叉引用改指
那一节。
JSDoc 与 `.describe()` 同改:describe 是 /api/v1/meta/types/hook 对外供给、
Studio 表单渲染的那一份,只改 JSDoc 会把缺陷例子留在作者真正会看的面上。
仅文案,无 schema / 校验 / 运行时行为变化。
Claude-Session: https://claude.ai/code/session_011M7UwH25Unfi73UHim7ajY
Co-authored-by: Claude <noreply@anthropic.com>
1 parent 881a3cc commit 042b9ee
2 files changed
Lines changed: 61 additions & 10 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
422 | 422 | | |
423 | 423 | | |
424 | 424 | | |
425 | | - | |
426 | | - | |
427 | | - | |
428 | | - | |
429 | | - | |
430 | | - | |
| 425 | + | |
| 426 | + | |
| 427 | + | |
| 428 | + | |
431 | 429 | | |
| 430 | + | |
| 431 | + | |
| 432 | + | |
| 433 | + | |
| 434 | + | |
| 435 | + | |
| 436 | + | |
| 437 | + | |
| 438 | + | |
| 439 | + | |
| 440 | + | |
| 441 | + | |
| 442 | + | |
| 443 | + | |
432 | 444 | | |
433 | 445 | | |
434 | 446 | | |
| |||
447 | 459 | | |
448 | 460 | | |
449 | 461 | | |
450 | | - | |
451 | | - | |
452 | | - | |
453 | | - | |
| 462 | + | |
| 463 | + | |
| 464 | + | |
| 465 | + | |
| 466 | + | |
| 467 | + | |
| 468 | + | |
454 | 469 | | |
455 | 470 | | |
456 | 471 | | |
| |||
0 commit comments