[PR #6522] [MERGED] [management] Optimize affected posture checks and add logs #29613

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

📋 Pull Request Information

Original PR: https://github.com/netbirdio/netbird/pull/6522
Author: @mlsmaycon
Created: 6/23/2026
Status: Merged
Merged: 6/25/2026
Merged by: @pascal-fischer

Base: mainHead: add-trace-update-logs


📝 Commits (10+)

  • 49c8d57 Add enhanced logging for account peer updates and debugging
  • 58cd0ea Add trace logging to UpdateAffectedPeers function for debugging purposes
  • b4c1db1 Improve peer location update logic and posture check condition handling
  • 4b89f3b add affected meta and update trigger logging
  • 330a03c Add unit tests for posture checks and peer location resolution logic
  • 3d4a70d Merge remote-tracking branch 'origin/add-trace-update-logs' into add-trace-update-logs
  • ecd133c Add context parameter to AffectsPosture function in unit tests
  • 7f24dc5 fix early return on affectsPosture
  • 45b88cb Merge remote-tracking branch 'origin/main' into add-trace-update-logs
  • 46cb0ac use string var

📊 Changes

3 files changed (+167 additions, -5 deletions)

View changed files

📝 management/internals/controllers/network_map/controller/controller.go (+1 -1)
���� management/server/peer.go (+27 -4)
📝 management/server/peer_test.go (+139 -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)
  • This change does not modify the public API, gRPC protocols, functionality behavior, CLI / service flags, or introduce a new feature — OR I have discussed it with the NetBird team beforehand (link the issue / Slack thread in the description). See CONTRIBUTING.md.

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
    • Improved peer geo updates by resolving location first, ensuring location changes are detected even when only the geo details differ.
    • Network map refreshes now trigger more consistently based on meaningful peer changes (status, connectivity capabilities, metadata/posture, version, and hostname).
    • Peer updates are now skipped only when both the connection address and stored location details are unchanged, reducing missed updates.
  • Tests
    • Added unit coverage for peer location resolution, including failure and no-change scenarios.

🔄 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/6522 **Author:** [@mlsmaycon](https://github.com/mlsmaycon) **Created:** 6/23/2026 **Status:** ✅ Merged **Merged:** 6/25/2026 **Merged by:** [@pascal-fischer](https://github.com/pascal-fischer) **Base:** `main` ← **Head:** `add-trace-update-logs` --- ### 📝 Commits (10+) - [`49c8d57`](https://github.com/netbirdio/netbird/commit/49c8d571b224117e6242c7dbada3666f51b523c3) Add enhanced logging for account peer updates and debugging - [`58cd0ea`](https://github.com/netbirdio/netbird/commit/58cd0eae4edcaf6dc7fbb65c61f0969bb1becd3f) Add trace logging to UpdateAffectedPeers function for debugging purposes - [`b4c1db1`](https://github.com/netbirdio/netbird/commit/b4c1db17e458569e8422a45b39e5e7b96df193f6) Improve peer location update logic and posture check condition handling - [`4b89f3b`](https://github.com/netbirdio/netbird/commit/4b89f3be8af78c730832094d0a65ca0ec593e5db) add affected meta and update trigger logging - [`330a03c`](https://github.com/netbirdio/netbird/commit/330a03ce754a417b12d819fa11b15f7786ed4c25) Add unit tests for posture checks and peer location resolution logic - [`3d4a70d`](https://github.com/netbirdio/netbird/commit/3d4a70deebe54c2f33fc33f685d585ed875c37fc) Merge remote-tracking branch 'origin/add-trace-update-logs' into add-trace-update-logs - [`ecd133c`](https://github.com/netbirdio/netbird/commit/ecd133ca701a796ee6bc52ba21fe5484f7be979f) Add context parameter to AffectsPosture function in unit tests - [`7f24dc5`](https://github.com/netbirdio/netbird/commit/7f24dc5fa7efcde451647e60d1daca990a174a80) fix early return on affectsPosture - [`45b88cb`](https://github.com/netbirdio/netbird/commit/45b88cbf21eebc8db36704cc8b9937ec944497b5) Merge remote-tracking branch 'origin/main' into add-trace-update-logs - [`46cb0ac`](https://github.com/netbirdio/netbird/commit/46cb0ac91cfb0bb63ca9b43c518f86171234bb53) use string var ### 📊 Changes **3 files changed** (+167 additions, -5 deletions) <details> <summary>View changed files</summary> 📝 `management/internals/controllers/network_map/controller/controller.go` (+1 -1) ���� `management/server/peer.go` (+27 -4) 📝 `management/server/peer_test.go` (+139 -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) - [ ] This change does **not** modify the public API, gRPC protocols, functionality behavior, CLI / service flags, or introduce a new feature — **OR** I have discussed it with the NetBird team beforehand (link the issue / Slack thread in the description). See [CONTRIBUTING.md](https://github.com/netbirdio/netbird/blob/main/CONTRIBUTING.md#discuss-changes-with-the-netbird-team-first). > 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** * Improved peer geo updates by resolving location first, ensuring location changes are detected even when only the geo details differ. * Network map refreshes now trigger more consistently based on meaningful peer changes (status, connectivity capabilities, metadata/posture, version, and hostname). * Peer updates are now skipped only when both the connection address and stored location details are unchanged, reducing missed updates. * **Tests** * Added unit coverage for peer location resolution, including failure and no-change scenarios. <!-- 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 08:08:29 -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#29613