Skip to content

fix: refactored the query to filter out duplicate integration rows - #806

Merged
Saup21 merged 7 commits into
masterfrom
fix/PACT-4071-filtered-integrations-showing-duplicates
May 13, 2025
Merged

Saup21 merged 7 commits into
masterfrom
fix/PACT-4071-filtered-integrations-showing-duplicates

Conversation

@Saup21

@Saup21 Saup21 commented May 13, 2025

Copy link
Copy Markdown
Contributor

No description provided.

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 refactors the query in the Integration model to filter out duplicate integration rows while extending the test coverage in the integration spec.

  • Refactored the Integration#filter_by_pacticipant method to first retrieve matching pacticipant IDs and then filter integrations using an OR condition.
  • Expanded the integration_spec with new consumer/provider creation chains and added a context to verify matching integrations for a query that applies to both consumer and provider.

Reviewed Changes

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

File Description
spec/lib/pact_broker/integrations/integration_spec.rb Added additional integration creations and a new context to validate filtering behavior.
lib/pact_broker/integrations/integration.rb Updated the filtering logic to retrieve matching pacticipant IDs and apply the predicate via an OR condition.
Comments suppressed due to low confidence (2)

spec/lib/pact_broker/integrations/integration_spec.rb:53

  • Consider adding test cases where the query string matches only a consumer or only a provider to ensure the filtering behavior is comprehensive.
context "with a filter matching both consumer and provider of the same integration" do

lib/pact_broker/integrations/integration.rb:92

  • [nitpick] Consider using '.map(&:id)' instead of '.all.collect(&:id)' for brevity and clarity.
matching_pacticipant_ids = PactBroker::Domain::Pacticipant.filter(:name, query_string).select(:id).all.collect(&:id)

@pahnin pahnin left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM 🚢

@Saup21
Saup21 merged commit 7bff0f0 into master May 13, 2025
@Saup21
Saup21 deleted the fix/PACT-4071-filtered-integrations-showing-duplicates branch May 13, 2025 12:06
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.

3 participants