Skip to content

fix(cursor): make whatnext() consistent with next() at EOF#1540

Open
Aggarwalmansi wants to merge 182 commits intopostmanlabs:developfrom
Aggarwalmansi:fix/cursor-whatnext-eof
Open

fix(cursor): make whatnext() consistent with next() at EOF#1540
Aggarwalmansi wants to merge 182 commits intopostmanlabs:developfrom
Aggarwalmansi:fix/cursor-whatnext-eof

Conversation

@Aggarwalmansi
Copy link

Summary

whatnext() was returning a cursor state that does not occur in actual execution when reaching the final iteration.
This caused a mismatch between predictive (whatnext) and actual (next) behavior, leading to incorrect EOF signaling—especially for partitioned runs.

What was failing

A unit test in runner-cursor.test.js exposed that at the final position:

  • whatnext() predicted EOF
  • while next() did not yet signal EOF

This divergence caused incorrect cursor state prediction.

What changed

  • Preserve actual cursor position and iteration in whatnext()
  • Adjust EOF signaling only when partition cycles are active
  • No changes to next() or cursor mutation logic

Tests

  • Existing unit test failed before this change
  • All cursor-related tests now pass and predictive behavior matches runtime behavior

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants