Skip to content

save close case response payload#283

Merged
ymhari merged 1 commit intotrunkfrom
close_case_868fg068b
Sep 23, 2025
Merged

save close case response payload#283
ymhari merged 1 commit intotrunkfrom
close_case_868fg068b

Conversation

@ymhari
Copy link
Copy Markdown
Contributor

@ymhari ymhari commented Sep 23, 2025

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

Summary by CodeRabbit

  • Bug Fixes

    • Improved reliability when closing verification cases by ensuring response data is saved before processing, reducing intermittent errors and improving audit traceability.
  • Tests

    • Updated test suite to use realistic XML response payloads and HTTP-style responses, enhancing accuracy and confidence in success handling at the request/response boundary.

@ymhari ymhari added the cr-120+ PRs associated with the CR-120+, QHP Application, or Eligibility 3.0 label Sep 23, 2025
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Sep 23, 2025

Walkthrough

Adds a save_response_payload method to persist VLP CloseCase XML on the response transaction and updates ApplicantRequest flow to save the payload immediately after creating the response transaction. Tests are updated to mock the request/response with concrete XML content and a Faraday::Response.

Changes

Cohort / File(s) Summary of Changes
ApplicantRequest flow update
app/operations/fdsh/ssa_vlp/rj3/vlp/close_case/applicant_request.rb
Adds save_response_payload(vlp_response) to store xml_payload on response transaction with error handling; modifies call flow to yield save_response_payload before processing the response.
Spec updates for request/response mocking
spec/operations/fdsh/ssa_vlp/rj3/vlp/close_case/applicant_request_spec.rb
Replaces nested doubles with a mock returning Dry::Monads Success(Faraday::Response) containing XML body; introduces xml_content and mock_close_case_response; aligns stubs with new flow.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  participant A as ApplicantRequest
  participant S as VLP Service (RequestCloseCase)
  participant T as ResponseTransaction
  participant P as ProcessCloseCaseResponse

  A->>S: call()
  S-->>A: Success(Faraday::Response with XML)
  A->>T: create response transaction
  rect rgba(200,240,255,0.3)
    note right of A: New step: persist response XML
    A->>T: save_response_payload(xml_payload)
    T-->>A: Success(transaction updated)
  end
  A->>P: process(xml_payload, transaction)
  P-->>A: result
  A-->>A: return result
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

Suggested reviewers

  • vkghub
  • saikumar9

Poem

Thump-thump goes my tidy heart,
Saved the XML—right at the start.
Packets hop, payloads stay,
Transactions snug, no drift astray.
With whiskers twitch and specs that pass,
I stamp “Closed Case” in meadow grass. 🐇✨

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed The title "save close case response payload" succinctly and accurately summarizes the primary change—adding logic to persist the VLP close-case response payload in ApplicantRequest—so it is relevant and clear for reviewers scanning history. It is concise and directly related to the changes in the code and tests.
✨ Finishing touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch close_case_868fg068b

Tip

👮 Agentic pre-merge checks are now available in preview!

Pro plan users can now enable pre-merge checks in their settings to enforce checklists before merging PRs.

  • Built-in checks – Quickly apply ready-made checks to enforce title conventions, require pull request descriptions that follow templates, validate linked issues for compliance, and more.
  • Custom agentic checks – Define your own rules using CodeRabbit’s advanced agentic capabilities to enforce organization-specific policies and workflows. For example, you can instruct CodeRabbit’s agent to verify that API documentation is updated whenever API schema files are modified in a PR. Note: Upto 5 custom checks are currently allowed during the preview period. Pricing for this feature will be announced in a few weeks.

Please see the documentation for more information.

Example:

reviews:
  pre_merge_checks:
    custom_checks:
      - name: "Undocumented Breaking Changes"
        mode: "warning"
        instructions: |
          Pass/fail criteria: All breaking changes to public APIs, CLI flags, environment variables, configuration keys, database schemas, or HTTP/GraphQL endpoints must be documented in the "Breaking Change" section of the PR description and in CHANGELOG.md. Exclude purely internal or private changes (e.g., code not exported from package entry points or explicitly marked as internal).

Please share your feedback with us on this Discord post.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@ymhari ymhari requested review from TristanB17 and vkghub September 23, 2025 13:12
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🧹 Nitpick comments (1)
spec/operations/fdsh/ssa_vlp/rj3/vlp/close_case/applicant_request_spec.rb (1)

92-98: Optionally assert payload persistence for stronger coverage.

Validate that the response XML was saved on the response transaction.

Apply this diff:

   it 'should succeed' do
     result = subject.call(params)
     expect(result).to be_success
     expect(result.value!).to eq 'Close Case REST XML response handled successfully'
+    persisted = applicant.transactions.where(key: :vlp_close_case_response).last
+    expect(persisted&.xml_payload).to eq xml_content
   end
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 28485fe and 81d871f.

📒 Files selected for processing (2)
  • app/operations/fdsh/ssa_vlp/rj3/vlp/close_case/applicant_request.rb (2 hunks)
  • spec/operations/fdsh/ssa_vlp/rj3/vlp/close_case/applicant_request_spec.rb (1 hunks)
🧰 Additional context used
🧬 Code graph analysis (2)
spec/operations/fdsh/ssa_vlp/rj3/vlp/close_case/applicant_request_spec.rb (1)
app/operations/fdsh/ssa_vlp/rj3/vlp/close_case/applicant_request.rb (1)
  • call (16-30)
app/operations/fdsh/ssa_vlp/rj3/vlp/close_case/applicant_request.rb (1)
app/operations/fdsh/ssa_vlp/rj3/request_processor_utils.rb (1)
  • handle_failure (71-75)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: build-and-upload-image
🔇 Additional comments (2)
app/operations/fdsh/ssa_vlp/rj3/vlp/close_case/applicant_request.rb (1)

27-28: Good call: persist response payload before processing.

This ordering reduces data‑loss risk if processing fails later.

spec/operations/fdsh/ssa_vlp/rj3/vlp/close_case/applicant_request_spec.rb (1)

63-79: LGTM: realistic XML fixture.

Representative response body; suitable for persistence and parsing.

Copy link
Copy Markdown
Contributor

@vkghub vkghub left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Copy Markdown
Contributor

@TristanB17 TristanB17 left a comment

Choose a reason for hiding this comment

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

lgtm

@ymhari ymhari merged commit 46724de into trunk Sep 23, 2025
6 checks passed
@ymhari ymhari deleted the close_case_868fg068b branch September 23, 2025 13:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cr-120+ PRs associated with the CR-120+, QHP Application, or Eligibility 3.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants