Skip to content

Conversation

@mercyblitz
Copy link
Contributor

This pull request introduces several improvements and enhancements to the Microsphere Redis project, focusing on better metadata handling, improved documentation, and minor code consistency updates. The most significant changes are the addition of parameter name support in method metadata, updates to the test suite to reflect these changes, and enhancements to project documentation and configuration.

Enhancements to Metadata Handling:

  • Added a parameterNames field to the MethodMetadata class, including corresponding getter/setter methods, updates to equals, hashCode, and toString, and integration into related tests. This allows the framework to capture and utilize method parameter names in addition to types for Redis command metadata. [1] [2] [3] [4] [5] [6]
  • Updated the metadata generator (SpringDataRedisMetadataGenerationDoclet) to introduce a new metadata key for method parameter names, laying the groundwork for generating and persisting this information.
  • Refactored imports and toString methods in Parameter and ParameterMetadata classes to use symbolic constants for formatting, ensuring consistency across metadata-related classes. [1] [2] [3] [4]

Documentation and Project Structure:

  • Major rewrite and expansion of the README.md to provide a clear project overview, module descriptions, getting started instructions, build steps, contribution guidelines, and links to documentation resources.
  • Added a CODE_OF_CONDUCT.md file to establish community guidelines and foster an open, welcoming environment for contributors.

Build Configuration:

  • Cleaned up the microsphere-redis-generator/pom.xml by moving the sourcePath property to the correct section and removing redundant properties, improving Maven configuration hygiene. [1] [2]

Codebase Maintenance:

  • Minor import and utility usage updates in the metadata generator to align with recent refactorings and remove unused code. [1] [2] [3]

These changes collectively enhance the maintainability, usability, and extensibility of the Microsphere Redis project, particularly in how method metadata is captured and leveraged for advanced Redis integration scenarios.

