You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iggy.apache.org by "oscarArismendi (via GitHub)" <gi...@apache.org> on 2026/04/27 03:34:22 UTC

[PR] deserialize void response now ignores payload length for all void commands [iggy]

oscarArismendi opened a new pull request, #3182:
URL: https://github.com/apache/iggy/pull/3182

   ## Which issue does this PR close?
   
   Closes #3128
   
   ## Rationale
   
   The issue reported that `deserializeVoidResponse` had been changed from `status === 0 && data.length === 0` to just `status === 0,` removing the protocol safety check for void commands. However, when I inspected the current code, the `data.length === 0 `check was already present. Tracing further up the call chain, I found the real root cause: `handleResponse` was using` r.subarray(8)` to slice the payload, ignoring the length field the server sends. This meant data could include trailing bytes from the next response in the buffer, making the `data.length === 0` check unreliable regardless of whether it was there or not. `SendMessages` was a separate problem, it used `deserializeVoidResponse` even though the server returns a non-empty payload for that command. Instead of weakening the global void check to accommodate it, it now has its own `deserializeStatusResponse` that only checks `status === 0`
   
   ## What changed?
   
   `handleResponse` in `client.utils.ts `was using `r.subarray(8)` to slice the payload, ignoring the length field the server sends. This meant data could include trailing bytes from the next response in the buffer.
   
   `SendMessages` was using `deserializeVoidResponse` which checks `data.length === 0` even though the server returns a non-empty payload for that command. Instead of weakening the global void check, it now has its own `deserializeStatusResponse` that only checks `status === 0`.
   
   ## Local Execution
   
   Unit (npm run test:unit) — all pass. Two new test suites were added to client.utils.test.ts:
   
   `handleResponse`: proves that with` length=0` and trailing bytes, data is now empty
   `deserializeStatusResponse`: proves it returns true with non-empty data (key difference from `deserializeVoidResponse`)
   A deserialize block was also added to send-messages.command.test.ts proving SendMessages accepts non-empty server payloads.
   
   <details><summary>Unit test screenshot</summary>
   <p>
   <img width="1813" height="839" alt="Screenshot 2026-04-26 at 7 47 26 PM" src="https://github.com/user-attachments/assets/26a5965d-3a89-4c78-970a-27bfd4c4272e" />
   </p>
   </details> 
   
   E2E (npm run test:e2e) — 57/58 pass. The one failure (`getClusterMetadata`) is pre-existing and unrelated, it expects a 2-node cluster which requires` IGGY_CLUSTER_ENABLED=true` and two running server instances, matching how CI runs it. The TLS test is skipped locally for the same infrastructure reason.
   
   <details><summary>E2E test screenshot</summary>
   <p>
   <img width="1842" height="821" alt="Screenshot 2026-04-26 at 9 01 36 PM" src="https://github.com/user-attachments/assets/d38ec25a-3671-4842-9d4d-162ef1818c58" />
   </p>
   </details> 
   
   BDD (`npm run test:bdd`) the main scenario (`Create stream and send messages`) initially failed because stream IDs were hardcoded as `0` in the step definitions instead of using the dynamically assigned IDs from the server. This was fixed by using `this.stream.id `and` this.topic.id` in the step implementations, and making the Given I have no streams in the system step delete any existing streams before asserting a clean state. The scenario now passes end-to-end, including `SendMessages` against a real server. Four cluster/leader redirection scenarios remain undefined, their step definitions don't exist yet in any SDK.
   
   <details><summary>BDD test screenshot</summary>
   <p>
   <img width="1827" height="836" alt="Screenshot 2026-04-26 at 9 27 54 PM" src="https://github.com/user-attachments/assets/d324e56a-d097-4ec1-9438-a4b1d7f23b54" />
   </p>
   </details> 
   
   ## AI Usage
   
   If AI tools were used, please answer:
   1. Which tools? **Claude (claude.ai/code)**
   2. Scope of usage? **Used for codebase exploration, understanding the binary protocol and TCP buffer framing, writing unit tests**
   3. How did you verify the generated code works correctly? **Tests were run locally against a real iggy server built from source. Unit tests were written first to prove the bug, then the fix was applied to make them pass. E2E and BDD tests were run against a locally compiled server**
   4. Can you explain every line of the code if asked? **Yes**
   
   ## Notes
   During investigation I initially assumed SendMessages required a dedicated deserializer because the server might return a non-empty response payload, the [CreateMessage type has a payload field](https://github.com/oscarArismendi/iggy/blob/fix%2FdeserializeVoidResponse-now-ignores-payload-length-for-all-void-commands/foreign/node/src/wire/message/message.utils.ts#L40-L47), which led to some confusion and the issue description appear to be pointing in that direction as well. However, that payload is the outgoing message content sent in the request, not the server response.
   
   Both the Rust server source ([send_empty_ok_response() in send_messages_handler.rs](https://github.com/oscarArismendi/iggy/blob/fix%2FdeserializeVoidResponse-now-ignores-payload-length-for-all-void-commands/core/server/src/binary/handlers/messages/send_messages_handler.rs#L202-L203)) and live debug logs (`ONDATA object true 8 false` exactly 8 bytes = 4 status + 4 length, zero payload) confirm the response is always empty. With handleResponse correctly bounding data by length, `SendMessages` would work fine with `deserializeVoidResponse`.
   
   `deserializeStatusResponse` was kept as a defensive measure in case server behaviour changes in the future, but it is not strictly necessary given the current implementation, just let me know if I should removed it.
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@iggy.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] fix(node): deserialize void response now ignores payload length for all void commands [iggy]

Posted by "T1B0 (via GitHub)" <gi...@apache.org>.
T1B0 commented on code in PR #3182:
URL: https://github.com/apache/iggy/pull/3182#discussion_r3181407847


##########
foreign/node/src/bdd/stream.ts:
##########
@@ -52,3 +52,11 @@ Then(
     assert.ok(await this.client.stream.delete({streamId}));
   }
 );
+
+After(async function (this: TestWorld) {

Review Comment:
   this cleanup should not be part of this MR. at the moment we restart a server with --fresh arg to ensure a clean state. bdd test could create other object not cleaned up by this too (users, tokens ...). i think one way to really fix this for all SDK would be to add a deleting/cleaning BDD test and play it at the end, but it's outside of this issue/MR scope. 



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@iggy.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] deserialize void response now ignores payload length for all void commands [iggy]

Posted by "hubcio (via GitHub)" <gi...@apache.org>.
hubcio commented on PR #3182:
URL: https://github.com/apache/iggy/pull/3182#issuecomment-4325749303

   @T1B0 mind taking a look?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@iggy.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] fix(node): deserialize void response now ignores payload length for all void commands [iggy]

Posted by "oscarArismendi (via GitHub)" <gi...@apache.org>.
oscarArismendi commented on PR #3182:
URL: https://github.com/apache/iggy/pull/3182#issuecomment-4384822042

   @T1B0  reverted BDD changes


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@iggy.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] fix(node): deserialize void response now ignores payload length for all void commands [iggy]

