Skip to content

Conversation

@TreyE
Copy link
Contributor

@TreyE TreyE commented Dec 16, 2025

https://app.clickup.com/t/868gra3td


This pull request introduces several important updates focused on improving the reliability and consistency of AMQP message publishing by enabling publisher confirms throughout the codebase. Additionally, it upgrades Ruby to version 2.6.9 and updates related workflow and caching configurations. Below are the key changes grouped by theme:

AMQP Publisher Confirms and Reliability Improvements:

  • Added publisher confirms (confirm_select and wait_for_confirms) to AMQP publishing channels in lib/acapi/amqp/client.rb, lib/acapi/amqp/requestor.rb, lib/acapi/amqp/responder.rb, and lib/acapi/local_amqp_publisher.rb to ensure that messages are reliably published and acknowledged by the broker. [1] [2] [3] [4] [5] [6] [7]

  • Updated related specs in spec/lib/acapi/local_amqp_publisher_spec.rb to mock and test the new publisher confirm behavior. [1] [2]

Ruby Version and Workflow Updates:

  • Upgraded Ruby version from 2.6.6 to 2.6.9 in .ruby-version and updated the Ruby version in the GitHub Actions workflow (.github/workflows/tests.yml). [1] [2]
  • Updated the cache key in the workflow to match the new Ruby version and upgraded the cache action to actions/cache@v4.

Workflow Trigger Simplification:

  • Simplified the workflow trigger for .github/workflows/downstream.yml by removing the branches filter from workflow_dispatch, so it now only triggers on pushes to trunk.

Connection Handling Fix:

  • Improved connection handling in lib/acapi/requestor.rb to avoid unnecessary reconnections by checking if the Bunny connection is already established and connected before creating a new one.

@TreyE TreyE force-pushed the cu-868gra3td branch 3 times, most recently from d3880fc to 0b80688 Compare December 17, 2025 21:46
@saikumar9 saikumar9 requested a review from Copilot December 17, 2025 21:58
Copy link

Copilot AI left a comment

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 adds publisher confirms support for RabbitMQ quorum queues, ensuring message delivery reliability through the publisher confirms pattern. The changes include creating separate publishing channels with confirm mode enabled, along with Ruby version updates and security dependency patches.

  • Implements publisher confirms by calling confirm_select on publishing channels and wait_for_confirms after each publish operation
  • Updates Ruby version from 2.6.6 to 2.6.9 for better stability and security
  • Upgrades critical dependencies (nokogiri, loofah, crass) to address security vulnerabilities

Reviewed changes

Copilot reviewed 9 out of 10 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
lib/acapi/local_amqp_publisher.rb Creates separate @p_channel for publishing with confirm_select enabled; adds wait_for_confirms after publish
lib/acapi/amqp/responder.rb Adds confirm_select and wait_for_confirms to response exchange within with_response_exchange method
lib/acapi/amqp/requestor.rb Creates dedicated p_channel for publishing with confirms; properly closes channel in ensure block
lib/acapi/amqp/client.rb Establishes @republish_channel with confirms for redelivery scenarios
lib/acapi/requestor.rb Improves connection check to verify both presence and connected status
spec/lib/acapi/local_amqp_publisher_spec.rb Adds mocks for confirm_select and wait_for_confirms; changes create_channel expectation to allow for multiple channel creation
.ruby-version Updates Ruby version from 2.6.6 to 2.6.9
.github/workflows/tests.yml Updates Ruby version to 2.6.9 and upgrades actions/cache from v1 to v4
.github/workflows/downstream.yml Removes branches filter from workflow_dispatch to allow manual runs from any branch
Gemfile.lock Updates security-critical dependencies: crass, loofah, nokogiri, and adds racc

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

@saikumar9 saikumar9 marked this pull request as draft January 7, 2026 20:39
@TreyE TreyE force-pushed the cu-868gra3td branch 2 times, most recently from 38fa31d to d417ae8 Compare January 22, 2026 16:43
@TreyE TreyE requested a review from Copilot January 22, 2026 16:44
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 21 out of 22 changed files in this pull request and generated 4 comments.


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