Introduce a Contributor Code of Conduct to outline expected behavior and reporting procedures, fostering an open and welcoming community. Adapted from the Contributor Covenant v1.3.0.
Expanded the README to include project purpose, module descriptions, setup instructions, build steps, contribution guidelines, and documentation links. Added badges for build status and documentation hosts to improve project visibility and onboarding.
Introduces RedisCommandReplicatedEventTest to verify the getDomain and getSourceEvent methods of RedisCommandReplicatedEvent.
The redundant Maven Central version badge was removed from the README to reduce clutter and avoid duplication.
Corrected the formatting of the zread badge in the README to ensure proper display and alignment with other badges.
Included a Maven Central badge to display the latest published version of the microsphere-gateway artifact, improving project visibility and providing users with quick access to version information.
Documented the introduction version of several Redis command interface constants using @SInCE tags for better clarity on their availability in Spring Data Redis.
Changed visibility of default property value constants in KafkaConsumerRedisReplicatorConfiguration from private to package-private to allow direct access in tests. Added a new test method in KafkaConsumerRedisReplicatorConfigurationTest to verify the values of these constants and related configuration constants.
Corrected the compatibility range for branch 0.1.x to start from Spring Data Redis 2.1.0 instead of 2.0.0.
Moved <properties> section above <dependencies> and removed unused <classPath> property. Reformatted plugin <argument> for better readability.
Renamed 'docUtils' to 'javaFileObjects' for clarity in SpringDataRedisMetadataGenerator and updated its usage in the DocumentationTask call.
Changed the Maven badge in README.md to reference microsphere-redis instead of microsphere-gateway for accuracy.
Imported DefaultRedisConfig and included it in the @ContextConfiguration classes for KafkaRedisReplicatorModuleInitializerIntegrationTest to ensure proper Redis configuration during integration testing.
Adjusted the order of import statements for better organization and consistency in RedisMethodContext.java.
Moved the import of io.microsphere.redis.metadata.Parameter to group it with other imports for better organization and readability.
Included DefaultRedisConfig in the @ContextConfiguration classes for RedisCommandReplicatorIntegrationTest to ensure proper Redis configuration during integration testing.
Deleted static @bean methods for RedisTemplate, StringRedisTemplate, and RedisConnectionFactory from AbstractRedisReplicatorTest. These definitions are likely unnecessary for the test context or have been moved elsewhere.
Updated the resolvableType method to use ResolvableType.forClass instead of forType for obtaining the generic type. This change improves type resolution for the AbstractSerializer class.
Deleted the trailing newline at the end of BoundarySerializer.java to conform to file formatting standards.
Deleted the trailing newline at the end of ByteArraySerializer.java to conform to file formatting standards.
Deleted the trailing newline at the end of DoubleSerializer.java to conform to file formatting standards.
Deleted the trailing newline at the end of GeoLocationSerializer.java to conform to file formatting standards.
Deleted the trailing newline at the end of IntegerSerializer.java to conform to file formatting standards.
Deleted the trailing newline at the end of LongSerializer.java to conform to file formatting standards.
Deleted the trailing newline at the end of PointSerializer.java to conform to file formatting standards.
Deleted the trailing newline at the end of RangeSerializer.java to conform to file formatting standards.
Deleted the trailing newline at the end of RedisZSetCommandsRangeSerializer.java to conform to file formatting standards.
Deleted an unnecessary blank line at the end of ShortSerializer.java to improve code formatting.
Deleted the trailing newline at the end of WeightsSerializer.java to conform to file formatting standards.
Replaced references to 'delegate' with 'this.delegate' in HoldingValueRedisSerializerWrapper for clarity and consistency.
Introduces the RangeModel class to adapt between RedisZSetCommands.Range and Spring's Range, supporting serialization and deserialization. This utility facilitates interoperability and externalization of range objects.
Simplifies RangeSerializer by delegating Range to RangeModel conversion to static methods. Removes manual extraction and assignment of Range bounds, improving code maintainability and readability.
Replaces the use of range.toRange() with RangeModel.from(range) in RedisZSetCommandsRangeSerializer to improve serialization consistency.
Deleted the trailing newline at the end of EnableRedisInterceptorTest.java to conform to file formatting standards.
Replaced usage of 'integer' with 'index' variable for clarity and consistency in assertions within testInitializeParameters. This improves readability and avoids potential confusion in parameter handling.
Annotated RedisTemplate and StringRedisTemplate fields with @qualifier to ensure correct bean injection in AbstractRedisTest. This improves reliability when multiple beans of the same type exist.
Introduced a new field 'parameterNames' with corresponding getter and setter methods in the MethodMetadata class. Updated equals, toString, and related logic to include parameterNames for more detailed method metadata representation.
Extended MethodMetadataTest to include assertions and setup for the parameterNames property, ensuring correct behavior for equality and getter/setter methods.
Introduces collection and storage of method parameter names in the generated metadata for Spring Data Redis command methods. Refactors parameter type resolution and updates the metadata map to include both parameter names and types.
Added explicit parameterNames for all method entries in spring-data-redis-metadata.yaml to improve clarity and support for reflection or code generation. This enhances documentation and tooling around Redis command interfaces.
Updated Parameter and ParameterMetadata toString methods to use symbol constants for formatting. Refactored SpringRedisMetadataRepository to remove Spring's ParameterNameDiscoverer and use method metadata for parameter names, simplifying parameter metadata construction.
Replaces direct call to buildParameterMetadataList with a new getParameterMetadataList method that considers parameter names from MethodMetadata. Updates method to use redisCommandMethod when parameter names are unavailable, improving flexibility and correctness in parameter metadata construction.
Introduced a unit test to verify that getParameterMetadataList returns the expected parameter metadata for Redis command methods by comparing it with buildParameterMetadataList.
@augmentcode
Copy link

augmentcode bot commented Dec 26, 2025

🤖 Augment PR Summary

Summary: This PR prepares the 0.2.0 release by expanding Redis command metadata, refining generators/serializers, and improving project documentation.

