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-475 - [BUG] Improve integration suite UAT actions error message. #477

Closed
BenTopping opened this issue Nov 26, 2024 · 3 comments · Fixed by sanger/sequencescape#4596 or sanger/sequencescape#4627
Assignees
Labels
Bug Something isn't working Integration Suite Enhancement OKR Label to identify work that is part of the integration suite enhancement OKR Size: S Small - low effort & risk Value: 2 Value to the institute is low

Comments

@BenTopping
Copy link

BenTopping commented Nov 26, 2024

Describe the bug
When running the integration suite in training we might get an error for work in progress pipelines where the plate purpose or some other data is missing in sequencescape when performing UAT actions. Currently this returns a 404 not found for the uat_actions sequencescape link. This is a misleading error message because the uat_actions URL exists but the post action has invalid data so it should be a 400.

An example of this is here:
Failures:

  1. Following the high throughput LCM Triomics DNA WGS and EMSeq pipeline LCM Triomics EMSeq submission
    Failure/Error: raise Failure, "Couldn't find action: #{url}, #{e.response.body}"
    UatAction::Failure:
    Couldn't find action: https://<training_sequencescape_url>/uat_actions, {"status":404,"error":"Not Found"}
    In this case the bad input is the plate purpose, which is currently WIP and therefore not added to the purpose configs.

RT Ticket Number
If applicable

To Reproduce
Steps to reproduce the behaviour:
Run an integration suite test with a 'generateplates' UAT action and pass it invalid data like an incorrect plate_purpose_name.

Expected behaviour
I should get a more descriptive 400 error saying the cause of the failure.

@BenTopping BenTopping added Bug Something isn't working Size: S Small - low effort & risk Value: 2 Value to the institute is low Integration Suite Enhancement OKR Label to identify work that is part of the integration suite enhancement OKR labels Nov 26, 2024
@psd-issuer psd-issuer bot changed the title [BUG] Improve integration suite UAT actions error message. Y24-475 - [BUG] Improve integration suite UAT actions error message. Nov 26, 2024
@BenTopping
Copy link
Author

Related to #460

@yoldas
Copy link
Member

yoldas commented Jan 9, 2025

Integration Suite PR: Y24-475 PR [Integration] bug improve integration suite uat actions error message
I have added a before hook to skip tests in the training environment if they are marked as wip.

@yoldas
Copy link
Member

yoldas commented Jan 14, 2025

Notes:

If the purpose for a new pipeline is not recorded in the database, typically happened in the training environment because of the WIP records not enabled, because the existing code did not check if the given purpose existed for the generateplates UAT action, the plate_purpose method raised ActiveRecord::RecordNotFound exception. The exception caused the 404 Not Found response to be returned. Adding validations to check if the plate purpose exists in the DB to add the error made the controller to return 422 Unprocessable Entity instead. The controller behaviour is to simply trying to return a report if the valid? and perform methods return true; otherwise return a hash with errors collection serialised into json.

The following example shows the fix for the generate plates UAT action. It sends and invalid plate purpose name and prints the response body; writes the status and response headers to response_headers.txt

% curl --dump-header response_headers.txt -X POST -H 'Accept: application/json' -H 'Content-Type: application/json' -d '{"plate_purpose_name": "INVALID PLATE PURPOSE", "plate_count": 1, "well_count": 24, "well_layout": "Column", "study_name": "UAT Study", "number_of_samples_in_each_well": 1}' 'http://localhost:3000/uat_actions?id=generateplates'

{"plate_purpose_name":["Plate purpose 'INVALID PLATE PURPOSE' does not exist."]}

% cat response_headers.txt

HTTP/1.1 422 Unprocessable Content
X-Frame-Options: SAMEORIGIN
X-XSS-Protection: 0
X-Content-Type-Options: nosniff
X-Download-Options: noopen
X-Permitted-Cross-Domain-Policies: none
Referrer-Policy: strict-origin-when-cross-origin
Content-Type: application/json; charset=utf-8
Cache-Control: no-cache
Content-Security-Policy-Report-Only: script-src 'self' https: 'unsafe-eval' http://localhost:3036 'nonce-k6myQxHhT4ENzayINkoBHA=='; style-src 'self' https: 'unsafe-inline'; connect-src 'self' ws://localhost:3036
X-Request-Id: 282155c2-d46a-487e-911c-1c4c8e3440f9
X-Runtime: 0.027382
vary: Accept, Origin
Set-Cookie: __profilin=p%3Dt; path=/; HttpOnly; SameSite=Lax
Transfer-Encoding: chunked

Most wip related issues cause failures for WIP pipelines at the start, either while generating a plate or doing a submission. Therefore, the next change to focus on is the test submission UAT action.

Validation examples:

% curl -X POST -H 'Accept: application/json' -H 'Content-Type: application/json' -d '{"submission_template_name": "Limber-Htp - LCM Triomics", "plate_barcode": "SQPD-9076-X", "library_type_name": "emSEQ"}' 'http://localhost:3000/uat_actions?id=testsubmission' {"plate_barcode":["Plate with barcode SQPD-9076-X does not exist."]}

% curl -X POST -H 'Accept: application/json' -H 'Content-Type: application/json' -d '{"submission_template_name": "Limber-Htp - LCM Triomics", "plate_purpose_name": "INVALID PLATE PURPOSE" , "library_type_name": "emSEQ"}' 'http://localhost:3000/uat_actions?id=testsubmission' {"plate_purpose_name":["Plate purpose 'INVALID PLATE PURPOSE' does not exist."]}

% curl -X POST -H 'Accept: application/json' -H 'Content-Type: application/json' -d '{"submission_template_name": "Limber-Htp - LCM Triomics", "plate_purpose_name": "LCMT LYSATE-INVALID" , "library_type_name": "emSEQ-INVALID"}' 'http://localhost:3000/uat_actions?id=testsubmission' {"plate_purpose_name":["Plate purpose 'LCMT LYSATE-INVALID' does not exist."],"library_type_name":["Library type 'emSEQ-INVALID' does not exist."]}

Updated the tube submission and the generate sample manifest UAT actions as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working Integration Suite Enhancement OKR Label to identify work that is part of the integration suite enhancement OKR Size: S Small - low effort & risk Value: 2 Value to the institute is low
Projects
None yet
2 participants