Comment on lines 67 to 77
def open_connection_if_needed
return if @connection.present? && @connection.connected?
@connection = Bunny.new
@connection = Bunny.new(connection_url)
@connection.start
@channel = @connection.create_channel
@queue = @channel.queue(QUEUE_NAME, {:durable => true})
@exchange = @channel.fanout(EXCHANGE_NAME, {:durable => true})
@p_channel = @connection.create_channel
@p_channel.confirm_select
@exchange = @p_channel.fanout(EXCHANGE_NAME, {:durable => true})
@queue.bind(@exchange, {})
end
Copy link

Copilot AI Jan 22, 2026

Choose a reason for hiding this comment

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

The disconnect method doesn't clean up the new @p_channel instance variable introduced in this PR. When disconnect is called, @p_channel should also be set to nil to prevent potential issues on reconnection. Additionally, @channel and @eXchange should also be cleared to maintain consistency.

Copilot uses AI. Check for mistakes.
@ideacrew ideacrew deleted a comment from Copilot AI Jan 22, 2026
@ideacrew ideacrew deleted a comment from Copilot AI Jan 22, 2026
@ideacrew ideacrew deleted a comment from Copilot AI Jan 22, 2026
@ideacrew ideacrew deleted a comment from Copilot AI Jan 22, 2026
@ideacrew ideacrew deleted a comment from Copilot AI Jan 22, 2026
@ideacrew ideacrew deleted a comment from Copilot AI Jan 22, 2026
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 21 out of 22 changed files in this pull request and generated 3 comments.


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

Comment on lines +36 to +37
@connection = Bunny.new(@uri)
@connection.start
Copy link

Copilot AI Jan 22, 2026

Choose a reason for hiding this comment

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

The parameter name uri is misleading. After the changes in lib/acapi/railties/amqp_configuration_options.rb, the boot_requestor method now passes setting.to_connection_settings (a hash) instead of a URI string. The parameter should be renamed to something like connection_settings or connection_params to better reflect that it now receives a hash rather than a URI string.

Copilot uses AI. Check for mistakes.
Comment on lines 46 to 52
allow(session).to receive(:create_channel).and_return(channel)
allow(channel).to receive(:queue).with(forwarding_queue_name, {:durable => true}).and_return(queue)
allow(channel).to receive(:fanout).with(forwarding_exchange_name, {:durable => true}).and_return(exchange)
allow(channel).to receive(:confirm_select)
allow(channel).to receive(:wait_for_confirms).and_return(true)
allow(queue).to receive(:bind).with(exchange, {})
end
Copy link

Copilot AI Jan 22, 2026

Choose a reason for hiding this comment

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

The test setup does not accurately mock the dual-channel architecture introduced in the code changes. The updated implementation creates two separate channels (one for consuming, one for publishing with confirms), but the test mock returns the same channel instance for both calls to create_channel. While the test may still pass, it doesn't properly validate that two distinct channels are being used. Consider creating two separate channel mocks to accurately test this behavior.

Copilot uses AI. Check for mistakes.
Comment on lines +152 to 155
allow(session).to receive(:create_channel).and_return(channel)
expect(channel).to receive(:queue).with(forwarding_queue_name, {:durable=> true}).and_return(queue)
expect(channel).to receive(:fanout).with(forwarding_exchange_name, {:durable => true}).and_return(exchange)
expect(queue).to receive(:bind).with(exchange, {})
Copy link

Copilot AI Jan 22, 2026

Choose a reason for hiding this comment

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

The test setup does not accurately mock the dual-channel architecture. Similar to the main test setup, this test returns the same channel instance for both calls to create_channel, when the implementation creates two distinct channels. Consider creating separate channel mocks to properly test the dual-channel publishing behavior.

Copilot uses AI. Check for mistakes.
@TreyE TreyE added the enhancement New feature or request label Jan 22, 2026
@TreyE TreyE marked this pull request as ready for review January 22, 2026 19:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants