Skip to content

return success on SSA/VLP request verifications#307

Merged
jacobkagon merged 2 commits intotrunkfrom
CU_868gfyb67_handle_failure_when_ssavlp_request_fails
Jan 15, 2026
Merged

return success on SSA/VLP request verifications#307
jacobkagon merged 2 commits intotrunkfrom
CU_868gfyb67_handle_failure_when_ssavlp_request_fails

Conversation

@jacobkagon
Copy link
Copy Markdown
Contributor

@jacobkagon jacobkagon commented Jan 15, 2026

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

Current Behavior:
If all applicants do not have an SSN, a failure is being returned and a response is not being published to EA

New Behavior:
Sends a failure response to EA even if all applicants do not have an SSN.

Summary by CodeRabbit

  • Bug Fixes

    • Corrected event naming for verification responses (fixed underscore) to ensure proper event integration.
  • Refactor

    • Adjusted verification request flow to delegate error handling downstream rather than immediately failing when services are unavailable.
  • Tests

    • Updated test expectations to reflect the revised verification error handling and success outcomes.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Jan 15, 2026

📝 Walkthrough

Walkthrough

Updated SSA VLP verification handling: event name corrected to use ssa_vlp, and the applicant request processor no longer returns a combined failure when all verification services fail, instead returning success and relying on downstream transmittable error handling.

Changes

Cohort / File(s) Summary
Event naming correction
app/event_source/subscribers/fdsh/verification_requests/ssa_vlp_requested_subscriber.rb
Corrected published failure event name from "events.fdsh.verifications.ssavlp.determined" to "events.fdsh.verifications.ssa_vlp.determined".
Verification orchestration
app/operations/fdsh/ssa_vlp/rj3/process_applicant_requests.rb
Removed aggregation/fallback that returned Failure when all verification services failed; now conditionally invokes SSA and DHS verification and unconditionally returns Success(nil), delegating error handling to transmittable errors.
Tests updated
spec/operations/fdsh/ssa_vlp/rj3/process_applicant_requests_spec.rb
Updated assertions (multiple contexts) to expect success outcomes where failures were previously asserted.

Sequence Diagram(s)

sequenceDiagram
    participant Caller
    participant ProcessApplicantRequests
    participant SSAService
    participant DHSService
    participant TransmittableHandler

    Caller->>ProcessApplicantRequests: invoke request_verifications
    ProcessApplicantRequests->>SSAService: request_ssa_verification (if eligible)
    alt DHS eligible
        ProcessApplicantRequests->>DHSService: request_dhs_verification
    end
    SSAService-->>ProcessApplicantRequests: response (success/failure)
    DHSService-->>ProcessApplicantRequests: response (success/failure)
    ProcessApplicantRequests->>TransmittableHandler: let transmittable errors surface
    ProcessApplicantRequests-->>Caller: return Success(nil)
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~22 minutes

Possibly related PRs

Suggested labels

cr-120+

Suggested reviewers

  • vkghub
  • saipraveen18
  • TristanB17

Poem

🐰 I hopped in code to stitch a line,
Between ssa and vlp — now fine,
Failures whisper, handlers hear,
Requests proceed without the fear,
Tests nod, the logs softly shine. ✨

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ 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%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ 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 'return success on SSA/VLP request verifications' is directly related to the main change in the pull request, which modifies the verification request handling to return success instead of failure and ensure a response is published to EA.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings

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.

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: 0

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
app/operations/fdsh/ssa_vlp/rj3/process_applicant_requests.rb (1)

44-52: Remove unused service_results variable to fix pipeline failure.

The service_results variable is assigned but never used after the removal of the failure-checking logic. This triggers the RuboCop Lint/UselessAssignment error reported in the pipeline.

Proposed fix
       def request_verifications
-        ssa_result = request_ssa_verification if eligible_for_invoking_ssa?
-        dhs_result = request_dhs_verification if eligible_for_invoking_dhs?
-
-        service_results = [ssa_result, dhs_result].compact
+        request_ssa_verification if eligible_for_invoking_ssa?
+        request_dhs_verification if eligible_for_invoking_dhs?

         # processing failures are handled through Transmittable errors
         Success(nil)
       end
🧹 Nitpick comments (1)
spec/operations/fdsh/ssa_vlp/rj3/process_applicant_requests_spec.rb (1)

292-296: Consider adding a test description clarifying the intentional design.

