You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Chemistry backfill test cleanup should handle errors gracefully #566
Identified during review of #558 (558-radionuclides-backfill branch).
Problem
The after_scenario cleanup for chemistry backfill data in environment.py (lines ~747–835) performs a long chain of FK-ordered deletes with no try/except. If any single delete fails (e.g., an unexpected FK dependency), the session.commit() never runs, all cleanup is lost, and orphan data causes cascading failures in subsequent test scenarios.
Fix
Wrap the cleanup block in try/except. On failure, log the scenario name and error with exc_info=True so developers can diagnose. Consider a fallback that deletes observations by nma_pk_chemistryresults IS NOT NULL as a safety net.
Activity
github-actions commentedon Feb 28, 2026
Linked Jira ticket created: BDMS-617
fix: harden chemistry backfill test cleanup