Changes:

  • Extended MethodMetadata with optional parameterNames to capture method parameter names in addition to types.
  • Updated the metadata doclet to extract parameter names from ExecutableElement parameters and emit them into generated metadata.
  • Adjusted the Spring metadata repository to prefer persisted parameter names and fall back to reflective metadata building when names are absent.
  • Regenerated META-INF/spring-data-redis-metadata.yaml to include parameterNames for many Spring Data Redis methods.
  • Refactored Range serialization by extracting RangeModel for reuse across Range and RedisZSetCommands.Range serializers.
  • Updated replicator tests/config wiring (e.g., default Redis test config, Kafka consumer constant visibility) to align with the new setup.
  • Expanded README.md and added CODE_OF_CONDUCT.md.

Technical Notes: Parameter names are added as an additive metadata field; method indexing continues to rely on interface name + method name + parameter types.

🤖 Was this summary useful? React with 👍 or 👎

@codecov
Copy link

codecov bot commented Dec 26, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.

Files with missing lines Coverage Δ Complexity Δ
.../io/microsphere/redis/metadata/MethodMetadata.java 100.00% <100.00%> (ø) 27.00 <3.00> (+3.00)
.../java/io/microsphere/redis/metadata/Parameter.java 100.00% <100.00%> (ø) 16.00 <1.00> (ø)
.../microsphere/redis/metadata/ParameterMetadata.java 100.00% <100.00%> (ø) 12.00 <1.00> (ø)
...mer/KafkaConsumerRedisReplicatorConfiguration.java 100.00% <ø> (ø) 18.00 <0.00> (ø)
...e/redis/spring/interceptor/RedisMethodContext.java 100.00% <ø> (ø) 59.00 <0.00> (ø)
...spring/metadata/SpringRedisMetadataRepository.java 99.28% <100.00%> (+0.01%) 48.00 <3.00> (+1.00)
...re/redis/spring/serializer/AbstractSerializer.java 100.00% <100.00%> (ø) 13.00 <1.00> (ø)
...re/redis/spring/serializer/BoundarySerializer.java 100.00% <ø> (ø) 5.00 <0.00> (ø)
...e/redis/spring/serializer/ByteArraySerializer.java 100.00% <ø> (ø) 5.00 <0.00> (ø)
...here/redis/spring/serializer/DoubleSerializer.java 100.00% <ø> (ø) 5.00 <0.00> (ø)
... and 11 more

... and 1 file with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link

@augmentcode augmentcode bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review completed. 3 suggestions posted.

Fix All in Augment

Comment augment review to trigger a new review at any time.

int result = hash(index, interfaceName, methodName, write);
result = 31 * result + Arrays.hashCode(parameterTypes);
result = 31 * result + Arrays.hashCode(commands);
int result = hash(this.index, this.interfaceName, this.methodName, this.write);
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

equals() now compares parameterNames, but hashCode() doesn’t incorporate it; this violates the equals/hashCode contract and can cause incorrect behavior in hash-based collections/caches. Consider ensuring parameterNames contributes to hashCode() too.

Fix This in Augment

🤖 Was this useful? React with 👍 or 👎

cache(methodInfoCache, redisCommandMethod, methodInfo);
cache(methodInfoCache, methodId, methodInfo);
}

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When parameterNames is present, the code assumes its length matches parameterTypes.length; if it doesn’t, later indexing (parameterNames[i]) will throw ArrayIndexOutOfBoundsException. Consider guarding for length mismatches and falling back to buildParameterMetadataList(redisCommandMethod) for robustness.

Fix This in Augment

🤖 Was this useful? React with 👍 or 👎

README.md Outdated

## License

The Microsphere Spring is released under the [Apache License 2.0](https://www.apache.org/licenses/LICENSE-2.0).
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The license line says “Microsphere Spring”, but this repository is Microsphere Redis, so this project name appears inconsistent.

Fix This in Augment

🤖 Was this useful? React with 👍 or 👎

Changed the project name from 'Microsphere Spring' to 'Microsphere Redis' in the license section to accurately reflect the repository.
@sonarqubecloud
Copy link

@mercyblitz mercyblitz merged commit 1ef61b4 into release Dec 26, 2025
38 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants