Skip to content

feat: add audit_pass notification event - #5986

Open
ChrisJr404 wants to merge 1 commit into
SQLMesh:mainfrom
ChrisJr404:audit-pass-notification
Open

feat: add audit_pass notification event#5986
ChrisJr404 wants to merge 1 commit into
SQLMesh:mainfrom
ChrisJr404:audit-pass-notification

Conversation

@ChrisJr404

Copy link
Copy Markdown

Description

Closes #5865.

Audit failures can already be sent to notification targets, but passes cannot, so there is no way to track successful audits through the notification system without re-running them via the Python API or writing a custom target that only ever sees failures.

This adds an AUDIT_PASS notification event. When a non-blocking or blocking audit runs and returns no failing rows, Scheduler._audit_snapshot now fires AUDIT_PASS in the same place it already fires AUDIT_FAILURE for failing audits. Skipped audits are neither a pass nor a failure, so they don't notify. The event carries the audit name and the model name.

Nothing changes by default. A target only receives these notifications if audit_pass is in its notify_on set, so existing configs behave exactly as before.

notification_targets:
  - type: slack_webhook
    url: ...
    notify_on:
      - audit_pass
      - audit_failure

Test plan

  • Added a notify_audit_pass unit test covering the message with and without a model name.
  • Extended test_audit_failure_notifications so the passing-audit case asserts AUDIT_PASS fires (global and to the owner) and the skipped case still fires nothing.
  • ruff check, ruff format --check, and mypy clean on the changed files.
  • pytest tests/core/test_notification_target.py tests/core/test_scheduler.py passes (27 tests).

Checklist

  • I have run make style and fixed any issues.
  • I have added tests for my changes.
  • All existing tests pass.
  • My commits are signed off per the DCO.

Signed-off-by: Chris (ChrisJr404) <11917633+ChrisJr404@users.noreply.github.com>
@StuffbyYuki

Copy link
Copy Markdown
Collaborator

@ChrisJr404 Thanks for this PR! No blocker but one thought: passing audit_name / model_name into send() the way failures already pass audit_error=? Let me know!

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.

(Feature Request) Add "audit pass" as a notification event

2 participants