docs: accept the hook-body write-set static-analysis gap (ADR-0107) - #3716
Merged
Conversation
Closes out option 1 of #3700 (from the #3583 reference-integrity assessment, §5 D4): the set of fields a hook body writes lives in an opaque JS string, so unknown-field writes cannot be statically checked — and per the assessment's own posture, must be marked rather than guessed at. - ADR-0107 records the decision: accept + mark the gap (D1), never heuristically analyze body source (D2), and route the structured `writes` declaration as a deferred, evidence-gated capability proposal tracked in #3700 (D3), with author guidance (D4). - content/docs/automation/hook-bodies.mdx gains "Not statically checked: the write set" — the exact coverage boundary (condition and capabilities are checked; writes are not), the runtime failure modes (late SQL driver error vs. silent persistence on schemaless drivers), and what to do instead. - hooks.mdx best practices point at that section. - ScriptBodySchema TSDoc states the blind spot at the contract itself. - The assessment's open decision D4 is recorded as decided. No behavior change; documentation and TSDoc only. Refs #3700 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EsRh53G7SMwFQL57BpFDsx
|
The latest updates on your projects. Learn more about Vercel for GitHub. 1 Skipped Deployment
|
Contributor
📓 Docs Drift CheckThis PR changes 1 package(s): 104 hand-written doc(s) reference the affected code and may need an implementation-accuracy re-verification:
|
The Check Changeset gate requires every PR to add a changeset; an empty-frontmatter changeset is its sanctioned "this PR releases nothing" declaration. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EsRh53G7SMwFQL57BpFDsx
os-zhuang
marked this pull request as ready for review
July 27, 2026 16:08
This was referenced Jul 28, 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.
落实 #3700 的短期建议(选项 1):接受 hook body 写入面的静态检查缺口,并把它写进文档 —— 即 #3583 评估文档 §5 D4 的 (a)。选项 2(结构化
writes声明)按 issue 的定位保留为独立提案,继续在 #3700 讨论,本 PR 不实现它,因此用 Refs 而非 Closes 关联。改动内容
docs/adr/0107-hook-body-write-set-accepted-static-gap.md(新增) — 决策记录:writes声明定位为能力提案(声明 → lint 校验 → 运行时强制,与capabilities同形),deferred + evidence-gated,由 Hook body writes are not statically checkable — accept the gap or giveHookSchemaa structuredwritesdeclaration #3700 跟踪;ADR-0078 §4 的注册期诊断维持原判,不在此重新决策;validateRecord跳过未知键 → SQL driver 把未知列透传给数据库、整个操作在运行期报错;schemaless driver(memory/MongoDB)则静默持久化,与成功不可区分。content/docs/automation/hook-bodies.mdx— 新增「Not statically checked: the write set」小节:明确检查边界(condition读取侧和 capability 面有检查;写入集没有)、运行时后果、以及替代做法(写入集固定时优先用 flowupdate_record节点,它的结构化fields是可被 lint 检查的)。content/docs/automation/hooks.mdx— Best Practices 增加一条指向上述小节。packages/spec/src/data/hook-body.zod.ts—ScriptBodySchemaTSDoc 声明该盲区(契约自述边界)。仅注释,无行为变化。docs/audits/2026-07-app-metadata-reference-integrity-assessment.md— §5 D4 标记为已决策,并链接落点。验证
pnpm --filter @objectstack/spec test:256 个文件、6688 个用例全部通过。pnpm --filter @objectstack/spec check:docs:250 个生成文件与 spec 同步(TSDoc 注释不影响生成的 references)。Refs #3700, #3583
🤖 Generated with Claude Code
https://claude.ai/code/session_01EsRh53G7SMwFQL57BpFDsx
Generated by Claude Code