Skip to content

Conversation

@charlienparker
Copy link
Contributor

@charlienparker charlienparker commented Dec 15, 2025

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

Summary by CodeRabbit

  • New Features

    • SSA verification eligibility now considers citizenship status in addition to encrypted SSN.
    • Evidence handling expanded to include citizenship documentation alongside SSN evidence.
    • Verification process now short-circuits with a clear failure when SSN is missing.
  • Tests

    • Broadened test coverage for SSA and DHS eligibility across multiple citizenship/status permutations and missing-data edge cases.

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

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Dec 15, 2025

Walkthrough

Adds SSA eligibility checks: expands SSA evidence keys to include citizenship_evidence and requires either an encrypted SSN or US citizen status before invoking SSA; introduces helper methods to compute encrypted SSN and validate eligibility, and extends tests to cover positive and negative permutations.

Changes

Cohort / File(s) Summary
SSA Evidence Keys & Eligibility
app/operations/fdsh/ssa_vlp/rj3/process_applicant_requests.rb
Updated SSA_EVIDENCE_KEYS to include citizenship_evidence; changed eligibility logic to allow SSA invocation when an encrypted SSN is present OR citizen_status equals us_citizen.
ApplicantRequest: pre-flight validation
app/operations/fdsh/ssa_vlp/rj3/ssa/applicant_request.rb
Added encrypted_ssn helper (selects identifying_information or demographics by application_type) and check_ssa_eligibility (returns failure when SSN absent); integrated eligibility check before payload generation.
ProcessApplicantRequests tests
spec/operations/fdsh/ssa_vlp/rj3/process_applicant_requests_spec.rb
Reworked SSA and DHS test contexts into explicit scenarios; added positive cases (US citizen with/without SSN, non-citizen with SSN) and negative cases (missing evidences/eligibility) to validate expanded conditions.
ApplicantRequest tests
spec/operations/fdsh/ssa_vlp/rj3/ssa/applicant_request_spec.rb
Added contexts for applicants lacking SSN asserting failure result, failed SSA transmission, and job state transitions to failed.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

  • Areas needing attention:
    • encrypted_ssn logic: confirm correct source selection for faa vs other application_type values and handling of nil/empty values.
    • check_ssa_eligibility failure messaging and context propagation to ensure consistent error reporting and job-state transitions.
    • Updated eligibility OR-condition in process_applicant_requests.rb to ensure no unintended SSA invocations for edge citizenship statuses.
    • Expanded specs: verify test permutations accurately reflect intended domain rules and mock/fixture consistency.

Possibly related PRs

Suggested reviewers

  • TristanB17
  • saipraveen18

Poem

🐰 I nibble through evidence and code,
Seeking SSNs on the rabbit road,
If encrypted digits are in sight,
Or a US citizen badge shines bright,
I hop—eligibility checks done, payloads load. 🥕

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 'refactor ssa call when no ssn' directly addresses the main change: handling SSA invocation eligibility when an applicant lacks an SSN, which is the core focus of the changeset.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch refactor-ssa-call-when-no-ssn

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

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between fe0b3d1 and 450d76d.

📒 Files selected for processing (4)
  • app/operations/fdsh/ssa_vlp/rj3/process_applicant_requests.rb (2 hunks)
  • app/operations/fdsh/ssa_vlp/rj3/ssa/applicant_request.rb (2 hunks)
  • spec/operations/fdsh/ssa_vlp/rj3/process_applicant_requests_spec.rb (2 hunks)
  • spec/operations/fdsh/ssa_vlp/rj3/ssa/applicant_request_spec.rb (1 hunks)
🧰 Additional context used
🧠 Learnings (3)
📚 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
  • spec/operations/fdsh/ssa_vlp/rj3/process_applicant_requests_spec.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
  • spec/operations/fdsh/ssa_vlp/rj3/process_applicant_requests_spec.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/ssa/applicant_request.rb
🧬 Code graph analysis (4)
spec/operations/fdsh/ssa_vlp/rj3/ssa/applicant_request_spec.rb (3)
app/operations/fdsh/ssa_vlp/rj3/ssa/applicant_request.rb (1)
  • call (15-29)
app/operations/fdsh/ssa_vlp/rj3/ssa/request_verification.rb (1)
  • call (14-18)
app/models/transaction.rb (1)
  • applicants (54-56)
app/operations/fdsh/ssa_vlp/rj3/process_applicant_requests.rb (1)
app/operations/fdsh/ssa_vlp/rj3/ssa/applicant_request.rb (1)
  • encrypted_ssn (37-46)
spec/operations/fdsh/ssa_vlp/rj3/process_applicant_requests_spec.rb (1)
app/operations/fdsh/ssa_vlp/rj3/process_applicant_requests.rb (1)
  • eligibility (62-64)
app/operations/fdsh/ssa_vlp/rj3/ssa/applicant_request.rb (2)
app/operations/fdsh/ssa_vlp/rj3/process_applicant_requests.rb (1)
  • encrypted_ssn (74-80)
app/operations/fdsh/ssa_vlp/rj3/request_processor_utils.rb (1)
  • handle_failure (73-77)
🪛 GitHub Actions: RSpec
app/operations/fdsh/ssa_vlp/rj3/ssa/applicant_request.rb

[error] 42-42: RuboCop: Layout/IndentationWidth: Use 2 (not 1) spaces for indentation. ( autocorrectable )