The test now expects Success(nil) when both verifications fail. While the expectation is correct, the test description could be enhanced to clarify that this is intentional behavior for downstream error handling.

     context 'when both verifications fail' do
       before do
         allow(subject).to receive(:eligible_for_invoking_ssa?).and_return(true)
         allow(subject).to receive(:eligible_for_invoking_dhs?).and_return(true)
         allow(subject).to receive(:request_ssa_verification).and_return(Dry::Monads::Failure('SSA failed'))
         allow(subject).to receive(:request_dhs_verification).and_return(Dry::Monads::Failure('DHS failed'))
       end

-      it 'returns success' do
+      it 'returns success with nil value (failures handled via Transmittable)' do
         result = subject.send(:request_verifications)
         expect(result).to be_success
         expect(result.value!).to eq(nil)
       end
     end
📜 Review details

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 451be25 and 748cb0b.

📒 Files selected for processing (3)
  • app/event_source/subscribers/fdsh/verification_requests/ssa_vlp_requested_subscriber.rb
  • app/operations/fdsh/ssa_vlp/rj3/process_applicant_requests.rb
  • spec/operations/fdsh/ssa_vlp/rj3/process_applicant_requests_spec.rb
🧰 Additional context used
🧠 Learnings (6)
📚 Learning: 2025-07-14T19:06:48.270Z
Learnt from: ymhari
Repo: ideacrew/fdsh_gateway PR: 268
File: app/operations/fdsh/ssa_vlp/rj3/ssa/process_verification_response.rb:99-119
Timestamp: 2025-07-14T19:06:48.270Z
Learning: In `app/operations/fdsh/ssa_vlp/rj3/ssa/process_verification_response.rb`, the evidence appending approach in `update_evidences_with_failure` and `update_evidences_with_results` methods is intentionally designed to accumulate evidence entries rather than replace them, as confirmed by ymhari.

Applied to files:

  • spec/operations/fdsh/ssa_vlp/rj3/process_applicant_requests_spec.rb
  • app/operations/fdsh/ssa_vlp/rj3/process_applicant_requests.rb
📚 Learning: 2025-07-16T13:34:53.451Z
Learnt from: ymhari
Repo: ideacrew/fdsh_gateway PR: 268
File: app/operations/fdsh/ssa_vlp/rj3/vlp/process_verification_response.rb:129-138
Timestamp: 2025-07-16T13:34:53.451Z
Learning: In `app/operations/fdsh/ssa_vlp/rj3/vlp/process_verification_response.rb`, the evidence appending approach in `update_evidences_with_failure` and `update_evidences_with_results` methods is intentionally designed to accumulate evidence entries rather than replace them, as confirmed by ymhari.

Applied to files:

  • spec/operations/fdsh/ssa_vlp/rj3/process_applicant_requests_spec.rb
  • app/operations/fdsh/ssa_vlp/rj3/process_applicant_requests.rb
📚 Learning: 2025-07-15T16:28:40.423Z
Learnt from: vkghub
Repo: ideacrew/fdsh_gateway PR: 268
File: app/operations/fdsh/ssa_vlp/rj3/vlp/process_verification_response.rb:119-123
Timestamp: 2025-07-15T16:28:40.423Z
Learning: In `app/operations/fdsh/ssa_vlp/rj3/vlp/process_verification_response.rb`, the application hash structure guarantees that top level keys like `:person_name` and `:demographics` will always be present, so direct hash access in `name_and_dob_match?` method is safe and doesn't require defensive navigation using `dig`.

Applied to files:

  • spec/operations/fdsh/ssa_vlp/rj3/process_applicant_requests_spec.rb
  • app/operations/fdsh/ssa_vlp/rj3/process_applicant_requests.rb
📚 Learning: 2024-10-08T21:02:47.798Z
Learnt from: saikumar9
Repo: ideacrew/fdsh_gateway PR: 219
File: app/models/alive_status/family.rb:45-78
Timestamp: 2024-10-08T21:02:47.798Z
Learning: The class `::AcaEntities::Operations::CreateFamily` is well-tested within its own gem, and its usage in the methods `request_family_entity` and `response_family_entity` of the `AliveStatus::Family` model is sufficiently covered in `spec/models/alive_status/family_spec.rb`.

Applied to files:

  • spec/operations/fdsh/ssa_vlp/rj3/process_applicant_requests_spec.rb
📚 Learning: 2024-11-18T17:13:17.915Z
Learnt from: saipraveen18
Repo: ideacrew/fdsh_gateway PR: 262
File: app/operations/fdsh/h41/request/build_1095a_payload.rb:85-89
Timestamp: 2024-11-18T17:13:17.915Z
Learning: In the `fetch_insurance_provider_title` method within `app/operations/fdsh/h41/request/build_1095a_payload.rb`, it's acceptable to assume that the `modify_carrier_legal_names` feature is always enabled and that the mapping will always be present, so defensive checks for nil mappings are not necessary.

