Repository navigation
test(codex): 补内部空白不得放宽的提交确认守卫 - #3171
Merged
Merged
Conversation
#3089 让 historyTextMatches 在逐字、CRLF 归一之外接受「去首尾空白后 相等」,放宽仅限消息首尾。补一条行为断言钉住这个边界:history 记录 为 a b、输入为内部双空格的 a b\n(仅内部空白不同)时必须 submitted:false 且 recheck():false,防止将来把放宽实现成折叠全部 空白(/\s+/g -> ' ')后内部差异被误判为同一消息。 变异验证:把放宽分支改成折叠内部空白后,本用例在 bun 与 node 双腿 各 1 红、其余 6 测仍绿;正确实现下 7 测全绿。现有 still rejects 用例 保留,它守「差异大」一档,本用例守「差异仅内部空白」一档。 Co-Authored-By: Claude Code <[email protected]>
deepcoldy
requested review from
47seek,
LucasIcarus,
xiaoxueSunn and
xiongz-c
as code owners
November 8, 2026 06:36
|
🚀 Released in v3.59.0 |
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.
背景
#3089 让
historyTextMatches在逐字、CRLF 归一之外接受「两边去首尾空白后相等」,放宽范围严格限定在消息首尾,正文(含内部空白)差异仍不匹配。复审发现现有测试只钉了「正文差异很大」一档(still rejects a line whose text differs beyond edge whitespace),没有钉「差异仅在内部空白」这一档:把放宽实现改成折叠全部空白(/\s+/g -> ' ')后,原 6 条用例全绿,防线无区分力。改动(仅测试,+12 行)
test/codex-history-trimmed-match.test.ts新增一条对writeInput行为的断言(不读源码):a b,输入a b\n(内部双空格 + 尾换行,首尾空白差异会被正常 trim 掉,只剩内部空白不同)submitted:false且recheck():false现有
still rejects ... beyond edge whitespace用例保留:它守「差异大」档,新用例守「差异仅内部空白」档,两条边都留。变异验证
const squash = t => t.replace(/\s+/g, ' '); return trimmed !== '' && squash(a) === squash(trimmed):新用例在 bun 与 node(vitest)双腿各 1 红,其余 6 测仍绿——精确咬住,不误伤bun run typecheck(TS7)通过影响面
纯测试新增,不改任何生产代码与默认行为。
🤖 Generated with Claude Code