Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Y24-190: Use SS API v2 for searches #2169

Open
wants to merge 19 commits into
base: develop-Y24-190
Choose a base branch
from

Conversation

StephenHulme
Copy link
Contributor

@StephenHulme StephenHulme commented Jan 17, 2025

Closes #2171

Changes proposed in this pull request

  • Move the search endpoint over to V2
  • Remove unused reference to show_my_plates_only

Instructions for Reviewers

[All PRs] - Confirm PR template filled
[Feature Branches] - Review code
[Production Merges to main]
    - Check story numbers included
    - Check for debug code
    - Check version

@harrietc52 harrietc52 changed the title Y24-190: Use SSAPIv2 for searches Y24-190: Use SS API v2 for searches Jan 17, 2025
@StephenHulme StephenHulme linked an issue Jan 20, 2025 that may be closed by this pull request
Copy link

codecov bot commented Jan 24, 2025

Codecov Report

Attention: Patch coverage is 81.57895% with 7 lines in your changes missing coverage. Please review.

Project coverage is 80.79%. Comparing base (50e87dc) to head (5a24f13).

Files with missing lines Patch % Lines
app/sequencescape/sequencescape/api/v2/plate.rb 50.00% 7 Missing ⚠️
Additional details and impacted files
@@               Coverage Diff                @@
##           develop-Y24-190    #2169   +/-   ##
================================================
  Coverage            80.78%   80.79%           
================================================
  Files                  481      481           
  Lines                18167    18173    +6     
  Branches               269      269           
================================================
+ Hits                 14677    14683    +6     
  Misses                3488     3488           
  Partials                 2        2           
Flag Coverage Δ
javascript 74.23% <ø> (ø)
pull_request 80.79% <81.57%> (?)
push 80.79% <81.57%> (+<0.01%) ⬆️
ruby 91.31% <81.57%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

@harrietc52 harrietc52 left a comment

Choose a reason for hiding this comment

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

Really good :) nice work. Easy to follow and clean. Just a few thoughts and questions, feel free to ignore!

app/models/ongoing_plate.rb Show resolved Hide resolved
spec/controllers/searches_controller_spec.rb Show resolved Hide resolved
context 'without parameters' do
let(:search_parameters) do
{
states: %w[pending started passed qc_complete failed cancelled],
plate_purpose_uuids: %w[uuid-1 uuid-2],
show_my_plates_only: false,
Copy link
Contributor

Choose a reason for hiding this comment

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

As mentioned above, just checking show_my_plates_only has been removed because it is not needed anymore

page: 1
state: %w[pending started passed qc_complete failed cancelled],
purpose_name: %w[purpose-config minimal-purpose-config],
include_used: true
Copy link
Contributor

Choose a reason for hiding this comment

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

When include_used is true, is there anything else to check for?

Copy link
Contributor

Choose a reason for hiding this comment

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

Could us the total_count to check how many plates are returned

Copy link
Contributor

Choose a reason for hiding this comment

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

@harrietc52 looking into this

Copy link
Contributor

@harrietc52 harrietc52 Feb 4, 2025

Choose a reason for hiding this comment

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

@StephenHulme I’ve been looking into this, and I’m not sure if there is a way to access the total_count. It is added in the method which stubs find_all, and the Mock response doesnt have it in it, which I was expecting it too!

include_used: '1'
}
}
expect(expected_search).to have_been_made.once
expected_search.once
Copy link
Contributor

Choose a reason for hiding this comment

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

Again, maybe worth checking that the correct plate is returned (sorry know this work is just to update, not add!) just a thought :)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

As above, this might be hard to confirm without some non-trivial refactoring of the test. Would definitely be a good thing to check though! Possibly a GitHub Issue?

@@ -76,6 +76,8 @@
# Library request with primer panel information
factory :gbs_library_request do
primer_panel

after(:build) { |request, evaluator| request._cached_relationship(:primer_panel) { evaluator.primer_panel } }
Copy link
Contributor

Choose a reason for hiding this comment

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

Can see why this would be needed, just wondering how did it come about?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This was from the includes refactoring to make the ongoing plates & tubes load in under 60 seconds. The code works, but the test-suite doesn't really like how JSON-API handles relationships. Fortunately there was a note in the readme.

},
[associated(:tube, barcode_number: 2)]
{ page: 1, per_page: 30 },
Copy link
Contributor

Choose a reason for hiding this comment

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

Again, not 100%, but not sure whether we should be passing in per_page as this is a constant, so maybe if this was something other than 30, it would still return 30 because of the constant?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No, in this context the per_page: 30 is being used for incoming request recognition, rather than returning a hard-coded response. The mocking of the pagination response by the JsonApiClient is handled in stub_find_all_with_pagination.

spec/support/feature_helpers.rb Show resolved Hide resolved
if asset.is_a?(Array)
allow(Sequencescape::Api::V2::Labware).to receive(:find).with(barcode:).and_return(asset)
else
# TODO: Y24-190 to test
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this todo outstanding?

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