fix(dispatcher): advance mint counter past caller-supplied IDs (#3126)
Closed
EL
2mo ago+104+104+012345678901234567890123456789-2-2-0123456789
Summary
When a caller supplies an integer request ID, the dispatcher's internal _next_id counter can mint the same value for a later request. The spec says IDs MUST NOT be reused within a session, so this is a correctness bug.
The fix eagerly advances _next_id to max(_next_id, supplied_id) in both JsonRpcDispatcher and DirectDispatcher. Two lines per dispatcher, no behavioral change for callers using string-only IDs.
Test plan
- 4 new regression tests (2 per dispatcher via
pair_factoryparametrization) - All 894 tests pass
- Covers both in-flight and completed caller-supplied ID scenarios
Fixes #3126