Applied to files:

  • app/operations/fdsh/ssa_vlp/rj3/process_applicant_requests.rb
📚 Learning: 2026-01-14T20:40:53.472Z
Learnt from: saipraveen18
Repo: ideacrew/fdsh_gateway PR: 306
File: app/operations/fdsh/h36/request/clone_transaction_and_subject.rb:37-54
Timestamp: 2026-01-14T20:40:53.472Z
Learning: In app/operations/fdsh/h36/request/clone_transaction_and_subject.rb, the `publish` method uses fire-and-forget behavior where it always returns `Success(true)` regardless of individual event publication failures. This is intentional because events are processed asynchronously and errors won't be raised in the publishing method itself—individual failures are only logged.

Applied to files:

  • app/event_source/subscribers/fdsh/verification_requests/ssa_vlp_requested_subscriber.rb
🧬 Code graph analysis (1)
spec/operations/fdsh/ssa_vlp/rj3/process_applicant_requests_spec.rb (1)
app/operations/fdsh/ssa_vlp/rj3/process_applicant_requests.rb (1)
  • call (18-24)
🪛 GitHub Actions: RSpec
app/operations/fdsh/ssa_vlp/rj3/process_applicant_requests.rb

[error] 48-48: RuboCop: Lint/UselessAssignment: Useless assignment to variable - service_results. (autocorrectable)

⏰ 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 (3)
spec/operations/fdsh/ssa_vlp/rj3/process_applicant_requests_spec.rb (1)

141-145: Test expectations correctly reflect the new behavior.

The updated tests properly verify that the operation now returns success even when all verification services fail. This aligns with the PR objective of ensuring EA receives a response regardless of verification outcomes.

app/operations/fdsh/ssa_vlp/rj3/process_applicant_requests.rb (1)

18-24: Verify the return value consistency between call and request_verifications.

The call method returns Success('Successfully invoked verifications') on line 23, but request_verifications returns Success(nil) on line 51. Since request_verifications is yielded with yield (line 21), the nil value is discarded and the final success message is returned. This is correct behavior, but the tests at line 292-295 expect nil when calling request_verifications directly, which is inconsistent with the full call flow tests that expect 'Successfully invoked verifications'.

This is intentional and working correctly, just noting for clarity.

app/event_source/subscribers/fdsh/verification_requests/ssa_vlp_requested_subscriber.rb (1)

38-41: No action needed—event naming is correct.

The change from "events.fdsh.verifications.ssavlp.determined" to "events.fdsh.verifications.ssa_vlp.determined" is consistent with the rest of the codebase. The published event name with underscore matches the EVENT_NAME constant in handle_verification_request.rb:11.

The AMQP queue subscription at line 8 ('enroll.verifications.ssavlp') is from a different event system (incoming events from enroll) and does not need to match the published event namespace (events.fdsh.verifications.*). These serve different purposes and are in separate namespaces.

✏️ Tip: You can disable this entire section by setting review_details to false in your review settings.

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: 1

🤖 Fix all issues with AI agents
In `@app/operations/fdsh/ssa_vlp/rj3/process_applicant_requests.rb`:
- Around line 44-50: In request_verifications, add handling for the case where
neither eligible_for_invoking_ssa? nor eligible_for_invoking_dhs? is true:
create and surface a Transmittable-style failure so EA gets a status/evidence
record instead of silently succeeding; specifically, detect the "no verification
eligible" branch in request_verifications and invoke the same failure pipeline
used by the ApplicantRequest classes (use RequestProcessorUtils.handle_failure
or call Fdsh::Jobs::AddError and Fdsh::Jobs::UpdateProcessStatus with a clear
message and context) so a record is created for that applicant when no SSA or
DHS request is attempted.
📜 Review details

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 748cb0b and 8443530.

📒 Files selected for processing (1)
  • app/operations/fdsh/ssa_vlp/rj3/process_applicant_requests.rb
🧰 Additional context used
🧠 Learnings (4)
📚 Learning: 2025-07-14T19:06:48.270Z
Learnt from: ymhari
Repo: ideacrew/fdsh_gateway PR: 268
File: app/operations/fdsh/ssa_vlp/rj3/ssa/process_verification_response.rb:99-119
Timestamp: 2025-07-14T19:06:48.270Z
Learning: In `app/operations/fdsh/ssa_vlp/rj3/ssa/process_verification_response.rb`, the evidence appending approach in `update_evidences_with_failure` and `update_evidences_with_results` methods is intentionally designed to accumulate evidence entries rather than replace them, as confirmed by ymhari.

