Repository navigation
fix(node): align delete segments count validation - #4961
Abhishekpandey123-git wants to merge 3 commits into
Conversation
|
Thanks for the PR. It is labeled If AI assistance was used to create this PR, you are required to run the Slash commands (own line, regular comment) move it around the queue:
See CONTRIBUTING.md for details. |
Codecov Report✅ All modified and coverable lines are covered by tests. ❌ Your patch check has failed because the patch coverage (0.00%) is below the target coverage (50.00%). You can increase the patch coverage or adjust the target coverage. Additional details and impacted files
🚀 New features to boost your workflow:
|
|
Thanks @Abhishekpandey123-git, and welcome. |
|
|
||
| if (segmentsCount < 1 || segmentsCount > 1000) | ||
| throw new Error('Topic partition_count must be between 1 and 1000'); | ||
| if (segmentsCount < 1) |
There was a problem hiding this comment.
warning: writeUInt32LE truncates newly accepted fractional counts above 1,000, so the server receives a different delete count. require Number.isInteger(segmentsCount) before encoding.
| }); | ||
|
|
||
| it('allow segments count > 1000', () => { | ||
| assert.doesNotThrow( |
There was a problem hiding this comment.
warning: this test passes even if the request encodes a different count. assert the last four bytes encode 1001 in little-endian order.
|
|
||
| it('throw on segments count < 1', () => { | ||
| assert.throws( | ||
| () => serializeSegmentsParams(2, 1, 1, 0), |
There was a problem hiding this comment.
warning: the server accepts zero as a no-op, while this new test requires the SDK to reject it. cover the zero-count behavior in a follow-up so the SDK matches the server.
Summary
Fix the inconsistency between the Node SDK and server behavior for
segmentsCountinDeleteSegments.Changes
1000forsegmentsCount.segmentsCount.1000.segmentsCount < 1segmentsCount > 1000Testing
segment.utils.test.ts— 3/3 passedpartition.utils.test.ts— 3/3 passedFixes #4850