Added JetStreamConfig struct with configurable StreamRetention (default: 1 year) and ReplicaCount (default: 1)
Added HashRingConfig struct with configurable VirtualNodes (default: 150)
Added ShardConfig struct with configurable ShardCount (default: 1024) and ReplicationFactor (default: 1)
Each component has a new WithConfig constructor while maintaining backward compatibility with original constructors
Zero values in configs fall back to defaults for backward compatibility
Test plan
All existing tests pass with default configuration
New tests verify custom configuration works correctly
Tests verify zero-value configs use defaults
go build ./... and go vet ./... pass
Generated with Claude Code
Closes #38
## Summary
- Added `JetStreamConfig` struct with configurable `StreamRetention` (default: 1 year) and `ReplicaCount` (default: 1)
- Added `HashRingConfig` struct with configurable `VirtualNodes` (default: 150)
- Added `ShardConfig` struct with configurable `ShardCount` (default: 1024) and `ReplicationFactor` (default: 1)
- Each component has a new `WithConfig` constructor while maintaining backward compatibility with original constructors
- Zero values in configs fall back to defaults for backward compatibility
## Test plan
- [x] All existing tests pass with default configuration
- [x] New tests verify custom configuration works correctly
- [x] Tests verify zero-value configs use defaults
- [x] `go build ./...` and `go vet ./...` pass
Generated with Claude Code
Add config structs with sensible defaults for tunable parameters:
- JetStreamConfig for stream retention (1 year) and replica count (1)
- HashRingConfig for virtual nodes per physical node (150)
- ShardConfig for shard count (1024) and replication factor (1)
Each component gets a new WithConfig constructor that accepts custom
configuration, while the original constructors continue to work with
defaults. Zero values in configs fall back to defaults for backward
compatibility.
Closes#38
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This is an automated review generated by the code-reviewer agent.
Summary
This PR successfully makes configuration values injectable across JetStream, HashRing, and ShardManager components while maintaining full backward compatibility. The implementation is clean, well-tested, and follows Go conventions.
Findings
Code Quality
Excellent: Config structs are well-designed with clear field names and comments
Good practice: Zero-value fallback pattern (if config.Field == 0, use default) ensures backward compatibility
Consistent: All three components (JetStream, HashRing, ShardManager) follow the same config pattern
Clean: Added getter methods (GetVirtualNodes, GetShardCount, GetReplicationFactor) provide safe access to internal fields
Minor formatting: Good cleanup of whitespace and alignment issues throughout
Potential Bugs
No issues found. The implementation correctly handles:
Zero-value configs falling back to defaults
Legacy constructors still working via delegation to new config-based constructors
All edge cases covered in tests
Security Concerns
No security concerns identified. Configuration changes are purely structural and don't introduce new attack surfaces.
Style Notes
Consistent with codebase conventions
Good use of constants (DefaultVirtualNodes, DefaultNumShards, etc.) instead of magic numbers
Proper documentation comments for exported functions and types
The rename from NumShards/VirtualNodes to DefaultNumShards/DefaultVirtualNodes improves clarity
Test Coverage
Excellent coverage: New tests verify:
Custom configuration values work correctly
Zero-value configs use defaults
Legacy constructors still work
Different shard counts produce valid results
Tests in cluster/config_test.go and store/config_test.go are thorough and well-structured
All existing tests still pass, confirming backward compatibility
Verdict
LGTM
This PR achieves its goal of making configuration injectable while maintaining full backward compatibility. The code is well-tested, follows best practices, and integrates cleanly with the existing codebase. Ready to merge.
## AI Code Review
> This is an automated review generated by the code-reviewer agent.
### Summary
This PR successfully makes configuration values injectable across JetStream, HashRing, and ShardManager components while maintaining full backward compatibility. The implementation is clean, well-tested, and follows Go conventions.
### Findings
#### Code Quality
- **Excellent**: Config structs are well-designed with clear field names and comments
- **Good practice**: Zero-value fallback pattern (if config.Field == 0, use default) ensures backward compatibility
- **Consistent**: All three components (JetStream, HashRing, ShardManager) follow the same config pattern
- **Clean**: Added getter methods (GetVirtualNodes, GetShardCount, GetReplicationFactor) provide safe access to internal fields
- **Minor formatting**: Good cleanup of whitespace and alignment issues throughout
#### Potential Bugs
- No issues found. The implementation correctly handles:
- Zero-value configs falling back to defaults
- Legacy constructors still working via delegation to new config-based constructors
- All edge cases covered in tests
#### Security Concerns
- No security concerns identified. Configuration changes are purely structural and don't introduce new attack surfaces.
#### Style Notes
- Consistent with codebase conventions
- Good use of constants (DefaultVirtualNodes, DefaultNumShards, etc.) instead of magic numbers
- Proper documentation comments for exported functions and types
- The rename from NumShards/VirtualNodes to DefaultNumShards/DefaultVirtualNodes improves clarity
#### Test Coverage
- **Excellent coverage**: New tests verify:
- Custom configuration values work correctly
- Zero-value configs use defaults
- Legacy constructors still work
- Different shard counts produce valid results
- Tests in cluster/config_test.go and store/config_test.go are thorough and well-structured
- All existing tests still pass, confirming backward compatibility
### Verdict
**LGTM**
This PR achieves its goal of making configuration injectable while maintaining full backward compatibility. The code is well-tested, follows best practices, and integrates cleanly with the existing codebase. Ready to merge.
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Closes #38
Summary
JetStreamConfigstruct with configurableStreamRetention(default: 1 year) andReplicaCount(default: 1)HashRingConfigstruct with configurableVirtualNodes(default: 150)ShardConfigstruct with configurableShardCount(default: 1024) andReplicationFactor(default: 1)WithConfigconstructor while maintaining backward compatibility with original constructorsTest plan
go build ./...andgo vet ./...passGenerated with Claude Code
AI Code Review
Summary
This PR successfully makes configuration values injectable across JetStream, HashRing, and ShardManager components while maintaining full backward compatibility. The implementation is clean, well-tested, and follows Go conventions.
Findings
Code Quality
Potential Bugs
Security Concerns
Style Notes
Test Coverage
Verdict
LGTM
This PR achieves its goal of making configuration injectable while maintaining full backward compatibility. The code is well-tested, follows best practices, and integrates cleanly with the existing codebase. Ready to merge.