[error] 43-43: RuboCop: Layout/ElseAlignment: Align else with if. ( autocorrectable )


[error] 45-45: RuboCop: Layout/EndAlignment: end at 45, 30 is not aligned with if at 41, 31. ( autocorrectable )


[error] 52-52: RuboCop: Layout/ArgumentAlignment: Align the arguments of a method call if they span more than one line. ( autocorrectable )


[error] 53-53: RuboCop: Layout/ArgumentAlignment: Align the arguments of a method call if they span more than one line. ( 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 (6)
app/operations/fdsh/ssa_vlp/rj3/process_applicant_requests.rb (2)

16-16: LGTM - Evidence keys expansion looks correct.

Adding citizenship_evidence to SSA_EVIDENCE_KEYS aligns with the broader SSA eligibility logic that now considers citizenship status.


86-88: Logic correctly enables downstream failure handling for US citizens without SSN.

The condition encrypted_ssn.present? || citizen_status == US_CITIZEN_STATUS intentionally allows US citizens through even without an SSN, enabling the downstream check_ssa_eligibility method in ApplicantRequest to properly handle the failure with appropriate status updates. The comment accurately describes this design.

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

152-178: Good test coverage for the missing SSN scenario.

The tests properly validate both the failure result and the side effects (transmission/job status transitions to failed). The test setup correctly creates an applicant entity without SSN to exercise the new check_ssa_eligibility flow.

app/operations/fdsh/ssa_vlp/rj3/ssa/applicant_request.rb (1)

19-19: LGTM - Pre-flight eligibility check is well-placed in the flow.

Adding check_ssa_eligibility after transmission/transaction creation but before payload generation ensures proper status updates occur when SSN is missing, rather than failing silently or with unclear errors downstream.

spec/operations/fdsh/ssa_vlp/rj3/process_applicant_requests_spec.rb (2)

306-357: Comprehensive test coverage for SSA eligibility conditions.

The tests cover all the key permutations:

  • US citizen with/without SSN
  • Non-citizen with SSN
  • Negative cases (no eligibility, no evidences, no SSN + non-citizen)

This properly validates the encrypted_ssn.present? || citizen_status == US_CITIZEN_STATUS logic.


368-420: Good test coverage for DHS eligibility conditions.

The tests properly validate all non-citizen status types and negative paths. The parameterized test at lines 378-387 efficiently covers all NON_CITIZEN_STATUS values.

@charlienparker charlienparker added the cr-120+ PRs associated with the CR-120+, QHP Application, or Eligibility 3.0 label Dec 15, 2025
Copy link
Contributor

@jacobkagon jacobkagon 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
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

🧹 Nitpick comments (3)
app/operations/fdsh/ssa_vlp/rj3/ssa/applicant_request.rb (3)

15-21: Pre‑flight SSA eligibility check placement looks correct; consider removing the unused local.

Running check_ssa_eligibility after creating the request transmission/transaction aligns with how handle_failure expects those objects. The assigned _eligible value is never used, though, so you could simplify to just binding the monad:

yield check_ssa_eligibility

This keeps the Do-notation behavior while avoiding an unused ivar/local.


37-46: encrypted_ssn implementation matches other flow but duplicates logic; consider centralizing.

This helper mirrors encrypted_ssn in Fdsh::SsaVlp::Rj3::ProcessApplicantRequests (FAA vs non‑FAA selection) and the TODO already notes the duplication. To avoid future drift (e.g., if the FAA check or entity shape changes), consider extracting this into a shared helper/module or delegating to the existing method so eligibility and payload builders stay in sync.


48-54: Eligibility rule currently hard‑requires an encrypted SSN; confirm this matches business intent and upstream gating.

check_ssa_eligibility short‑circuits the flow with a failure whenever encrypted_ssn is blank, regardless of any other evidence (e.g., citizenship). That cleanly enforces “no SSA request without SSN” at this layer and fits the PR title, but it also means any future upstream rule that allows SSA in limited no‑SSN cases would be blocked here.

If there’s a possibility of broader eligibility (as hinted by the expanded SSA evidence keys in process_applicant_requests.rb), consider either:

  • computing the eligibility boolean in one place upstream and having this method simply respect that flag, or
  • explicitly documenting here that SSA is only allowed when encrypted_ssn is present so future changes don’t silently conflict.
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 450d76d and f56d240.

📒 Files selected for processing (2)
  • app/operations/fdsh/ssa_vlp/rj3/process_applicant_requests.rb (2 hunks)
  • app/operations/fdsh/ssa_vlp/rj3/ssa/applicant_request.rb (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • app/operations/fdsh/ssa_vlp/rj3/process_applicant_requests.rb
🧰 Additional context used
🧠 Learnings (2)
📚 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/ssa/applicant_request.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/ssa/applicant_request.rb
🧬 Code graph analysis (1)
app/operations/fdsh/ssa_vlp/rj3/ssa/applicant_request.rb (2)
app/operations/fdsh/ssa_vlp/rj3/process_applicant_requests.rb (1)
  • encrypted_ssn (74-80)
app/operations/fdsh/ssa_vlp/rj3/request_processor_utils.rb (1)
  • handle_failure (73-77)
⏰ 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

Copy link
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

@jacobkagon jacobkagon merged commit 90913e3 into trunk Dec 16, 2025
7 checks passed
@jacobkagon jacobkagon deleted the refactor-ssa-call-when-no-ssn branch December 16, 2025 15:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bugfix 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.

4 participants