Skip to content

Fix #7983: Add EDGE_IDENTITY to allowed integration audit events#8059

Open
srijantrpth wants to merge 3 commits into
Flagsmith:mainfrom
srijantrpth:7983-fix-slack-edge-identity
Open

Fix #7983: Add EDGE_IDENTITY to allowed integration audit events#8059
srijantrpth wants to merge 3 commits into
Flagsmith:mainfrom
srijantrpth:7983-fix-slack-edge-identity

Conversation

@srijantrpth

Copy link
Copy Markdown
  • I have read the Contributing Guide.
  • I have added information to docs/ if required so people know about the feature.
  • I have filled in the "Changes" section below.
  • I have filled in the "How did you test this code" section below.

Changes

Closes #7983

Please describe.
Added RelatedObjectType.EDGE_IDENTITY to the track_only_feature_related_events signal filter decorator in api/audit/signals.py. This ensures audit events triggered by identity flag overrides in Edge/SaaS environments are properly processed and sent to messaging integrations like Slack, Grafana, Datadog, and Webhooks.

How did you test this code?

Please describe.

  • Added a new unit test (test_send_audit_log_event_to_grafana__edge_identity__calls_expected) in api/tests/unit/audit/test_unit_audit_signals.py to cover EDGE_IDENTITY events.
  • Ran the specific test file locally using uv run pytest to verify that the audit signal properly triggers integration events for edge identities.

Copilot AI review requested due to automatic review settings July 21, 2026 14:57
@srijantrpth
srijantrpth requested a review from a team as a code owner July 21, 2026 14:57
@srijantrpth
srijantrpth requested review from emyller and removed request for a team July 21, 2026 14:57
@vercel

vercel Bot commented Jul 21, 2026

Copy link
Copy Markdown

@srijantrpth is attempting to deploy a commit to the Flagsmith Team on Vercel.

A member of the Team first needs to authorize it.

@coderabbitai

coderabbitai Bot commented Jul 21, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 86315319-44e2-4ec0-bb0b-a603d784ac0f

📥 Commits

Reviewing files that changed from the base of the PR and between b97fc8e and cf1ffa8.

📒 Files selected for processing (1)
  • api/tests/unit/audit/test_unit_audit_signals.py

📝 Walkthrough

Walkthrough

The audit signal filter now allows EDGE_IDENTITY events to proceed to downstream receivers. A unit test verifies that Grafana handling uses the project configuration and calls event generation and asynchronous tracking through GrafanaWrapper.

Estimated code review effort: 1 (Trivial) | ~5 minutes


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions github-actions Bot added the api Issue related to the REST API label Jul 21, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the audit-log integration signal filtering so that audit events created for Edge identity flag overrides (EDGE_IDENTITY) are forwarded to messaging / observability integrations (e.g. Slack, Grafana, Datadog, Webhooks), closing the gap described in #7983.

Changes:

  • Extend track_only_feature_related_events to include RelatedObjectType.EDGE_IDENTITY.
  • Add a unit test to ensure the Grafana audit-log signal handler executes for EDGE_IDENTITY audit log records.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
api/audit/signals.py Allows EDGE_IDENTITY audit log records through the shared integration signal filter decorator.
api/tests/unit/audit/test_unit_audit_signals.py Adds a Grafana-focused unit test covering the EDGE_IDENTITY related object type.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread api/tests/unit/audit/test_unit_audit_signals.py
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@Zaimwa9

Zaimwa9 commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

@themis-blindfold review

@themis-blindfold

Copy link
Copy Markdown

⚖️ Themis judgement: ✅ Ship it

Adds EDGE_IDENTITY to the track_only_feature_related_events decorator so that audit events from edge identity flag overrides flow through to Datadog, New Relic, Dynatrace, Grafana, and Slack integrations. One-line fix with a well-structured regression test that exercises the full path (decorator + Grafana handler). The shared decorator architecture means proving one handler accepts the new type is sufficient coverage for all five.

CI shows three Vercel deployment preview failures, all of which are authorisation/config errors unrelated to this backend-only change. Pre-commit, CodeRabbit, and label checks passed.

🎯 Correctness 5/5
🧪 Test coverage 4/5
📐 Code quality 5/5
🚀 Product impact 3/5

⚖️ Acknowledged

  • generate_event_data assertion uses positional argument instead of keyword — thread resolved by @srijantrpth. The new test correctly uses keyword form matching the actual _track_event_async calling convention.
📝 Walkthrough
  • Audit signal filter (api/audit/signals.py) — EDGE_IDENTITY added to the allowed types in track_only_feature_related_events, enabling edge identity audit events to reach all integration handlers.
  • Regression test (api/tests/unit/audit/test_unit_audit_signals.py) — new test verifies the Grafana handler processes an EDGE_IDENTITY audit log end-to-end (decorator pass-through, wrapper instantiation, event generation, async tracking).
🧪 How to verify
  1. Run the new test: pytest api/tests/unit/audit/test_unit_audit_signals.py::test_send_audit_log_event_to_grafana__edge_identity__calls_expected -v
  2. Run the full audit signals test file to check for regressions: pytest api/tests/unit/audit/test_unit_audit_signals.py -v
  3. In a SaaS/Edge environment with a Grafana (or Datadog/Slack) integration configured, create an identity override and confirm the audit event appears in the integration.

Product take: Fixes a real gap where identity-level flag overrides in Edge environments silently skipped monitoring integrations. Users relying on Slack/Datadog/Grafana alerts for flag changes would have missed edge identity overrides entirely — solid improvement for observability coverage.

🧭 Assumptions & unverified claims

No unverified assumptions or claims.

One line to rule them all, one line to find them, one line to bring edge identities in and in the integrations bind them. · reviewed at cf1ffa8

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api Issue related to the REST API

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Slack integration doesn't notify on identity flag overrides (Edge / SaaS)

3 participants