Refactor Slack notifications: severity-aware, human-centered format#9
Merged
Merged
Conversation
- Replace flat title+bullets layout with structured 4-section messages:
1) Change Summary (impacted endpoints and schema changes)
2) Impact (what it means for clients)
3) Docs Status (what was regenerated)
4) Action (what the reader needs to do)
- Severity inferred from drift data: green/yellow/red circle emoji
- Header format: '{emoji} Docs Drift Guard | {Severity Label}'
- No more bell emoji, no alarmist tone for non-breaking changes
- Dedicated build_drift_message() function for deterministic output
- Separate send_drift_notification() and send_audit_notification()
- Existing webhook integration preserved
Co-Authored-By: unknown <>
Contributor
Author
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Refactor Slack notifications: severity-aware, human-centered format
Summary
Replaces the flat
title + bullet list + contextSlack message format with a structured, severity-aware layout. Drift notifications now have 4 clearly labeled sections (Change Summary, Impact, Docs Status, Action) and a severity-colored header (🟢 Non-Breaking,🟡 Potentially Breaking,🔴 Breaking).slack_notify.pywas rewritten:send_slack_notification()removed; replaced bysend_drift_notification(DriftMessage)andsend_audit_notification(title, summary, context)build_drift_message()constructs aDriftMessagedataclass from the drift report's endpoint/schema lists_post_or_print()handles webhook posting or stdout fallbackguard.pycallers updated:cmd_checknow passes structured report data throughbuild_drift_message()→send_drift_notification()cmd_auditnow usessend_audit_notification()with a calmer title (no 🚨)Review & Testing Checklist for Human
infer_severity()checks for"lost field"and"gained field"substrings inschema_changesentries. These strings are generated bydrift_detect.py:DriftReport.as_bullet_list(). If the wording there ever changes, severity silently falls through toPOTENTIALLY_BREAKINGinstead of the correct level. Verify you're comfortable with this coupling, or whether severity should be a first-class property ofDriftReportinstead.send_slack_notification()was deleted: This is a breaking API change. Confirm nothing else imports it — check CI workflow, pre-commit hook scripts, and any test files that might reference the old function name.tier3_draftedis accepted but never passed asTrue:build_drift_message()has atier3_draftedparam butguard.pynever sets it. The "Migration guidance draft added" line is unreachable. Decide whether to remove it or wire it up."🚨 API Call Guard: Runtime mismatches detected"to"Runtime Audit | API call mismatches detected"and the:warning:Slack emoji was dropped from context. Verify this is the tone you want for audit alerts.Test Plan
uvicorn app.main:app --host 0.0.0.0 --port 8000 --reloadpython -m drift_guard.guard baselinerolefield, runcheck, verify Slack payload shows🟢 Non-Breakingwith "No action required"check, verify Slack payload shows🔴 Breakingwith "Review required before merge"python -m drift_guard.guard audit, verify Slack payload uses the new audit formatsend_slack_notification)Notes