Commit 8938f7e
committed
docs(spec): session.positions 不再教一个 hook 里跑不通的调用 (#6001)
`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 / 校验 / 运行时行为变化。
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011M7UwH25Unfi73UHim7ajY1 parent 6965160 commit 8938f7e
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 | |
|---|---|---|---|
| |||
418 | 418 | | |
419 | 419 | | |
420 | 420 | | |
421 | | - | |
422 | | - | |
423 | | - | |
424 | | - | |
425 | | - | |
426 | | - | |
| 421 | + | |
| 422 | + | |
| 423 | + | |
| 424 | + | |
427 | 425 | | |
| 426 | + | |
| 427 | + | |
| 428 | + | |
| 429 | + | |
| 430 | + | |
| 431 | + | |
| 432 | + | |
| 433 | + | |
| 434 | + | |
| 435 | + | |
| 436 | + | |
| 437 | + | |
| 438 | + | |
| 439 | + | |
428 | 440 | | |
429 | 441 | | |
430 | 442 | | |
| |||
443 | 455 | | |
444 | 456 | | |
445 | 457 | | |
446 | | - | |
447 | | - | |
448 | | - | |
449 | | - | |
| 458 | + | |
| 459 | + | |
| 460 | + | |
| 461 | + | |
| 462 | + | |
| 463 | + | |
| 464 | + | |
450 | 465 | | |
451 | 466 | | |
452 | 467 | | |
| |||
0 commit comments