-
Notifications
You must be signed in to change notification settings - Fork 19
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Automate fix for RedistributedCase::CannotRedistribute Sentry alert #14705
Labels
Priority: Medium
Blocking issue w/workaround, or "second in" priority for new work.
Product: caseflow-queue
Source: Sentry Alert
created because of a Sentry alert
Team: Echo 🐬
Milestone
Comments
yoomlam
added
Product: caseflow-queue
Team: Echo 🐬
Source: Sentry Alert
created because of a Sentry alert
Priority: Medium
Blocking issue w/workaround, or "second in" priority for new work.
labels
Jul 16, 2020
1 |
2 | |||
3 | ||||||
5 |
8 | Why 2?
Why 3?
|
While we're in this part of the code, let's test using In def alert_existing_distributed_case_not_unique
error = CannotRedistribute.new("DistributedCase already exists")
# Method 1
Raven.tags_context judge: new_distribution.judge.css_id
Raven.capture_exception(
error,
# Method 2
tags: { vacols_id: case_id },
extra: {...} See these references: |
4 tasks
va-bot
pushed a commit
that referenced
this issue
Aug 6, 2020
Resolves #13596 Relevant to #14705 ### Description When we distribute legacy appeals, we update the location to the judge in vacols so it will appear in their queue. If there is already a distributed case for this appeal and [certain other criteria are not met](https://github.com/department-of-veterans-affairs/caseflow/blob/13b99749f8bac8b6d969f693f1d230f4fb2fa4dd/app/services/redistributed_case.rb#L26-L38), we should not distribute this appeal. HOWEVER, the location has already been updated to the judge and the case has essentially been "distributed", even though we did not create a new distributed for the appeal. This could lead to both the judge starting a decision before a hearing is held or other unwanted scenarios. Instead, we should update the location of the case to be caseflow if there are open tasks, or send it back to distribution to be handled manually by batteam. ### Acceptance Criteria - [x] Cases that cannot be distributed are not moved to the judge - [x] Cases with open tasks should be in the "caseflow" location - [x] If the location code of the case can be updated to caseflow, do not send a sentry alert - [x] [Batteam wiki is updated to show correct fixes for these alerts](https://github.com/department-of-veterans-affairs/appeals-deployment/wiki/Bat-Team-Quick-Ref#redistributedcasecannotredistribute-sentry-alert) ### Testing Plan 1. Find an appeal ready to be distributed and give it a task that would send it back to distribution ```ruby # What case will be distributed next? vacols_id = VACOLS::CaseDocket.distribute_nonpriority_appeals(User.third,"not_genpop", nil, 1000, false, dry_run: true).first["bfkey"] # Let's create a previous distribution for this case distribution = FactoryBot.build(:distribution, judge: User.third) distribution.save(validate: false) distribution.distributed_cases.create( case_id: vacols_id, priority: false, docket: "legacy", ready_at: VacolsHelper.normalize_vacols_datetime(Time.zone.now), docket_index: "123", genpop: false, genpop_query: "any" ) # Now let's make sure we fail all `ok_to_redistribute?` validations appeal = LegacyAppeal.find_or_create_by_vacols_id(vacols_id) HearingTask.create!(appeal: appeal).completed! appeal.reload.treee LegacyAppeal 25 (legacy) ID STATUS ASGN_BY ASGN_TO UPDATED_AT └── HearingTask 2120 completed Bva 2020-08-05 15:32:32 UTC ``` 2. Lets see what happens when we distribute the case ```ruby VACOLS::Case.find_by(bfkey: vacols_id).bfcurloc => "81" distribution = FactoryBot.build(:distribution, judge: User.third) distribution.save(validate: false) LegacyDocket.new.distribute_nonpriority_appeals(distribution) VACOLS::Case.find_by(bfkey: vacols_id).bfcurloc => "81" ``` 3. Open a task on the appeal, indicating that it is being worked in caseflow ```ruby HearingTask.create!(appeal: appeal) ``` 4. Lets see what happens when we distribute the case ```ruby VACOLS::Case.find_by(bfkey: vacols_id).bfcurloc => "81" distribution = FactoryBot.build(:distribution, judge: User.third) distribution.save(validate: false) LegacyDocket.new.distribute_nonpriority_appeals(distribution) VACOLS::Case.find_by(bfkey: vacols_id).bfcurloc => "CASEFLOW" ```
1 task
2 tasks
hschallhorn
modified the milestones:
PI5-S2: Edith S. Sampson,
PI5-S3: Chadwick Boseman Sprint
Sep 14, 2020
1 task
va-bot
pushed a commit
that referenced
this issue
Sep 21, 2020
…15248) Resolves #14705 ### Description This fix allows for legacy appeals that have closed actionable (non-Root or TrackVeteran tasks) to be automatically redistributed. Prior to this, the 🦇 team would have to manually redistribute these cases when [notified](https://sentry.prod.appeals.va.gov/department-of-veterans-affairs/caseflow/issues/7524/) by the `RedistributedCase::CannotRedistribute` Sentry alert. ### Acceptance Criteria - [ ] Legacy appeals with closed actionable tasks are automatically redistributed ### Testing Plan 1. Find an appeal ready to be distributed and give it a task that would send it back to distribution ```ruby # What case will be distributed next? vacols_id = VACOLS::CaseDocket.distribute_nonpriority_appeals(User.third,"not_genpop", nil, 1000, false, dry_run: true).first["bfkey"] # Let's create a previous distribution for this case distribution = FactoryBot.build(:distribution, judge: User.third) distribution.save(validate: false) distribution.distributed_cases.create( case_id: vacols_id, priority: false, docket: "legacy", ready_at: VacolsHelper.normalize_vacols_datetime(Time.zone.now), docket_index: "123", genpop: false, genpop_query: "any" ) appeal = LegacyAppeal.find_or_create_by_vacols_id(vacols_id) HearingTask.create!(appeal: appeal).completed! appeal.reload.treee LegacyAppeal 26 (legacy) │ ID │ STATUS │ ASGN_BY │ ASGN_TO │ UPDATED_AT └── HearingTask │ 2701 │ completed │ │ Bva │ 2020-09-15 17:35:54 UTC │ ``` 2. Lets see what happens when we distribute the case (make sure it is being properly redistributed) ```ruby VACOLS::Case.find_by(bfkey: vacols_id).bfcurloc => "81" distribution = FactoryBot.build(:distribution, judge: User.third) distribution.save(validate: false) LegacyDocket.new.distribute_nonpriority_appeals(distribution) VACOLS::Case.find_by(bfkey: vacols_id).bfcurloc => "AABSHIRE" ``` 3. Open a task on the appeal, indicating that it is being worked in caseflow ```ruby HearingTask.create!(appeal: appeal) appeal.reload.treee LegacyAppeal 26 (legacy) │ ID │ STATUS │ ASGN_BY │ ASGN_TO │ UPDATED_AT ├── HearingTask │ 2701 │ completed │ │ Bva │ 2020-09-15 17:35:54 UTC │ └── HearingTask │ 2702 │ assigned │ │ Bva │ 2020-09-15 17:41:25 UTC │ ``` 4. Lets see what happens when we distribute the case (case with active actionable task should remain in caseflow) ```ruby VACOLS::Case.find_by(bfkey: vacols_id).update(bfcurloc: "81") => "81" distribution = FactoryBot.build(:distribution, judge: User.third) distribution.save(validate: false) LegacyDocket.new.distribute_nonpriority_appeals(distribution) VACOLS::Case.find_by(bfkey: vacols_id).bfcurloc => "CASEFLOW" ```
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
Priority: Medium
Blocking issue w/workaround, or "second in" priority for new work.
Product: caseflow-queue
Source: Sentry Alert
created because of a Sentry alert
Team: Echo 🐬
Description
So far, Bat Team is responsible for fixing appeals that need to be redistributed when prompted by
RedistributedCase::CannotRedistribute
Sentry alerts. We should automate the fix so that appeals are not stuck/delayed.The fix is described here, and Hunter provided a snippet to fix several at a time:
Open Questions
Caseflow should probably use a different suffix to differentiate from manual fixes that use suffix '-attempt1'.
Acceptance criteria
Background/context/resources
Also see #13596 and #14597.
Technical notes
Check for when redistribution can or cannot occur:
caseflow/app/services/redistributed_case.rb
Lines 26 to 38 in 13b9974
What Caseflow does in each scenario:
caseflow/app/services/redistributed_case.rb
Lines 18 to 22 in 13b9974
The text was updated successfully, but these errors were encountered: