Skip to content

Node SDK: delete segments count limit and error message don't match the server #4850

Open

Description

@armnkumar321-spec

Bug description

serializeSegmentsParams in foreign/node/src/wire/segment/segment.utils.ts rejects a segments count below 1 or above 1000. The server doesn't enforce that range: DeleteSegments::validate in core/common/src/http/segments/delete_segments.rs returns Ok(()) for any u32. The doc comment on segments_count in the same file says "max value is 1000", so the docs and the server disagree as well.

The Node error message is also wrong. It says Topic partition_count must be between 1 and 1000, copied from the partition code, but the check is on segmentsCount.

To decide:

  • the valid range: enforce 1..=1000 on the server, or drop the cap in the Node SDK and fix the doc comment
  • change the Node message to name segments_count

Found while adding tests in #4829, which currently pin the 1..=1000 range.

Affected area / component

Node SDK

Activity

  1. added
    bug
    sdk
    javascript
    on Nov 11, 2026
  2. Abhishekpandey123-git commented on Nov 12, 2026

    @Abhishekpandey123-git

    Hi @justinmclean, I'd like to work on this issue.

    I've looked at the inconsistency between the Node SDK validation and the server-side DeleteSegments::validate() behavior. I can take care of:

    • resolving the intended segments_count contract between the SDK, server, and documentation;
    • fixing the Node SDK error message so it correctly refers to segments_count;
    • adding/updating regression tests for the boundary cases;
    • updating the relevant documentation/comments if required.

    I’m happy to take this on if it’s available. Please assign it to me.

  3. biswaskunu commented on Nov 13, 2026

    @biswaskunu

    Hi! I'd be interested in contributing to this issue.

    I've inspected serializeSegmentsParams and the server-side DeleteSegments::validate() implementation. I agree that the current behaviour is inconsistent, particularly because the Node SDK enforces a limit that the server doesn't.

    Before proposing a change, I'd like to confirm the intended contract: should the server enforce the 1..=1000 range or should the Node SDK accept the full u32 range and update the documentation accordingly?

    I can take care of the agreed implementation, correcting the validation message and adding regression tests. Would it be okay for me to work on this?

  4. justinmclean commented on Nov 15, 2026

    @justinmclean
    Member

    Thanks both. I have assigned this to @Abhishekpandey123-git, who asked first.

  5. biswaskunu commented on Nov 16, 2026

    @biswaskunu
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

bugjavascriptsdk

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions