Repository navigation
fix(heming): retain incomplete SSE lines across stream reads - #53
Merged
Renhuai123 merged 2 commits intoNov 2, 2026
Merged
Conversation
Owner
|
感谢!流式解析的经典坑,线上早先也踩过,修法一致。逐字节切分的回归写得很扎实。已合入最新 main、回归通过,已合并。 |
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.
改了什么、为什么
reader.read()的网络块可在data:前缀、JSON 或 UTF-8 字符中间结束。旧代码把每个块当作完整行处理,解析失败后静默丢弃内容。保留尚未结束的一行,收到换行后再解析,并兼容 CRLF。回归执行真实页面 reader 回调:对相同的“你好世界”两事件响应遍历每个字节切分点,另测逐字节输入和 CRLF。修复前在第一个切分点即丢失“你好”,修复后所有分块都得到完整文本。
自查
npm run typecheck和npm test,都通过npm test.env.local、密钥、他人的出生信息等隐私数据开源版不含
/api/heming;测试使用本地 ReadableStream,不声称已验证私有后端或正式站。此修复维持现有逐行 JSON 事件协议。