Repository navigation
fix(ci): 事件集成测试改用具名 Handler,适配 framework 17.3.4 - #285
Merged
Merged
Conversation
framework 17.3.4 起 ApplicationHandlerUtils 不再把订阅事件类型无法解析的 Handler(lambda / JDK 动态代理)退化为「订阅所有事件」,而是直接跳过并打印 warning。SpringFlowEventPublisherIntegrationTest 中的 lambda 形式 IHandler 因此收不到事件,导致 CI 自 86d1e87(升级 17.3.4)后持续失败。 - 改为具名内部类 RecEventHandler 实现 IHandler<RecEvent> - 同步在注释中说明该约束,避免后续误用 lambda 注册 Handler
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## dev #285 +/- ##
============================================
- Coverage 74.32% 74.30% -0.02%
- Complexity 1939 2004 +65
============================================
Files 262 270 +8
Lines 7989 8256 +267
Branches 925 981 +56
============================================
+ Hits 5938 6135 +197
- Misses 1586 1630 +44
- Partials 465 491 +26 ☔ 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.
问题
dev分支 CI 自86d1e870(chore(deps): 升级 codingapi.framework 至 17.3.4,2026-11-17T01:25)起持续失败,报错都集中在flow-engine-starter:根因
framework 17.3.4 修改了
ApplicationHandlerUtils#getHandlerEventClass:ResolvableType.forClass(handler.getClass()).as(IHandler.class).getGeneric(0).resolve(),解析不到时返回null,handler(IEvent)的过滤条件退化为「订阅所有事件」,Handler 仍会收到事件;TypeVariable判断,解析不到直接返回null,并在过滤时跳过该 Handler 并打印 warning("订阅事件类型无法解析(lambda 或 JDK 动态代理),已跳过"),不再退化。而
SpringFlowEventPublisherIntegrationTest.TestConfig#recEventHandler()是以 lambda 形式注册的IHandler<RecEvent>:于是 17.3.4 下该 Handler 被整体跳过,两个用例断言的外部列表始终为空 → 测试失败。生产代码与示例应用中的 Handler(如
MyFlowRecordUrgeEventHandler)都是具名类,不受影响。修复
测试中的 Handler 改为具名内部类
RecEventHandler implements IHandler<RecEvent>,并在注释中说明 17.3.4 的类型解析约束,避免后续再以 lambda 注册 Handler。验证
./mvnw test:BUILD SUCCESS(全部模块通过,含此前失败的SpringFlowEventPublisherIntegrationTest3 例);-Dtest=SpringFlowEventPublisherIntegrationTest:Tests run: 3, Failures: 0。备注
该约束是 framework 17.3.4 的行为变更:使用方若以 lambda / JDK 动态代理实现
IHandler<T>,升级后会收不到事件(仅打印 warning)。建议在升级说明中提示使用者改用具名类或匿名内部类(后者可解析)。