docs(spec): HookEvent 枚举注释不再声称批量写把行级谓词放在 input (#5899) - #5964
Merged
Conversation
枚举注释里「row-scoping predicate carried in `input`」与同文件 200 行外的
`HookContextSchema.input` 契约表(":340" 起,PR #5668 落地 #5273 时写下的
「NOT reachable from `input` at all」)自相矛盾。引擎从不在写路径的
HookContext.input 上放谓词,它在引擎内部 OperationContext.ast(#2982)。
改为与契约表一致的措辞,并把读者指向该表与其钉子测试
packages/objectql/src/hook-input-shape-contract.test.ts。主句(批量写触发同名
事件、没有 *Many 事件)保留。纯注释订正,未触及 .describe()、键或类型。
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): 111 hand-written doc(s) reference the affected code and may need an implementation-accuracy re-verification:
|
qq9340100
marked this pull request as ready for review
August 6, 2026 13:27
baozhoutao
pushed a commit
that referenced
this pull request
Aug 6, 2026
#5964 刚把 `HookEvent` 的枚举注释对齐到契约表的「谓词不在 `input` 上」。 两句都对,但要分清:钩子拿不到的是 composed `ast`(生效谓词);`before*` 期间 `input.options` 仍是调用方那只 engine options 包(engine.ts 5516→5517 / 6137→6152 之后才重建成 DriverOptions),`where` 与 `multi` 都在 —— 守卫读的 正是它。中间件只收窄不放宽,所以把调用方谓词当目标集是上界近似,对 fail-closed 守卫恰是安全方向。契约表那两处 `before` 行的措辞另记为 #5997。 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01JwwiU9bjhwy2SWj13ho8uv
This was referenced Aug 6, 2026
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 #5899
问题
packages/spec/src/data/hook.zod.ts的HookEvent枚举注释里,写事件那段说批量写「with therow-scoping predicate carried in
input」。这是假的:引擎从不在写路径的HookContext.input上放谓词,它在引擎内部
OperationContext.ast(#2982)。这与 同一个文件 200 行外 的
HookContextSchema.input契约表(:340起,PR #5668 落地 #5273时写下)直接矛盾 —— 那段已经写着「The row-scoping predicate is NOT reachable from
inputatall」。#5668 只改了契约表那一处,枚举注释这半句没被覆盖到(
git log -L显示该段最后一次变动是#5306),于是文件自相矛盾:同一份契约,两个相反的答案,读者按哪一处写代码都说得通。
改动
纯注释订正,只动枚举注释那一段:
with the row-scoping predicate carried ininput`` 这半句;:340契约表已落地措辞一致的说法:谓词不在input,在引擎内部OperationContext.ast(Security: bulk (multi) update/delete skips OWD owner scoping on private objects — members can modify others' rows #2982),这样 filters 中间件才能 compose 到它上面、无 handler 能放宽;批量写的正确做法是在 CALLER 处用
options.where圈定,或落到after*逐行处理;packages/objectql/src/hook-input-shape-contract.test.ts。主句保留:批量写触发同名
beforeUpdate/beforeDelete/afterUpdate/afterDelete,没有per-cardinality 的
*Many事件(#3195)。未触及
.describe()、任何键或类型;未触及 #5900 的 skills /content/docs那一面(devx 车道)。真值来源
无需新测 —— PR #5668 已在 main 上留下钉子
packages/objectql/src/hook-input-shape-contract.test.ts,其中三条直接钉死本句(含阳性对照:读路径确实带
input.ast,所以「写路径没有ast」是测量而非空断言)。本 PR 的新措辞即是那些断言的自然语言版本。
验证
check:generated首次因api-surface.json报 stale —— 该 gate 读的是 BUILT dist,freshworktree 尚未 build,gate 自己的提示即指出这是 phantom;
pnpm --filter @objectstack/spec build后复跑,10 项全绿,确认本改动零生成物漂移。
无 changeset
零生成物、零行为变化、
.describe()未涉及 —— 本 PR 不发布任何东西,故不加 changeset,改用skip-changeset标签。https://claude.ai/code/session_011M7UwH25Unfi73UHim7ajY
Generated by Claude Code