[Commands API interface consistency #1] tests and non-breaking fixes - #3865
[Commands API interface consistency #1] tests and non-breaking fixes#3865uglide wants to merge 4 commits into
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: f29cddcb82
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
f29cddc to
2b19668
Compare
2b19668 to
7d09bed
Compare
Introduce reflection-based unit tests that verify the sync, async, reactive, Kotlin coroutine and cluster node-selection command interfaces stay in lockstep, replacing the consistency-by-regeneration guarantee of the template-based API generators: - CommandInterfaces: catalog of all command groups and their flavors - KnownApiDeviations: single registry of intentional deviations, ported from the generator rule tables - TypeSignatures: shared reflection and type-normalization helpers - SyncAsync/SyncReactive/NodeSelection/AggregateInterface/ CommandBuilderCoverage/KotlinCoroutines consistency tests The suite checks method parity in both directions, the per-flavor return-type mapping (RedisFuture, Mono/Flux, suspend/Flow, Executions), aggregate interface wiring and interface-to-command- builder coverage. Sync/async parity is load-bearing at runtime: the sync API is a dynamic proxy over async (FutureSyncInvocationHandler). Supersedes SyncAsyncApiConvergenceUnitTests. Adds kotlin-reflect as a test dependency. Note: at this commit the suite documents real drift in the committed interfaces — several tests fail intentionally; the deviations are fixed in the follow-up commit. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
7d09bed to
fddac9d
Compare
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit fddac9d. Configure here.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: fddac9d08f
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Real drift found by the new consistency tests, accumulated while the API generators were out of use: - RedisCoroutinesCommands did not extend RediSearchCoroutinesCommands (the implementation already delegated to it) - Kotlin coroutine API was missing bitopDiff/bitopDiff1/bitopAndor/ bitopOne, hgetex(key, fields), hsetex(key, map) and the xackdel/xdelex stream commands - reactive hgetdel/hgetex streaming-channel variants were missing their @deprecated marker The node-selection aggregate wiring drift (missing ACL/Array groups, async aggregate extending the sync Stream interface) is exempted via KnownApiDeviations.NODE_SELECTION_AGGREGATE_PENDING — fixing it is a breaking change scheduled for the 8.0 release. Makes the API consistency test suite pass. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
- verify the methods declared directly on the aggregate interfaces (auth, select, the CLUSTER commands, ...) against their async and reactive counterparts, restoring coverage the removed SyncAsyncApiConvergenceUnitTests had via RedisCommands.getMethods() - include RedisClusterCoroutinesCommands in the aggregate wiring check and add its missing FUNCTION/JSON/VECTOR_SET/ARRAY/SEARCH groups (experimental API; the impl already delegates per group) - keep the Kotlin generator's FLOW_METHODS in sync with the hand-added Flow methods for as long as the generators still exist - add behavioral coroutine integration tests for the new hash-field-expiry, BITOP and stream-deletion commands Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
16eebdb to
622d675
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 622d6750ad
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Erased-parameter matching alone would accept flavors whose generic parameter signatures diverge (e.g. Map<K, V> vs Map<V, K>), and nothing compared @deprecated across the Java flavors. The suite now verifies both for sync/async, sync/reactive, node-selection and the aggregate-declared methods. The reactive dispatch parameter mutation (CommandOutput<K, V, ?>) and the intentional deprecation of the CommandOutput-based node-selection dispatch overloads are recorded in KnownApiDeviations. Fixes surfaced by the new checks: RedisAdvancedClusterReactiveCommands .keysLegacy and RedisAdvancedClusterAsyncCommands.masters carried a @deprecated tag without the matching @deprecated annotation. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

Introduces a reflection-based unit-test suite that verifies the sync, async, reactive, Kotlin coroutine and cluster node-selection command interfaces stay in lockstep, replacing the consistency-by-regeneration guarantee of the template-based API generators (removal of the generators follows in #3866).
What the suite checks
RedisFuture<T>return-type wrapping. This is load-bearing at runtime: the sync API is a dynamic proxy over async (FutureSyncInvocationHandler), so a mismatch previously failed only at call time.Mono/Fluxmapping rules (collections →Flux, forced-Flux,Value<>-wrapped elements) and@Deprecatedon streaming-channel variants.suspend/Flowshape (viakotlin-reflect, new test-scope dependency managed by the Kotlin BOM).Executions/AsyncExecutionswrapping and the exclusion list, with a staleness check on the list itself.RedisCommands,RedisClusterCommands,NodeSelectionCommands,RedisClusterCoroutinesCommandsetc. extend every command group they must cover, and the methods declared directly on the aggregates (auth,select, theCLUSTERcommands, …) are parity-checked against their async/reactive counterparts.Structure:
CommandInterfaces(group catalog — the single place to register a new command group),KnownApiDeviations(all intentional irregularities, ported from the generator rule tables),TypeSignatures(shared reflection helpers). SupersedesSyncAsyncApiConvergenceUnitTests.Deviations found and fixed
Calibrating the suite against the committed interfaces surfaced real drift, fixed in the second commit:
RedisCoroutinesCommandsdid not extendRediSearchCoroutinesCommands(the impl already delegated to it)bitopDiff/bitopDiff1/bitopAndor/bitopOne,hgetex(key, fields),hsetex(key, map)and thexackdel/xdelexstream commandshgetdel/hgetexstreaming-channel variants were missing@DeprecatedDeviations found and deferred
The node-selection aggregate wiring drift (missing ACL/Array groups;
NodeSelectionAsyncCommandsextending the syncNodeSelectionStreamCommands) is not fixed here — correcting it changes return types onAsyncNodeSelectionand is therefore a breaking change. It is exempted viaKnownApiDeviations.NODE_SELECTION_AGGREGATE_PENDING(with a documenting comment) and fixed in #3867, targeted for the 8.0.0 release.Note: the first commit intentionally fails the new tests (it demonstrates the drift); the second commit makes the suite green.
Make sure that:
mvn formatter:formattarget. Don't submit any formatting related changes.🤖 Generated with Claude Code
Note
Medium Risk
Touches many public command interfaces and cluster/coroutine aggregates; mistakes could break compile-time API contracts, though changes are additive or deprecation-only with heavy reflection test coverage.
Overview
Adds a reflection-based unit test suite under
io.lettuce.core.api.consistencythat keeps sync, async, reactive, Kotlin coroutines, cluster aggregates, node-selection, and command builders aligned—replacing the oldSyncAsyncApiConvergenceUnitTestsand the generator-era guarantee. Shared scaffolding includesCommandInterfaces,KnownApiDeviations, andTypeSignatures;kotlin-reflectis added as a test dependency.Interface fixes surfaced by the new tests:
RedisCoroutinesCommandsandRedisClusterCoroutinesCommandsnow extend RediSearch (and cluster coroutines also wire Function, JSON, VectorSet, Array); Kotlin coroutines gain 7.7 APIs (bitopDiff/Diff1/Andor/One, simplifiedhsetex/hgetex,xackdel/xdelex); reactivehgetex/hgetdelstreaming-channel overloads are marked@Deprecated; missing@Deprecatedon clustermasters()and reactivekeysLegacyis restored.Generator/test maintenance:
KotlinCompilationUnitFactoryFLOW_METHODSupdated for new streaming commands; coroutine integration tests cover hash expiry, bitops, and stream deletion. Known node-selection aggregate gaps stay exempt viaNODE_SELECTION_AGGREGATE_PENDING(deferred to 8.0).Reviewed by Cursor Bugbot for commit 4edb596. Bugbot is set up for automated code reviews on this repo. Configure here.