Skip to content

Fix Invalidation issue when datachecker is changed#384

Open
datamik wants to merge 4 commits into
developfrom
bugfix/314710-502-when-saving-datachecker-realated-models
Open

Fix Invalidation issue when datachecker is changed#384
datamik wants to merge 4 commits into
developfrom
bugfix/314710-502-when-saving-datachecker-realated-models

Conversation

@datamik
Copy link
Copy Markdown
Contributor

@datamik datamik commented May 7, 2026

AB#314710

Summary
Editing DataChecker-related models in Django admin triggered post_save signals that bulk-invalidated every validated household and individual in every program using that checker. A single form save could fire many signals (parent + inlines), so the same programs were invalidated repeatedly.

Problem

  • Saving DataChecker itself (e.g. name/description) ran full invalidation even though those fields do not affect validation rules.
  • Saving Fieldset, FlexField, or DataCheckerFieldset via admin (often several .save() calls per submit) re-ran invalidation for the same programs on each signal.

Fix

  • Signals — Stop listening to DataChecker post_save. Composition changes are still handled via DataCheckerFieldset (and related models).
  • Admin — Override hope_flex_fields admins (DataChecker, Fieldset, FlexField) to wrap POST saves in collect_invalidations(), so all signals in one form submit defer invalidation and each program is processed once at the end. FieldsetAdmin.all_fields is wrapped the same way.

@codecov
Copy link
Copy Markdown

codecov Bot commented May 7, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 96.93%. Comparing base (955bc7c) to head (11ada58).

Additional details and impacted files
@@           Coverage Diff            @@
##           develop     #384   +/-   ##
========================================
  Coverage    96.92%   96.93%           
========================================
  Files          237      238    +1     
  Lines         9759     9783   +24     
  Branches      1081     1081           
========================================
+ Hits          9459     9483   +24     
  Misses         143      143           
  Partials       157      157           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@domdinicola
Copy link
Copy Markdown
Contributor

@datamik resume

@datamik datamik force-pushed the bugfix/314710-502-when-saving-datachecker-realated-models branch from 17f654e to 1efb91a Compare June 2, 2026 08:04
@datamik datamik force-pushed the bugfix/314710-502-when-saving-datachecker-realated-models branch from c339524 to 11ada58 Compare June 2, 2026 15:12
@datamik datamik marked this pull request as ready for review June 3, 2026 08:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants