Skip to content

SPINEDEM-5945 Update sync-wrap to match /Patient/$process-birth-details#1271

Open
fabianmcgibbon wants to merge 19 commits intomasterfrom
famc2-SPINEDEM-5945-add-rate-limiting-for-create-patient-at-birth
Open

SPINEDEM-5945 Update sync-wrap to match /Patient/$process-birth-details#1271
fabianmcgibbon wants to merge 19 commits intomasterfrom
famc2-SPINEDEM-5945-add-rate-limiting-for-create-patient-at-birth

Conversation

@fabianmcgibbon
Copy link
Copy Markdown
Contributor

Summary

  • Routine Change
  • ❗ Breaking Change
  • 🤖 Operational or Infrastructure Change
  • ✨ New Feature
  • ⚠️ Potential issues that might be caused by this change

Add any other relevant notes or explanations here. Remove this line if you have nothing to add.

Reviews Required

  • Dev
  • Test
  • Tech Author
  • Product Owner

Review Checklist

ℹ️ This section is to be filled in by the reviewer.

  • I have reviewed the changes in this PR and they fill all or part of the acceptance criteria of the ticket, and the code is in a mergeable state.
  • If there were infrastructure, operational, or build changes, I have made sure there is sufficient evidence that the changes will work.

@github-actions
Copy link
Copy Markdown

This branch is working on a ticket in the NHS Digital APM JIRA Project. Here's a handy link to the ticket:

SPINEDEM-5945

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines:
Successfully started running 1 pipeline(s).

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines:
Successfully started running 1 pipeline(s).

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines:
Successfully started running 1 pipeline(s).

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines:
Successfully started running 1 pipeline(s).

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines:
Successfully started running 1 pipeline(s).

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines:
Successfully started running 1 pipeline(s).

Copy link
Copy Markdown

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

Extends the existing POST rate-limiting/spike-arrest behavior to also cover the /Patient/$process-birth-details endpoint, and updates functional + Karate tests/mocks to align with the new behavior.

Changes:

  • Apply the SpikeArrest.PatientCreate step to POST requests for both /Patient and /Patient/$process-birth-details.
  • Add a new pytest-bdd scenario + step for rate-limit testing of the record-at-birth endpoint, with some helper refactoring.
  • Harden Karate tests against transient 502s during retry, and update a record-at-birth mock OperationOutcome payload.

Reviewed changes

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

Show a summary per file
File Description
tests/functional/test_patient_create.py Adds a new pytest-bdd scenario/step for $process-birth-details and refactors the “post many times” helper.
tests/functional/features/post_patient.feature Adds a new Gherkin scenario to exercise spike-arrest on the record-at-birth endpoint.
proxies/live/apiproxy/targets/sync-wrap.xml Updates the Apigee condition to include /Patient/$process-birth-details for POST spike-arrest.
karate-tests/src/test/java/patients/healthcareWorker/updatePatientDetails/oasExamples.feature Adds retry-until handling for 502 responses in the background GET.
karate-tests/src/test/java/patients/common/createPatient.feature Updates retry-until conditions to also retry on 502.
karate-tests/src/test/java/mocks/stubs/postPdsRecordAtBirthResponses/new_pds_record_at_birth_out__of_range_mother_age.json Adds additional warning issues in the mocked OperationOutcome.
Comments suppressed due to low confidence (1)

tests/functional/test_patient_create.py:160

  • elapsed_time_req.seconds == 0 is a very brittle assertion here. timedelta.seconds truncates to whole seconds and is sensitive to crossing a second boundary, so this can fail even if requests are dispatched within <1s. Use elapsed_time_req.total_seconds() with an appropriate upper bound (e.g., < 1.0) or otherwise relax the check to avoid flakiness.
    request_times = [x['request_time'] for x in results]
    request_times.sort()
    elapsed_time_req = request_times[-1] - request_times[0]
    assert elapsed_time_req.seconds == 0


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

Comment thread tests/functional/test_patient_create.py Outdated
Comment thread tests/functional/test_patient_create.py
Comment thread tests/functional/features/post_patient.feature Outdated
@sonarqubecloud
Copy link
Copy Markdown

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