Uh oh!
There was an error while loading. Please reload this page.
docs(hooks): guard-shared-stash 头注的自测用例数改为 32,并写下计数规则 (#3721) - #3763
Merged
Conversation
…the counting rule (#3721) The header claimed 26 cases while the matrix has carried 32 since it landed (#3430): 30 `expect ` lines plus two inline special cases (empty-tool_input fail-open, no-jq-on-PATH fallback). A running self-test prints "32 passed, 0 failed", so the coverage statement readers trust before relying on the guard understated it by six cases. The count stays hand-kept — derivation machinery for one number is not worth it — but the counting rule and the re-derivation recipe are now stated inline so the next matrix change has something to re-read. The corrected line is byte-identical to the objectstack mirror's copy. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01GTRjn8xBqp75dk7kFupVRt
The latest updates on your projects. Learn more about Vercel for GitHub. |
yinlianghui
marked this pull request as ready for review
August 8, 2026 12:47
Uh oh!
There was an error while loading. Please reload this page.
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 freeto 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#3721
问题
.claude/hooks/guard-shared-stash.sh的头注写着「Self-test (26 cases, no network, no build)」,而自测矩阵从 #3430 落地起就一直是 32 条:30 条expect用例,加 2 条内联特例(空 tool_input 时 fail-open、PATH 上没有 jq 时的解析回退)。这一行正是读者在依赖该守卫前会信的覆盖面声明,少报了 6 条——恰好是这个 hook 自己在管的「声明与实际不一致」形状。
改动
只改头注:把 26 改成 32,并把计数规则和重新推导的方法写在紧随其后的注释里。这三行注释就是「派生计数」的轻量版——为一个数字造一套派生机制是过度设计,所以不做;数字仍然手写,但下次矩阵变动时有现成的重算配方可读:
expect行 + 2 条内联特例;grep -c '^expect '再 + 2,并且跑一遍自测,尾部本身会打印总数「N passed, N failed」,保持这个数字与它相等。.claude/hooks/guard-shared-stash.selftest.sh未改动,守卫逻辑未改动——本 PR 是纯注释。验证
真跑自测(这才是本任务的实质验证),在
objectui-3721worktree 内:grep -c '^expect '对 selftest = 30;30 + 2 = 32,与写入的数字、与自测自己打印的总数三者一致。node scripts/check-control-bytes.mjs→check-control-bytes: OK (scanned 3699 tracked text file(s); skipped 85 binary);另对改动文件做了一次手工扫描grep -naP(0x00-0x08、0x0b、0x0c、0x0e-0x1f),无命中,file仍报 UTF-8 text。pnpm install/ 构建 / 单测:改动是一行 shell 注释,不进任何包的编译或测试面,跑它们只会白占共享容器的内存。与 objectstack 镜像的一致性
objectstack 侧的同名副本(见 objectstack-ai/objectstack#6632)头注已经是 32。修正后,本仓这一行与镜像那一行逐字节相同(已用
git show origin/main:...比对确认),issue 里说的「两份副本头注最后一处非故意的文字差异」由此消除。新增的 3 行计数说明是本仓这边的增量,建议后续把同样的说明同步到镜像;那是跨仓改动,不放进本 PR。
无 changeset
仓库内部工具链(PreToolUse hook),不属于任何已发布包,对用户不可见。先例:
.claude/hooks/下全部 4 个历史提交(6801806、03b0f70、4d617a6、87df0b4)都没有带.changeset/文件。Generated by Claude Code