Commit af3716f
fix(risk_acceptance): reinstate findings when expiration date updated via API (#15147)
* fix(risk_acceptance): reinstate findings when expiration date updated via API
RiskAcceptanceSerializer.update() never called ra_helper.reinstate() when
expiration_date changed, unlike the legacy Django view which does so at
engagement/views.py. This caused two bugs reported together:
1. Findings stayed Active after a user updated the expiration date from a
past date to a future date via the Edit Risk Acceptance form (Vue UI).
reinstate() sets them back to inactive/risk_accepted.
2. Findings stayed Inactive on subsequent expiry cycles. Because reinstate()
was never called, expiration_date_handled was never cleared. The Celery
expiration task filters on expiration_date_handled__isnull=True, so the
RA was permanently excluded from every future expiry run.
Fix: capture old_expiration_date before super().update(), then call
ra_helper.reinstate() when the date changes — matching the logic that
already existed in the legacy view.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* test(risk_acceptance): regression coverage for reinstate on API expiration update
Adds two API tests exercising the serializer update() reinstate path:
- Extending an expired RA's expiration_date reinstates its findings
(active=False / risk_accepted=True) and clears expiration_date_handled
so the Celery expiry task re-processes it.
- Editing a never-expired RA's date leaves findings untouched and keeps
expiration_date_handled None.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-authored-by: Cody Maffucci <46459665+Maffooch@users.noreply.github.com>1 parent ae9d47b commit af3716f
2 files changed
Lines changed: 90 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
50 | 50 | | |
51 | 51 | | |
52 | 52 | | |
| 53 | + | |
53 | 54 | | |
54 | 55 | | |
55 | 56 | | |
| |||
59 | 60 | | |
60 | 61 | | |
61 | 62 | | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
62 | 66 | | |
63 | 67 | | |
64 | 68 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
374 | 374 | | |
375 | 375 | | |
376 | 376 | | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
| 388 | + | |
| 389 | + | |
| 390 | + | |
| 391 | + | |
| 392 | + | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
| 415 | + | |
| 416 | + | |
| 417 | + | |
| 418 | + | |
| 419 | + | |
| 420 | + | |
| 421 | + | |
| 422 | + | |
| 423 | + | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
| 427 | + | |
| 428 | + | |
| 429 | + | |
| 430 | + | |
| 431 | + | |
| 432 | + | |
| 433 | + | |
| 434 | + | |
| 435 | + | |
| 436 | + | |
| 437 | + | |
| 438 | + | |
| 439 | + | |
| 440 | + | |
| 441 | + | |
| 442 | + | |
| 443 | + | |
| 444 | + | |
| 445 | + | |
| 446 | + | |
| 447 | + | |
| 448 | + | |
| 449 | + | |
| 450 | + | |
| 451 | + | |
| 452 | + | |
| 453 | + | |
| 454 | + | |
| 455 | + | |
| 456 | + | |
| 457 | + | |
| 458 | + | |
| 459 | + | |
| 460 | + | |
| 461 | + | |
| 462 | + | |
377 | 463 | | |
378 | 464 | | |
379 | 465 | | |
| |||
0 commit comments