Skip to content

Commit

Permalink
[DBX-80624] add 526 states for remediation audit (#16455)
Browse files Browse the repository at this point in the history
* [DBX-80624] add 526 states for remediation audit

* typos
  • Loading branch information
SamStuckey authored Apr 24, 2024
1 parent da4c68f commit 994c71f
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 2 deletions.
31 changes: 29 additions & 2 deletions app/models/form526_submission.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ class Form526Submission < ApplicationRecord
state :unprocessed, initial: true
state :delivered_to_primary, :failed_primary_delivery, :rejected_by_primary,
:delivered_to_backup, :failed_backup_delivery, :rejected_by_backup,
:in_remediation, :finalized_as_successful, :unprocessable
:in_remediation, :finalized_as_successful, :unprocessable,
:processed_in_batch_remediation, :ignorable_duplicate

# - a submission has been delivered to our happy path
# - requires polling to finalize
Expand Down Expand Up @@ -62,7 +63,6 @@ class Form526Submission < ApplicationRecord
transitions to: :in_remediation
end

# TODO: add this transition when we add 526 completion polling
# - The only state that means we no longer own completion of this submission
# - There is nothing more to do. E.G.
# - VBMS has accepted and returned the applicable status to us via
Expand All @@ -78,6 +78,33 @@ class Form526Submission < ApplicationRecord
event :mark_as_unprocessable do
transitions to: :unprocessable
end

# A special state to indicate this was part of our remediation 'batching'
# process in 2023. These were handled manually and are distinct from `in_remediation`
# in that they were not tracked at the time of remediation, but rather later in
# the 2024 526 State audit.
#
# This state is useful to us at the time of creation, but may be something
# to flatten to a simple `finalized_as_successful` in the future.
event :process_in_batch_remediation do
transitions to: :processed_in_batch_remediation
end

# A special state to indicate this was part of our remediation 'batching'
# process in 2023. These submissions may have been processed or not, but
# we don't care because they have an earlier, successful duplicate.
#
# Duplicates are identified by comparing form_json, using this script:
# https://github.com/department-of-veterans-affairs/va.gov-team-sensitive/blob/master/teams/benefits/scripts/526/submission_deduper.rb
# The result of this script can be evaluated by a qualified stakeholder to make
# a judgement call on whether or not a submission is a 'perfect' duplicate.
#
# IF a submission is found to be an exact duplicate of another
# AND its duplicate was previously submitted / remediated successfully
# THEN we can ignore it as a duplicate
event :ignore_as_duplicate do
transitions to: :ignorable_duplicate
end
end

wrap_with_logging(:start_evss_submission_job,
Expand Down
4 changes: 4 additions & 0 deletions spec/models/form526_submission_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,10 @@
.to(:unprocessable).on_event(:mark_as_unprocessable)
expect(submission).to transition_from(:unprocessed)
.to(:in_remediation).on_event(:begin_remediation)
expect(submission).to transition_from(:unprocessed)
.to(:processed_in_batch_remediation).on_event(:process_in_batch_remediation)
expect(submission).to transition_from(:unprocessed)
.to(:ignorable_duplicate).on_event(:ignore_as_duplicate)
end
end

Expand Down

0 comments on commit 994c71f

Please sign in to comment.