fix: sort 异步比较器响亮报错,并清理评审遗留小项#2
Merged
Merged
Conversation
- sort/toSorted 比较器返回 thenable 时抛出明确 TypeError(原生路径会把 Promise 强转 NaN 静默乱序,违反 ADR-0003 "绝不静默错");被遗弃的 in-flight promise 预先挂上 catch,避免 unhandledRejection - 游标 forEach 幂等标记移到原型上(共享注册表 Symbol),不再被 tagPromiseMethods 的 wrapper 遮蔽 - filter 的 pick 用捕获的 flags 长度,与原生 "迭代前捕获 length" 对齐 - CLAUDE.md 协作规则恢复编号列表 - 测试:单测 +3(sort 守卫/血缘、filter 长度捕获),集成 +2(游标 forEach 同步 false 早退回归、sort 碰 db 比较器报错) Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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.
背景
PR #1 评审中列出的非阻塞遗留项,本 PR 全部补齐。
改动
sort/toSorted比较器守卫:碰 db 的比较器(被 async-rewriter2 重写后返回 promise)在原生路径下会被强转 NaN、"成功"排出垃圾顺序——典型静默错。现在检测到 thenable 直接抛明确 TypeError,提示先算 key 再排序(ADR-0003:响亮报错,绝不静默错)。toSorted结果按血缘保持增强。被遗弃的 in-flight promise 预先挂上 catch,避免 client 先关闭时产生 unhandledRejection。forEach幂等标记:从函数自身移到原型上(共享注册表 Symbol)。原先标记会被tagPromiseMethods的 wrapper 遮蔽,模块二次求值时白白重新替换。filter长度捕获:pick改用捕获的 flags 长度,与原生"迭代前捕获 length"语义对齐(回调中 push 的元素不参与)。测试
pnpm typecheck通过🤖 Generated with Claude Code