feat: change primitives - #181
Conversation
There was a problem hiding this comment.
Pull request overview
This PR changes the primitive types of several sharding/message config fields in the shared optimum-common library: RandomMessageSize and ShardFactor move from int64 to uint32, and PublisherShardMultiplier and ForwardShardThreshold move from float32 to float64. These changes are applied consistently across OptimumConfig and DynamicConfig, and two new hash helpers (WriteFloat64, WriteUint32) are added so HashRemoteConfig can hash the new types. The config loader already supports uint*/float64 kinds, so defaults/env/flag parsing continues to work.
Changes:
- Switch four coding/message config fields to
uint32/float64in bothOptimumConfigandDynamicConfig. - Add
WriteUint32andWriteFloat64hash helpers and use them inHashRemoteConfig. - Update tests (type assertions in
ToMap, and regenerated SHA-256 hash expectations).
Note: because these are exported fields of a shared "common" package, the type change is a breaking API change for any downstream consumer that references them as int64/float32; ensure dependents are updated in lockstep.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| pkg/hash/hashutil.go | Adds WriteFloat64 and WriteUint32 helpers (missing doc comments). |
| pkg/entities/opt_p2p.go | Changes four OptimumConfig field types to uint32/float64. |
| pkg/entities/opt_p2p_test.go | Updates type assertions to match new field types. |
| pkg/entities/dynamic_config.go | Changes matching DynamicConfig field types and updates HashRemoteConfig to use new helpers. |
| pkg/entities/dynamic_config_test.go | Updates ToMap type assertions and regenerated hash expectations. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository: getoptimum/coderabbit/.coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughThe change updates four configuration fields from signed integers and single-precision floats to Estimated code review effort: 2 (Simple) | ~10 minutes Mergeability Score: ⚪ Minimal · up to The change is limited to primitive-related updates and no actionable merge-blocking risk remains after normal checks and review. Suggested reviewers: 🚥 Pre-merge checks | ✅ 6 | ❌ 3❌ Failed checks (3 warnings)
✅ Passed checks (6 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
Summary by CodeRabbit
New Features
Bug Fixes