Applied to files:

  • app/operations/fdsh/ssa_vlp/rj3/process_applicant_requests.rb
📚 Learning: 2025-07-16T13:34:53.451Z
Learnt from: ymhari
Repo: ideacrew/fdsh_gateway PR: 268
File: app/operations/fdsh/ssa_vlp/rj3/vlp/process_verification_response.rb:129-138
Timestamp: 2025-07-16T13:34:53.451Z
Learning: In `app/operations/fdsh/ssa_vlp/rj3/vlp/process_verification_response.rb`, the evidence appending approach in `update_evidences_with_failure` and `update_evidences_with_results` methods is intentionally designed to accumulate evidence entries rather than replace them, as confirmed by ymhari.

Applied to files:

  • app/operations/fdsh/ssa_vlp/rj3/process_applicant_requests.rb
📚 Learning: 2025-07-15T16:28:40.423Z
Learnt from: vkghub
Repo: ideacrew/fdsh_gateway PR: 268
File: app/operations/fdsh/ssa_vlp/rj3/vlp/process_verification_response.rb:119-123
Timestamp: 2025-07-15T16:28:40.423Z
Learning: In `app/operations/fdsh/ssa_vlp/rj3/vlp/process_verification_response.rb`, the application hash structure guarantees that top level keys like `:person_name` and `:demographics` will always be present, so direct hash access in `name_and_dob_match?` method is safe and doesn't require defensive navigation using `dig`.

Applied to files:

  • app/operations/fdsh/ssa_vlp/rj3/process_applicant_requests.rb
📚 Learning: 2024-11-18T17:13:17.915Z
Learnt from: saipraveen18
Repo: ideacrew/fdsh_gateway PR: 262
File: app/operations/fdsh/h41/request/build_1095a_payload.rb:85-89
Timestamp: 2024-11-18T17:13:17.915Z
Learning: In the `fetch_insurance_provider_title` method within `app/operations/fdsh/h41/request/build_1095a_payload.rb`, it's acceptable to assume that the `modify_carrier_legal_names` feature is always enabled and that the mapping will always be present, so defensive checks for nil mappings are not necessary.

Applied to files:

  • app/operations/fdsh/ssa_vlp/rj3/process_applicant_requests.rb
⏰ 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). (2)
  • GitHub Check: build-and-upload-image
  • GitHub Check: rspec

✏️ Tip: You can disable this entire section by setting review_details to false in your review settings.

@jacobkagon jacobkagon enabled auto-merge (squash) January 15, 2026 21:03
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.

good catch with the event name consistency, lgtm!

@jacobkagon jacobkagon merged commit 7f1fbb6 into trunk Jan 15, 2026
7 checks passed
@jacobkagon jacobkagon deleted the CU_868gfyb67_handle_failure_when_ssavlp_request_fails branch January 15, 2026 21:04
sri49 added a commit that referenced this pull request Jan 16, 2026
jacobkagon pushed a commit that referenced this pull request Jan 20, 2026
* Revert "return success on SSA/VLP request verifications (#307)"

This reverts commit 7f1fbb6.

* Revert "refactor ssa call when no ssn (#301)"

This reverts commit 90913e3.

* Revert "remove encrypted ssn check for ssa call eligibility check (#298)"

This reverts commit 454cc39.
sri49 pushed a commit that referenced this pull request Feb 10, 2026
* return success on SSA/VLP request verifications

* rubocop fix
jacobkagon added a commit that referenced this pull request Feb 11, 2026
* remove encrypted ssn check for ssa call eligibility check (#298)

* only make ssa call when ssn field is present, remove citizenshp from list of ssa-applicable evidences

* lint fix

* refactor ssa call when no ssn (#301)

* allow ssa processor to be called when an applicant is a citizen but lacks an ssn, fail the request in the processor for this case

* spec coverage

* lint fix

* comment clarity

* lint fixes

---------

Co-authored-by: Jacob Kagon <69021620+jacobkagon@users.noreply.github.com>

* query applicant by hbx id (#303)

* return success on SSA/VLP request verifications (#307)

* return success on SSA/VLP request verifications

* rubocop fix

---------

Co-authored-by: Charlie Parker <charlie.parker@ideacrew.com>
Co-authored-by: Jacob Kagon <69021620+jacobkagon@users.noreply.github.com>
Co-authored-by: vishal kalletla <vishuk1201@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants