[PR #5405] [MERGED] [management] check policy for changes before actual db update #22941

Closed
opened 2026-08-05 06:06:35 -04:00 by saavagebueno · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/netbirdio/netbird/pull/5405
Author: @crn4
Created: 2/20/2026
Status: Merged
Merged: 4/21/2026
Merged by: @crn4

Base: mainHead: fix/policy-upd


📝 Commits (5)

  • 23d4de3 [management] check policy for changes before actual db update
  • 5099acc Merge branch 'main' into fix/policy-upd
  • cd9bff5 minor changes
  • 7950db4 add trace log for skipped update
  • 13e27a9 minor change

📊 Changes

5 files changed (+595 additions, -39 deletions)

View changed files

📝 management/server/policy.go (+65 -39)
📝 management/server/types/policy.go (+38 -0)
management/server/types/policy_test.go (+193 -0)
📝 management/server/types/policyrule.go (+105 -0)
management/server/types/policyrule_test.go (+194 -0)

📄 Description

Describe your changes

Stack

Checklist

  • Is it a bug fix
  • Is a typo/documentation fix
  • Is a feature enhancement
  • It is a refactor
  • Created tests that fail without the change (if possible)

By submitting this pull request, you confirm that you have read and agree to the terms of the Contributor License Agreement.

Documentation

Select exactly one:

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

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

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

https://github.com/netbirdio/docs/pull/__

Summary by CodeRabbit

  • Bug Fixes

    • Policy updates are now optimized to skip unnecessary changes, preventing redundant operations and event emissions when no actual policy modifications occur.
  • Tests

    • Added comprehensive test coverage for policy comparison and normalization logic.

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/netbirdio/netbird/pull/5405 **Author:** [@crn4](https://github.com/crn4) **Created:** 2/20/2026 **Status:** ✅ Merged **Merged:** 4/21/2026 **Merged by:** [@crn4](https://github.com/crn4) **Base:** `main` ← **Head:** `fix/policy-upd` --- ### 📝 Commits (5) - [`23d4de3`](https://github.com/netbirdio/netbird/commit/23d4de39573b29b2319ac89d52f63640009b008c) [management] check policy for changes before actual db update - [`5099acc`](https://github.com/netbirdio/netbird/commit/5099acc44ad4e83a709784e220d93ae7d9386481) Merge branch 'main' into fix/policy-upd - [`cd9bff5`](https://github.com/netbirdio/netbird/commit/cd9bff50b7adb4cf3f397f5a5e36aaad30a34ac7) minor changes - [`7950db4`](https://github.com/netbirdio/netbird/commit/7950db475f9b9633637c30f7cfb93a6d3bc763e4) add trace log for skipped update - [`13e27a9`](https://github.com/netbirdio/netbird/commit/13e27a9db09c9f4b9261cfe4c1402dee65fb150c) minor change ### 📊 Changes **5 files changed** (+595 additions, -39 deletions) <details> <summary>View changed files</summary> 📝 `management/server/policy.go` (+65 -39) 📝 `management/server/types/policy.go` (+38 -0) ➕ `management/server/types/policy_test.go` (+193 -0) 📝 `management/server/types/policyrule.go` (+105 -0) ➕ `management/server/types/policyrule_test.go` (+194 -0) </details> ### 📄 Description ## Describe your changes ## Issue ticket number and link ## Stack <!-- branch-stack --> ### Checklist - [x] Is it a bug fix - [ ] Is a typo/documentation fix - [ ] Is a feature enhancement - [ ] It is a refactor - [ ] Created tests that fail without the change (if possible) > By submitting this pull request, you confirm that you have read and agree to the terms of the [Contributor License Agreement](https://github.com/netbirdio/netbird/blob/main/CONTRIBUTOR_LICENSE_AGREEMENT.md). ## Documentation Select exactly one: - [ ] I added/updated documentation for this change - [x] Documentation is **not needed** for this change (explain why) ### Docs PR URL (required if "docs added" is checked) Paste the PR link from https://github.com/netbirdio/docs here: https://github.com/netbirdio/docs/pull/__ <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Bug Fixes** * Policy updates are now optimized to skip unnecessary changes, preventing redundant operations and event emissions when no actual policy modifications occur. * **Tests** * Added comprehensive test coverage for policy comparison and normalization logic. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
saavagebueno added the pull-request label 2026-08-05 06:06:35 -04:00
Sign in to join this conversation.
No Label pull-request
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: DYNR/netbird#22941