Repository navigation
fix: unify adapter error handling and enforce four-framework contracts - #226
Merged
Merged
Conversation
Fix TestAgent assertions, observe errors before envelopes, share adapter execution, and bridge native parser failures. Add common HTTP and unchanged-blog contracts to CI, document migration behavior, and coordinate packages at 3.5.0.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #226 +/- ##
==========================================
+ Coverage 99.61% 99.66% +0.04%
==========================================
Files 29 31 +2
Lines 3150 3306 +156
Branches 1025 1085 +60
==========================================
+ Hits 3138 3295 +157
+ Misses 12 11 -1 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
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.
切换 Express、Koa、LeizmWeb、H3 时,同一份业务代码的校验、错误观察和 HTTP 响应应保持一致。本 PR 修复 TestAgent 失败断言的假阳性,并用同一套真实 HTTP 契约持续验证四个适配器。
.error()接受成功响应、.success()忽略 HTTP 错误的问题;网络/格式器异常不再被当成预期业务失败。onError,校验失败触发onValidate(Error);宿主错误边界不会重复观察。createErrorHandler(api),接入原生 body parser 错误;非法 JSON 统一为INVALID_BODY/400,保留 cause。验证(本地 Node 24):
pnpm test:955 项主测试 + 13 项示例测试通过,包含构建和 H3 类型检查。pnpm run test:cov:955 项通过;语句/行 99.66%,分支 95.22%,函数 99.62%。pnpm run test:adapters:116 项构建产物契约通过。pnpm run check、19 项发布工具测试、frozen-lockfile 安装通过。迁移注意:Koa 错误边界放在 parser/routes 前,Express/LeizmWeb 放在路由后,H3 使用 onError;自定义 CORS/OPTIONS 在 erest 路由前处理。onResponse 表示处理完成,不表示网络发送完成。大小写、尾斜杠、正则路由及宿主 404/405 内容仍由宿主配置决定,详见 MIGRATION.md 与 guides/adapters.md。