refactor(providers): consolidate error text predicates (EN | ZH)#754
Merged
DonPrus merged 2 commits intonullclaw:mainfrom Apr 17, 2026
Merged
refactor(providers): consolidate error text predicates (EN | ZH)#754DonPrus merged 2 commits intonullclaw:mainfrom
DonPrus merged 2 commits intonullclaw:mainfrom
Conversation
Extract isRateLimitedText, isContextExhaustedText, isVisionUnsupportedText, sliceEqlAsciiFold, and containsAsciiFold into a neutral text_helpers.zig module. Both error_classify.zig and reliable.zig now import from it, removing ~140 lines of duplicated logic. error_classify.zig: 445 → 357 lines (-88) reliable.zig: 1555 → 1537 lines (-18)
DonPrus
approved these changes
Apr 17, 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.
EN:
Extract isRateLimitedText, isContextExhaustedText, isVisionUnsupportedText,
sliceEqlAsciiFold, and containsAsciiFold into a neutral text_helpers.zig
module shared by both error_classify.zig and reliable.zig.
Changes:
Why: Both files implemented the same text-matching predicates for error
classification. error_classify.zig used containsAsciiFold byte-by-byte; reliable.zig
used a single lowercase buffer. unified into one source of truth.
ZH:
将 isRateLimitedText、isContextExhaustedText、isVisionUnsupportedText、
sliceEqlAsciiFold 和 containsAsciiFold 提取到中立的 text_helpers.zig 模块,
由 error_classify.zig 和 reliable.zig 共同引用。
变更:
**原因:**两个文件实现了相同的错误分类文本匹配断言。error_classify.zig
逐字节使用 containsAsciiFold;reliable.zig 使用单次小写转换缓冲。
统一为单一事实来源。
Validation: