Skip to content

Fix memory stream Nack ordering#4694

Merged
asim merged 1 commit into
masterfrom
codex/increment-4693
Jul 11, 2026
Merged

Fix memory stream Nack ordering#4694
asim merged 1 commit into
masterfrom
codex/increment-4693

Conversation

@asim

@asim asim commented Jul 11, 2026

Copy link
Copy Markdown
Member

Summary

  • Serialize manual-ack memory stream delivery per subscriber so a nacked event is redelivered before later queued events.
  • Add coverage that publishes a third queued message and verifies the nacked message is seen again first.

Closes #4690
Closes #4693

Testing

  • go build ./...
  • go test ./events
  • go test ./... (fails in this environment: atlascloud stream conformance returns 400 and loopback grpc tests are blocked by envoy)
  • golangci-lint run ./... (fails in this environment: installed golangci-lint was built with Go 1.24 while module targets Go 1.25.12)

@asim asim added the codex label Jul 11, 2026
Copilot AI review requested due to automatic review settings July 11, 2026 12:01
@asim asim added the codex label Jul 11, 2026
@asim
asim merged commit 7c2d80a into master Jul 11, 2026
12 checks passed

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This pull request fixes an ordering bug in the in-memory events stream when using manual ack: a Nack() now forces the nacked event to be redelivered to the same subscriber before any later queued events are delivered. This aligns the memory stream behavior with the AckingNacking contract and prevents the race observed in CI.

Changes:

  • Serialize manual-ack delivery per subscriber by queueing published events and dispatching them via a single per-subscriber manual-ack loop.
  • Implement immediate redelivery on Nack() within the manual-ack delivery loop (rather than waiting for the ack-wait timeout tick).
  • Extend AckingNacking test coverage by publishing a third message and asserting it is only received after the nacked message is redelivered.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
events/memory.go Adds per-subscriber pending queue + notifier and a manual-ack dispatcher to ensure nacked events are redelivered before later queued events.
events/stream_test.go Strengthens the manual-ack ordering test by adding an additional queued publish and validating delivery order around Nack().

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Loop: build increment #199 Fix in-memory stream Nack redelivery ordering

3 participants