Skip to content

Changelog

1.0.1 (2026-11-16)

Fixed:

  • Side-effect reports and recursion chains name a decorated receiver after its function, not the decorator's wrapper (such as disable_for_loaddata.<locals>.wrapper), when the decorator uses functools.wraps. IGNORE_RECEIVERS and baselines now see the real name, so receivers that share a decorator are told apart. A receiver of yours behind a decorator from an installed package was taken for library code, and its side effects went unreported; they are reported now.
  • Paths in reports stay relative to the project for code compiled on another machine. pytest before 9.2 reuses the rewritten test modules it cached on the host, so a baseline written in a container that mounts the project could get host paths such as /Users/me/project/conftest.py, which match nowhere else.

If your baseline has entries naming a <locals>.wrapper receiver or an absolute path, regenerate it after upgrading: pytest --signal-guard-baseline=FILE --signal-guard-update-baseline.

1.0.0 (2026-11-13)

The first stable release. From here on, the public API follows semantic versioning: see the stability policy.

Changed defaults (see upgrading to 1.0):

  • LIBRARY_RECEIVERS is now "ignore_global": receivers from installed packages connected for every sender (easy_thumbnails, imagekit and the like) no longer make every bulk write report. Set "report" for the 0.x behaviour.
  • IGNORE_HISTORICAL_MODELS is now True: bulk writes in data migrations are not checked. Set False for the 0.x behaviour.

Added:

  • signal_guard.testing, assertions for tests:
  • capture_reports(), assert_no_reports(), assert_bypass(), assert_side_effect() and assert_recursion(), which collect reports instead of raising, warning or logging them;
  • capture_signals(), assert_sent() and assert_not_sent(), which record the signals sent and their arguments;
  • assert_connected() and assert_not_connected();
  • pytest fixtures signal_reports and sent_signals, and SignalGuardAssertionsMixin for unittest test cases.
  • A baseline for adopting the guard on an existing codebase: pytest --signal-guard-baseline=FILE silences the reports listed in FILE and fails the run on new ones; --signal-guard-update-baseline writes it. Also as the signal_guard_baseline ini option. Works with pytest-xdist.
  • Reports carry where (path::function), a stable fingerprint and the error with structured details.
  • benchmarks/overhead.py, run in CI, measures what each wrapper adds.
  • Documentation at https://panosangelopoulos.github.io/django-signal-guard/.

Changed:

  • Settings are read once and again when setting_changed is sent (as by override_settings and pytest-django's settings fixture), instead of on every call. A bulk write on a model with receivers costs about 2 µs less.
  • Bulk writes on models without save receivers skip the guard sooner.
  • The package's own modules never count as first-party, even when installed in editable mode.

0.4.0 (2026-11-13)

Added, all off by default, to cut noise on large projects:

  • LIBRARY_RECEIVERS: "ignore_global" stops the bypass guard reporting receivers from installed packages connected for every sender, such as easy_thumbnails' and imagekit's; "ignore" skips all library receivers.
  • IGNORE_HISTORICAL_MODELS: skip bulk writes on the historical models migrations use.
  • IGNORE_CREATE_ONLY_RECEIVERS: for update() and bulk_update(), skip post_save receivers whose source shows they only act when created. A heuristic.
  • IGNORE_RECEIVER_SELF_UPDATES: skip bulk writes a pre_save or post_save receiver makes to its own model.

Also added:

  • allow_side_effect(reason=...), a context manager and decorator that allows side effects before commit, like allow_bypass does for bulk writes.
  • A pytest plugin: pytest --signal-guard-summary lists reports by call site, with counts and the tests that hit them. Works with pytest-xdist.
  • Log records carry signal_guard_kind, signal_guard_location and signal_guard_test (the running pytest node id).
  • SkippedReceiver has module, any_sender and create_only.

Changed (report text only; what gets reported is unchanged unless noted):

  • A task queued from a pre_delete or post_delete receiver is reported with advice that on_commit() alone won't help, since the row is gone by then.
  • Bypass reports mark receivers that look create-only with [create-only?], and say when the write runs inside a save receiver for the same model.
  • A manager or queryset that overrides update(), bulk_update() or bulk_create() is no longer reported as the call site; the caller is, with the override after "through". When the override was in an installed package, these writes used to be skipped as library calls; they are now reported.
  • Side-effect reports blame the first line of your own code inside the receiver, not a line in a vendor SDK it called.

Fixed:

  • Paths in reports are relative to the project even when a file was reached through a symlink or another spelling of the folder, and relative to settings.BASE_DIR when the current folder is outside it.

0.3.0 (2026-11-13)

  • Recursion tracing: a receiver that sends the same signal for the same object while it is already being handled twice is reported with the whole chain, such as a post_save receiver that calls instance.save(). New setting RECURSION, SignalRecursionError and SignalRecursionWarning.
  • @receiver_on_commit: like @receiver, but runs the receiver through transaction.on_commit() with the arguments the signal sent.
  • Side effects before commit: email, Celery tasks, requests and httpx calls made by a receiver inside a transaction that has not committed are reported. Transactions opened by TestCase do not count. New settings SIDE_EFFECTS and SIDE_EFFECT_CALLS, SideEffectBeforeCommitError and SideEffectBeforeCommitWarning.
  • @bulk_safe works on either side of @receiver_on_commit; system checks W001 and W004, the registry and signal_map see through its wrapper.
  • IGNORE_RECEIVERS and CHECK_LIBRARY_CALLS apply to the new checks.

0.2.0 (2026-11-13)

  • System checks, tag signals:
  • W001: a module defines @receiver functions but is never imported.
  • W002: a receiver is connected only after startup, by a lazy import.
  • W003: a weakly connected function or lambda was garbage-collected.
  • W004: the same receiver is connected more than once.
  • manage.py signal_map, with --all, --write and --check for a committed signals.lock file.
  • A registry of connect() and disconnect() calls behind the checks.
  • New settings FIRST_PARTY and LOCK_FILE.
  • Changed: CHECK_DJANGO_INTERNALS is now CHECK_LIBRARY_CALLS and also skips bulk writes made inside installed packages, not only Django.
  • Fixed: never ask a lazy object for its class while looking for signals.

0.1.0 (not published)

First release: the bypass guard.

  • Wraps QuerySet.bulk_create(), bulk_update() and update() (and their async variants) and reports live pre_save / post_save receivers they would skip.
  • Modes raise, warn, log and off via SIGNAL_GUARD['BYPASS'].
  • allow_bypass(*models, reason=...) as a context manager, decorator and async with.
  • @bulk_safe marker and IGNORE_RECEIVERS patterns.
  • Bulk writes made by Django itself are skipped unless CHECK_DJANGO_INTERNALS is on (renamed in 0.2.0).