refactor(cache): collapse loader binding and narrow failure-handling seam - #30
Merged
Merged
Conversation
…entry The 3-arg unbound constructor and the 7-arg per-call callback entry only existed to serve the old test wiring protocol; production RedisProCache already binds the three callbacks at construction. Delete both shallow entries, validate the required callbacks with Objects.requireNonNull at construction (assembly errors now fail at construction, not per call), and have executeSyncLoad/executeLoad read the bound final fields so all loader behavior flows through the single 4-arg orchestrate seam. Migrate every LoaderOrchestratorTest case onto the same constructor-bound path the production adapter uses, preserving the bloom / sync / hit / null / loader-failure / write-back-tolerance assertions, and add the constructor-validation, cross-call no-state, and null-value-wrapper-hit cases required by the accepted design (L01-L10, §2.5).
The 5-arg handleException(strategy) overload existed only for tests and exercised operation/strategy combinations production never selects; every failure now routes through the operation-driven handleError seam. The key/pattern parameter was threaded through both handleError forms and the private helper but never used by the failure implementation, so it is gone. Migrated CacheErrorHandlerTest to real operations, proving the per-operation strategy through metric tags with independently written expectations, added a typed PARTIAL_CLEAN + finalizeFailure behavior test for the partial-clean kind, and moved the key-privacy sentinel into the exception message.
DavidHLP
marked this pull request as ready for review
September 19, 2026 16:35
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
Trailing whitespace on javadoc and builder lines, one tab-indented BloomFilterConfig block and two files missing their final newline all violated the committed .editorconfig rules (4-space indent, trim trailing whitespace, insert final newline) that no automated check enforces. Whitespace-only: `git diff -w` against the parent is empty, so compiled bytecodes and behavior are unchanged. testcontainers.properties gained its missing trailing newline so the file ends like every other tracked text file.
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.
Summary
按 2026-09-20 架构审查决策(两份候选全部采纳)收窄两个内部 module 的测试专用调用协议:
LoaderOrchestrator三参未绑定构造器与七参orchestrate入口;六参构造器构造期以Objects.requireNonNull校验三个必需回调,四参入口成为唯一实例入口;LoaderOrchestratorTest全部迁移到构造绑定路径,新增构造校验、同实例双 key、null 命中用例。handleException转发重载与全链路无效的key/pattern 参数;测试改经真实 operation 驱动策略,以独立SimpleMeterRegistry断言 operation/kind/strategy tags(字面量期望,不读取生产策略表);handleError_clean_acceptsPattern替换为 typedPARTIAL_CLEAN→finalizeFailure行为测试。公开缓存使用方式、handler/observer 契约、序列化格式、指标命名均不变。
Checklist
./mvnw clean verify -Bpasses (remote-dev @ c32097d: 916 tests, 0 failures, coverage checks met)../mvnw checkstyle:check -Bpasses (remote-dev @ c32097d).AbstractRedisIntegrationTest(仅 4 处 Mockito stub 参数位调整;由完整 verify 覆盖).bash scripts/ci/check-test-names.shpasses (remote-dev).bash scripts/ci/check-docs-contracts.shpasses (remote-dev).refactor(cache)×2).scripts/ci/check-external-consumer.shpasses (remote-dev; requiredRESICACHE_JDK21override to zulu-21 — script default temurin path absent on that host, environment note only).定向单测另过:
-Punit -Dtest=LoaderOrchestratorTest,CacheErrorHandlerTest,RedisProCacheLoadPathTest,RedisProCacheWriterFailureTest,CacheFailureReporterTest,FailureLogKeyPrivacyTest→ 74/74。GitHub Actions 全绿。Backward compatibility
LoaderOrchestrator、CacheErrorHandler均为 package-private 内部类型;不改变公开 seam、wire 格式或默认行为。失败计数、脱敏日志、typed failure 最终化契约保持。