Skip to content

Commit

Permalink
[Automated] Merged master into target k8s
Browse files Browse the repository at this point in the history
  • Loading branch information
va-vsp-bot committed Apr 24, 2024
2 parents a2ab02e + 994c71f commit ad0b407
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
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
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 ad0b407

Please sign in to comment.