Posted by "oscarArismendi (via GitHub)" <gi...@apache.org>.
oscarArismendi commented on code in PR #3182:
URL: https://github.com/apache/iggy/pull/3182#discussion_r3175272460


##########
foreign/node/src/bdd/message.ts:
##########
@@ -34,15 +34,15 @@ When(
   async function (
     this: TestWorld,
     msgCount: number,
-    streamId: number,
-    topicId: number,
+    _streamId: number,

Review Comment:
   I prefixed it to indicate to [TypeScript that it’s an unused/ignored variable](https://www.typescriptlang.org/tsconfig/#noUnusedParameters). Because while running the tests and investigating why they were failing, I realized the server assigns these values at runtime. You can verify this by going to the main branch and changing the last test in basic_messaging.feature to use a different streamId, the tests will fail, but in this branch they would pass



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@iggy.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] fix(node): deserialize void response now ignores payload length for all void commands [iggy]

Posted by "oscarArismendi (via GitHub)" <gi...@apache.org>.
oscarArismendi commented on PR #3182:
URL: https://github.com/apache/iggy/pull/3182#issuecomment-4361758596

   > i get the limiting buffer size part it's probably safer this way, and the client test is definitly a nice addition ! i don't understand why this MR touch the bdd test, it seems unrelated to the fix part or i'm missing something ?
   
   @T1B0 I modified the BDD scenarios since` basic_messaging.feature` helps confirm that the changes didn’t alter behavior. I’ve added context in the other threads, but I can revert them if it’s too much for one MR


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@iggy.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] fix(node): deserialize void response now ignores payload length for all void commands [iggy]

Posted by "T1B0 (via GitHub)" <gi...@apache.org>.
T1B0 commented on code in PR #3182:
URL: https://github.com/apache/iggy/pull/3182#discussion_r3181421608


##########
foreign/node/src/bdd/message.ts:
##########
@@ -34,15 +34,15 @@ When(
   async function (
     this: TestWorld,
     msgCount: number,
-    streamId: number,
-    topicId: number,
+    _streamId: number,

Review Comment:
   honestly it's not really clear either. we should either keep the original name or remove the arguments. maybe a comment/warning would be more appropriate ?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@iggy.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] fix(node-sdk): deserialize void response now ignores payload length for all void commands [iggy]

Posted by "T1B0 (via GitHub)" <gi...@apache.org>.
T1B0 commented on code in PR #3182:
URL: https://github.com/apache/iggy/pull/3182#discussion_r3163053452


##########
foreign/node/src/bdd/message.ts:
##########
@@ -34,15 +34,15 @@ When(
   async function (
     this: TestWorld,
     msgCount: number,
-    streamId: number,
-    topicId: number,
+    _streamId: number,

Review Comment:
   even if you use this.stream.id over argument i don't see why prefixing with "_" 



##########
foreign/node/src/bdd/stream.ts:
##########
@@ -23,7 +23,10 @@ import { Given, When, Then } from "@cucumber/cucumber";
 import type { TestWorld } from './world.js';
 
 Given('I have no streams in the system', async function (this: TestWorld) {
-  assert.deepEqual([], await this.client.stream.list());
+  const streams = await this.client.stream.list();

Review Comment:
   i don't understand the point of this change, it used to assert now it delete ? are you fixing the fact that you can't run bdd test twice without restart server because a fresh state is needed ?



##########
foreign/node/src/wire/message/send-messages.command.ts:
##########
@@ -21,7 +21,7 @@
 import { type Id } from '../identifier.utils.js';
 import { serializeSendMessages, type CreateMessage } from './message.utils.js';
 import type { Partitioning } from './partitioning.utils.js';
-import { deserializeVoidResponse } from '../../client/client.utils.js';
+import {deserializeStatusResponse, deserializeVoidResponse} from '../../client/client.utils.js';

Review Comment:
   clean up deserializeVoidResponse from import 



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@iggy.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] fix(node): deserialize void response now ignores payload length for all void commands [iggy]

Posted by "T1B0 (via GitHub)" <gi...@apache.org>.
T1B0 commented on PR #3182:
URL: https://github.com/apache/iggy/pull/3182#issuecomment-4381894352

   re-reading this, i think this part "[BDD test] initially failed because stream IDs were hardcoded as 0 in the step definitions instead of using the dynamically assigned IDs from the server." is the base of the misunderstanding: stream/topics ID are not hardcoded, they are defined by bdd test scenario and passed as those arguments you prefixed. at the moment BDD test just expect a fresh server (you can restart your iggy server with --fresh opt to do so) so they'll fail if you run them twice without a fresh restart between each runs. 
   I think this concern should be another issue/MR subject and we should see with @hubcio about how it should be addressed - probably across all sdks.
   
   Can we just revert the bdd/ part and LGTM ?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@iggy.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] fix(node): deserialize void response now ignores payload length for all void commands [iggy]

Posted by "hubcio (via GitHub)" <gi...@apache.org>.
hubcio merged PR #3182:
URL: https://github.com/apache/iggy/pull/3182


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@iggy.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] fix(node): deserialize void response now ignores payload length for all void commands [iggy]

Posted by "oscarArismendi (via GitHub)" <gi...@apache.org>.
oscarArismendi commented on code in PR #3182:
URL: https://github.com/apache/iggy/pull/3182#discussion_r3175262911


##########
foreign/node/src/bdd/stream.ts:
##########
@@ -23,7 +23,10 @@ import { Given, When, Then } from "@cucumber/cucumber";
 import type { TestWorld } from './world.js';
 
 Given('I have no streams in the system', async function (this: TestWorld) {
-  assert.deepEqual([], await this.client.stream.list());
+  const streams = await this.client.stream.list();

Review Comment:
    Yes, my tests were failing because I needed a fresh state. On second thought, I may have gone overboard by adding the delete step in the Given and changing its behavior, using an `After` hook might be a better approach. I’ve updated it in[ my latest commit](https://github.com/apache/iggy/pull/3182/changes/11990e3dfc27e22a1f62e464e6c0e8830c2fab71#diff-6101ebb91c527c6adc0d2df5c01b26213bccdcb26f277810fbe32472602b31d1R56-R62), let me know what you think



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@iggy.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] fix(node): deserialize void response now ignores payload length for all void commands [iggy]

Posted by "oscarArismendi (via GitHub)" <gi...@apache.org>.
oscarArismendi commented on code in PR #3182:
URL: https://github.com/apache/iggy/pull/3182#discussion_r3175274412


##########
foreign/node/src/wire/message/send-messages.command.ts:
##########
@@ -21,7 +21,7 @@
 import { type Id } from '../identifier.utils.js';
 import { serializeSendMessages, type CreateMessage } from './message.utils.js';
 import type { Partitioning } from './partitioning.utils.js';
-import { deserializeVoidResponse } from '../../client/client.utils.js';
+import {deserializeStatusResponse, deserializeVoidResponse} from '../../client/client.utils.js';

Review Comment:
   Done



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@iggy.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] deserialize void response now ignores payload length for all void commands [iggy]

Posted by "codecov[bot] (via GitHub)" <gi...@apache.org>.
codecov[bot] commented on PR #3182:
URL: https://github.com/apache/iggy/pull/3182#issuecomment-4325265748

   ## [Codecov](https://app.codecov.io/gh/apache/iggy/pull/3182?dropdown=coverage&src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) Report
   :white_check_mark: All modified and coverable lines are covered by tests.
   :white_check_mark: Project coverage is 72.58%. Comparing base ([`868ae62`](https://app.codecov.io/gh/apache/iggy/commit/868ae629678650f7dd6b5e81d65651a1906fac7d?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)) to head ([`c4f9f73`](https://app.codecov.io/gh/apache/iggy/commit/c4f9f73a755b56130d0d5d2e3c154f211ff43402?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)).
   
   <details><summary>Additional details and impacted files</summary>
   
   
   
   ```diff
   @@             Coverage Diff              @@
   ##             master    #3182      +/-   ##
   ============================================
   - Coverage     73.64%   72.58%   -1.06%     
     Complexity      943      943              
   ============================================
     Files          1141     1078      -63     
     Lines        100869    96065    -4804     
     Branches      78044    77956      -88     
   ============================================
   - Hits          74285    69730    -4555     
   + Misses        23928    23676     -252     
   - Partials       2656     2659       +3     
   ```
   
   | [Components](https://app.codecov.io/gh/apache/iggy/pull/3182/components?src=pr&el=components&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Coverage Δ | |
   |---|---|---|
   | [Rust Core](https://app.codecov.io/gh/apache/iggy/pull/3182/components?src=pr&el=component&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `74.61% <ø> (ø)` | |
   | [Java SDK](https://app.codecov.io/gh/apache/iggy/pull/3182/components?src=pr&el=component&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `62.30% <ø> (ø)` | |
   | [C# SDK](https://app.codecov.io/gh/apache/iggy/pull/3182/components?src=pr&el=component&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `69.40% <ø> (ø)` | |
   | [Python SDK](https://app.codecov.io/gh/apache/iggy/pull/3182/components?src=pr&el=component&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `81.43% <ø> (ø)` | |
   | [Node SDK](https://app.codecov.io/gh/apache/iggy/pull/3182/components?src=pr&el=component&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `87.48% <100.00%> (-4.05%)` | :arrow_down: |
   | [Go SDK](https://app.codecov.io/gh/apache/iggy/pull/3182/components?src=pr&el=component&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `39.41% <ø> (ø)` | |
   
   | [Files with missing lines](https://app.codecov.io/gh/apache/iggy/pull/3182?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Coverage Δ | |
   |---|---|---|
   | [foreign/node/src/client/client.utils.ts](https://app.codecov.io/gh/apache/iggy/pull/3182?src=pr&el=tree&filepath=foreign%2Fnode%2Fsrc%2Fclient%2Fclient.utils.ts&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-Zm9yZWlnbi9ub2RlL3NyYy9jbGllbnQvY2xpZW50LnV0aWxzLnRz) | `73.52% <100.00%> (-16.37%)` | :arrow_down: |
   | [...ign/node/src/wire/message/send-messages.command.ts](https://app.codecov.io/gh/apache/iggy/pull/3182?src=pr&el=tree&filepath=foreign%2Fnode%2Fsrc%2Fwire%2Fmessage%2Fsend-messages.command.ts&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-Zm9yZWlnbi9ub2RlL3NyYy93aXJlL21lc3NhZ2Uvc2VuZC1tZXNzYWdlcy5jb21tYW5kLnRz) | `100.00% <100.00%> (ø)` | |
   
   ... and [80 files with indirect coverage changes](https://app.codecov.io/gh/apache/iggy/pull/3182/indirect-changes?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
   </details>
   <details><summary> :rocket: New features to boost your workflow: </summary>
   
   - :snowflake: [Test Analytics](https://docs.codecov.com/docs/test-analytics): Detect flaky tests, report on failures, and find test suite problems.
   - :package: [JS Bundle Analysis](https://docs.codecov.com/docs/javascript-bundle-analysis): Save yourself from yourself by tracking and limiting bundle sizes in JS merges.
   </details>


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@iggy.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org