docs(os-dev): 自扫字符类补上 DEL,与 #5460 扩面后的门禁扫描面对齐 (#5484) - #5577
Merged
Conversation
`.claude/agents/os-dev.md` 的 Byte discipline 段要求 dev agent 在改动涉及 控制字符时「self-scan beyond the gate」,给出的字符类却停在 #5157 时代的 扫描面(C0 减 tab/LF/CR)。#5460(PR #5479)已把 `check:nul-bytes` 的扫描 面扩到含 DEL(0x7f),该指令未跟 —— 于是它成了门禁的真子集:agent 写下一枚 0x7f,按指令自扫绿,推上去 CI 红,把本可本地一秒发现的问题推迟整个 CI 轮次, 恰好在这条指令唯一被设计来防的场景里给出假绿。 改动一行,字符类与门禁脚本头的 `[\x00-\x08\x0b\x0c\x0e-\x1f\x7f]` 一致。 「同一事实手抄三处」的单源化根治方向留在 #5484 正文,不在本单实施。 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01GX3sL71LFq8m2usg6VqTSE
|
The latest updates on your projects. Learn more about Vercel for GitHub. 1 Skipped Deployment
|
Contributor
Author
|
范围外发现(Prime Directive #10,未在本 PR 修):
本 PR 严格只改裁定的那一行字符类,未顺手改散文 —— 该段散文的准确性归 #5579。 Generated by Claude Code Generated by Claude Code |
This was referenced Aug 5, 2026
os-zhuang
marked this pull request as ready for review
August 5, 2026 19:47
os-zhuang
enabled auto-merge
August 5, 2026 19:47
This was referenced Aug 5, 2026
This was referenced Aug 5, 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 #5484
问题
.claude/agents/os-dev.md的 Byte discipline 段要求 dev agent 在改动「提及控制字符」时,除了跑门禁还要逐字节自扫,理由原话是 self-scan beyond the gate —— the gate's blind spots are exactly where these bytes hide。但它给出的字符类停在 #5157 时代的扫描面(ASCII 控制字符减 tab/LF/CR,且只覆盖 C0 连续区间)。#5460(PR #5479)已把门禁
scripts/check-nul-bytes.mjs的扫描面扩到含 DEL(U+007F,该字节不属于 C0,独自坐在 ASCII 表末端,正因如此被区间写法漏掉),这条指令没跟 —— 于是它成了门禁的真子集:check:nul-bytes→ 红。即这条指令在它唯一被设计来防的场景里给出假绿,把本可本地一秒发现的问题推迟整个 CI 轮次。
改动
一行:该字符类补上
\x7f,与门禁脚本头现行表述一致([\x00-\x08\x0b\x0c\x0e-\x1f\x7f])。周边散文未陈述扫描面范围,无需同步;文件面仅.claude/agents/os-dev.md,未触scripts/与packages/lint。「同一事实手抄三处(门禁脚本 / 历史 changeset / 本指令)、靠人肉同步」的单源化根治方向,按裁定留在 #5484 正文,不在本单实施。另两处均正确:门禁脚本 #5460 已更新;两份历史 changeset 凝固在各自当时的语义。
验证
本改动无可执行面、无单测面(纯 agent 指令文本),验证由覆盖
.claude/的两道门禁 + 逐字节自扫构成。写这条修改本身就是 #4890 一族的事故源现场(该族多次事故全发生在「写关于该字节的内容」时),因此自扫用的是扩面后的字符类。字节级确认改动写入的是转义文本而非真字节(
od -c该行):\ x 7 f四个字符,行内无177八进制字节。反向验证(方向先判后跑)
预判三条腿:同一枚真 DEL 字节的样本上,旧字符类绿(即 issue 描述的假绿)、新字符类红、门禁红。实跑与预判一致:
od -c显示case ' 177 ':(以printf '\177'生成,未粘贴裸字节);[\x00-\x08\x0b\x0c\x0e-\x1f]→ exit=1,无匹配 = 假绿;--self-test(本 PR 已跑,48 断言全绿)自带 DEL(0x7f)在 C0 扫描面之外:login.ts / register.ts 各有一枚裸 0x7f 当 Backspace 键值,与刚转义的 0x03 同处一个 switch #5460 的 DEL 样本断言,包括'#5460: a raw 0x7f Backspace literal must be flagged'。三条腿合起来即「指令与门禁在该字节类上等价」——issue 描述的假绿窗口关闭。
changeset
.claude/内部 agent 指令文本,不释放任何包 → 按 pr-automation.yml 的 route 2 走skip-changeset标签(先例 PR #5501),不加空 frontmatter changeset(#4898)。🤖 Generated with Claude Code
https://claude.ai/code/session_01GX3sL71LFq8m2usg6VqTSE
Generated by Claude Code