Repository navigation
fix(fsma-recall): fail closed on negative completed drill duration - #3598
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
No actionable comments were generated in the recent review.
|
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
PR Blocker ChecklistHead SHA: Status: Ready
|
PetrefiedThunder
left a comment
There was a problem hiding this comment.
REVIEW: PASS deepseek eb35d96
Reviewed by hand. The parent is ffd29de (#3592's head), so the diff vs main is #3592 plus this commit: models.py SLA check 0 <= duration <= sla_limit, plus the zero/negative tests.
- Boundaries: 0 = MET, negative = BREACHED. 7 tests pass. With #3592's models.py, the 2 negative-duration tests fail.
- The tests use no data (empty ids, timestamps only).
- Merge after #3592 (stacked).
CI: all real checks green. Remaining failures are engine-review gates only (circular), plus Vercel Preview Built (deploy skipped by Ignored Build Step on non-frontend PRs, not a build failure): Engine Review Pass,Engine Review Pass,PR Blocker Checklist,Head SHA Check Guard,
PetrefiedThunder
left a comment
There was a problem hiding this comment.
REVIEW: PASS deepseek eb35d96
Reviewed by hand. The parent is ffd29de (#3592's head), so the diff vs main is #3592 plus this commit: models.py SLA check 0 <= duration <= sla_limit, plus the zero/negative tests.
- Boundaries: 0 = MET, negative = BREACHED. 7 tests pass. With #3592's models.py, the 2 negative-duration tests fail.
- The tests use no data (empty ids, timestamps only).
- Merge after #3592 (stacked).
CI: all real checks green. Remaining failures are engine-review gates only (circular), plus Vercel Preview Built (deploy skipped by Ignored Build Step on non-frontend PRs, not a build failure): Engine Review Pass,Engine Review Pass,PR Blocker Checklist,Head SHA Check Guard,
CI: all real checks green. Remaining failures are engine-review gates only (circular), plus Vercel Preview Built (deploy skipped by Ignored Build Step on non-frontend PRs, not a build failure): Engine Review Pass,Engine Review Pass,visual-report (non-required),PR Blocker Checklist,Head SHA Check Guard,
PetrefiedThunder
left a comment
There was a problem hiding this comment.
REVIEW: PASS deepseek eb35d96
This follows up my earlier hand review. A dsh headless run on the full PR diff (merge-base..eb35d96) confirmed the PASS. Excerpt:
- `services/graph/app/fsma_recall/models.py:129` — the new condition `duration is not None and 0 <= duration <= sla_limit` correctly preserves `0s = MET`, `24h = MET`, `24h + 1s = BREACHED`, and now fails closed for negative durations.
- Verified behavior directly against both model versions: the parent returns `MET` for `-1s` and `-48h`; head returns `BREACHED`. The two negative-duration tests therefore meaningfully guard the regression.
- Ran the 7 new SLA tests at head: **7 passed**.
- The tests use only empty IDs and synthesized timestamps; no production data, fixtures, migrations, or tenant-scoped queries are touched. No tenant-scoping impact.
No concrete bugs found in the changed code or tests.
VERDICT: PASS
PetrefiedThunder
left a comment
There was a problem hiding this comment.
REVIEW: PASS grok eb35d96
- services/graph/app/fsma_recall/models.py:123-130: completed drills are MET only when 0 <= duration <= 24h. Fixes two bugs: a 0 s completion was BREACHED via truthiness, and a negative duration (completed_at before started_at) is now fail-closed BREACHED rather than certifying compliance. No new enum value, so API consumers are unaffected.
- Tests: test_recall_sla_negative_duration.py (-1 s, -48 h BREACHED; 0 MET) and test_recall_sla_zero_duration.py (0 MET, 24 h MET, 24 h+1 s BREACHED, missing completed_at uses elapsed). Timestamps only, empty ids; no invented data. Local: 7 passed.
- CI: no code check failing; Engine Review Pass is the pending engine-review gate.
Posted with C.Lee's approval (12:37 AM PT).
# Conflicts: # services/graph/app/fsma_recall/models.py
PetrefiedThunder
left a comment
There was a problem hiding this comment.
REVIEW: PASS muse 759b856
Head checked: 759b856 (author Pi, branch pi/recall-sla-negative-duration).
- Remerge-diff (
git show --remerge-diff 759b856dc): the only conflict was in services/graph/app/fsma_recall/models.py, inside the SLA comparison. Since the old merge base, main's only change to models.py is ab2e59f (#3592, zero-second drills count as MET:duration is not None and duration <= sla_limit). The resolutionduration is not None and 0 <= duration <= sla_limitkeeps #3592's None check and its zero-inclusive behavior. No main change is dropped. The final diff against main for models.py is just that condition plus a comment. - Correctness: a completed drill with completed_at before started_at now returns BREACHED rather than MET, so it fails closed and adds no new enum value. Zero duration is still MET. Coverage: test_recall_sla_negative_duration.py tests -1s and -48h (BREACHED) and 0 (MET). test_recall_sla_zero_duration.py from main still passes.
- Made-up data: none. The diff touches only models.py and one new test file. The test uses timestamps with empty ids and adds no CSV or sample data, and it doesn't touch /proof or the drill sample data.
- Tests: I ran them in a temporary worktree at /Volumes/Extreme SSD/worktrees/muse-review-3598, using the existing venv from worktrees/ing-edi-wh-1017 (not the shared one), then removed the worktree. All 112 tests in the graph recall test files passed (test_fsma_recall, test_r3_recall_sla_24h, test_recall_contacts_csv, test_recall_deep_qa, test_recall_drill_create_api_key, test_recall_drill_metrics_2943, test_recall_sla_negative_duration, test_recall_sla_zero_duration). I excluded test_recall_drill_queue_isolation because 2 of its tests need the admin DATABASE_URL, which isn't set locally. That's an environment gap, not something this PR changed.
- CI: when I checked, the full CI suite was running on this head, including PR Gate: Backend, Frontend and Workflow Contract. Head SHA Check Guard and PR Blocker Checklist had failed after 1s and need a re-run. Merge only once the required checks are green.
Follow-up to #3592 (stacked on its branch; retarget to main once #3592 merges).
Problem
RecallDrill.sla_statusreturned MET for a COMPLETED drill whosecompleted_atprecedesstarted_at(negativeduration_seconds), because-N <= 24h.Decision: BREACHED, not a new "invalid" status
SLAStatusis only consumed by being serialised (to_dict,fsma_recall/__init__.py) into API output with valuesmet/at_risk/breached. Adding a new value would break consumers that switch on those three. Corrupt timing must never certify 24h compliance (21 CFR 1.1455(c)(1)), so it fails closed to the existing non-compliant status.Change
models.py:duration is not None and 0 <= duration <= sla_limit.services/graph/tests/test_recall_sla_negative_duration.py(data-free, timestamps only): -1s → BREACHED, -48h → BREACHED, 0s still MET. The two negative tests fail before the fix; 65 recall tests pass after.Reviewer: DeepSeek (non-pi engine), per Lead.
Note
Low Risk
Narrow SLA classification fix for corrupt timestamps; only misclassified negative-duration completed drills change from met to breached.
Overview
Fixes a compliance bug where completed FSMA recall drills with
completed_atbeforestarted_atcould still reportsla_status=met, because a negativeduration_secondssatisfied<= 24h.RecallDrill.sla_statusnow only treats a finished drill as compliant when duration is0 <= duration <= 24h. Corrupt negative timings fail closed tobreached, reusing the existing non-compliant enum instead of adding a new API value. Instant completions (0s) remainmet.Adds timestamp-only tests (
-1s,-48h→ breached;0s→ met).Reviewed by Cursor Bugbot for commit eb35d96. Bugbot is set up for automated code reviews on this repo. Configure here.