Skip to content

Add JCStress tests for message queue clearing before nextQueued()#1140

Draft
Copilot wants to merge 8 commits intomasterfrom
copilot/add-stress-test-for-message-queue
Draft

Add JCStress tests for message queue clearing before nextQueued()#1140
Copilot wants to merge 8 commits intomasterfrom
copilot/add-stress-test-for-message-queue

Conversation

Copy link
Contributor

Copilot AI commented Feb 15, 2026

Adds stress tests validating that messages cleared via SequenceReset-GapFill are not subsequently processed by nextQueued(). Related to PR #1133's queue clearing behavior.

Implementation

Two JCStress test classes (332 configurations total):

  • ClearBeforeNextQueuedTest: Tests execution ordering between processNextQueued() and dequeueMessagesUpTo(). Validates that messages are either cleared OR processed, never both.

  • MultipleSequenceResetTest: Tests multiple concurrent dequeueMessagesUpTo() calls with different sequence numbers to verify queue consistency.

Design notes:

  • Synchronized methods respect InMemoryMessageQueue's single-threaded contract ("The map should be accessed from a single thread")
  • AtomicInteger tracks processed messages across actor executions
  • All sequence numbers extracted to constants (MIN_SEQ_NUM=5, MAX_SEQ_NUM=9, CLEAR_ALL_SEQ_NUM=10)

Test validation

Pre-populates queue with 5 messages (seqnum 5-9). Actor orderings tested:

  • Clear-then-process: 0 processed, 0 queued
  • Process-then-clear: 1-5 processed, 0 queued
  • Partial orderings: N processed, 0 queued where N < 5

All outcomes verify queue is empty post-execution with no messages lost or double-processed.


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI changed the title [WIP] Add stress test for clearing messages from queue Add JCStress tests for message queue clearing before nextQueued() Feb 15, 2026
Copilot AI requested a review from chrjohn February 15, 2026 15:24
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.

2 participants