Skip to content

Fix group and resource order in resource group audit events - #804

Merged
heisbrot merged 1 commit into
mainfrom
fix/audit-log-resource-group-swap
Sep 17, 2026
Merged

heisbrot merged 1 commit into
mainfrom
fix/audit-log-resource-group-swap

Conversation

@SunsetDrifter

@SunsetDrifter SunsetDrifter commented Sep 15, 2026

Copy link
Copy Markdown
Contributor

Problem

In the audit log, the resource.group.add and resource.group.delete entries name the two objects the wrong way round. An event for a resource added to a group renders as:

Group <resource name> added to resource <group name>

The same swap shows on the "removed from resource" line.

Cause

Management emits these events with the group as the event target: meta.name is the group and meta.resource_name is the network resource (Group.EventMetaResource in management/server/types/group.go). ActivityDescription.tsx read the two keys into the opposite slots.

Fix

Read meta.name as the group and meta.resource_name as the resource in both templates. Display only, the stored event and the streamed meta are unchanged.

Issue ticket number and link

Reported by a customer through support.

Documentation

Select exactly one:

  • I added/updated documentation for this change
  • Documentation is not needed for this change (explain why)

Cosmetic correction of an existing audit log message, no behaviour or API change.

Docs PR URL (required if "docs added" is checked)

Paste the PR link from https://github.com/netbirdio/docs here:

N/A

E2E tests

Optional: override the image tags used by the Playwright e2e workflow.
Defaults to main when omitted.

management-cloud-tag: main
reverse-proxy-tag: main

Summary by CodeRabbit

  • Bug Fixes

    • Corrected activity messages for group additions and removals so they display the group name and associated resource in the proper fields.
  • Tests

    • Added coverage to verify that group-added and group-removed activity entries show accurate, readable descriptions.

@coderabbitai

coderabbitai Bot commented Sep 15, 2026

Copy link
Copy Markdown
Contributor

Review Change StackReview Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Advanced

Run ID: 3f8f202b-3bd8-4cc6-a1a1-150aff3efe06

📥 Commits

Reviewing files that changed from the base of the PR and between da81cb7 and d7bea26.

📒 Files selected for processing (2)
  • src/modules/activity/ActivityDescription.test.tsx
  • src/modules/activity/ActivityDescription.tsx

Included review availability: Your plan provides up to 4 included reviews per hour; 3 remain after this review.


📝 Walkthrough

Walkthrough

The change corrects group and resource name placement in add and delete activity descriptions. A new test suite verifies both rendered messages.

Changes

Activity description correction

Layer / File(s) Summary
Group and resource message mapping
src/modules/activity/ActivityDescription.tsx, src/modules/activity/ActivityDescription.test.tsx
The add and delete messages now render m.name as the group and m.resource_name as the resource. Tests verify both rendered descriptions.

Priority: ⬇️ Low

Estimated code review effort: 2 (Simple) | ~5 minutes

Change: Bug fix

Suggested reviewers: mlsmaycon

Merge Risk: ⚪ Minimal · up to d7bea

This display-only correction aligns activity descriptions with the emitted event metadata without changing stored events or APIs.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 1 functions across 2 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely identifies the correction to the group and resource order in audit events.
Description check ✅ Passed The description explains the problem, cause, fix, documentation decision, and test configuration. It does not provide an issue ticket number or link, although the remaining required sections are compl…
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/audit-log-resource-group-swap

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

A rabbit checks the group name bright
The resource now sits in the right
Add and delete both speak true
Tests hop along to check them too
Neat fields make the trail just right

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

@heisbrot
heisbrot merged commit 74eae99 into main Sep 17, 2026
9 checks passed
@heisbrot
heisbrot deleted the fix/audit-log-resource-group-swap branch September 17, 2026 07:54
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