[PR #4546] [client] Enhance SyncRequest with NetworkMap serial tracking #20640

Open
opened 2026-08-05 05:07:31 -04:00 by saavagebueno · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/netbirdio/netbird/pull/4546
Author: @hakansa
Created: 9/25/2025
Status: 🔄 Open

Base: mainHead: feat/network-map-serial


📝 Commits (7)

  • 4b2cd97 [client] Enhance SyncRequest with NetworkMap serial tracking
  • f241bfa Refactor flag setting in Info struct to use CopyFlagsFrom method
  • d0c65fa [client] Add skipNetworkMapUpdate field to SyncResponse for conditional updates
  • fc141cf [client] Refactor lastNetworkMapSerial handling in GrpcClient
  • 20f5f00 [client] Add unit tests for engine synchronization and Info flag copying
  • b5dec3d Track network serial in engine
  • a1f1bf1 Merge branch 'main' into feat/network-map-serial

📊 Changes

11 files changed (+264 additions, -41 deletions)

View changed files

📝 client/internal/engine.go (+2 -2)
client/internal/engine_sync_test.go (+79 -0)
📝 client/internal/engine_test.go (+1 -1)
📝 client/system/info.go (+20 -0)
📝 client/system/info_test.go (+84 -0)
📝 shared/management/client/client.go (+1 -1)
📝 shared/management/client/client_test.go (+1 -1)
📝 shared/management/client/grpc.go (+17 -7)
📝 shared/management/client/mock.go (+3 -3)
📝 shared/management/proto/management.pb.go (+51 -26)
📝 shared/management/proto/management.proto (+5 -0)

📄 Description

Describe your changes

  • Added networkMapSerial field to SyncRequest for tracking the last known network map serial number.
  • Updated GrpcClient to store and utilize the last network map serial during sync operations, optimizing synchronization processes.
  • Improved handling of system info updates to ensure accurate metadata is sent with sync requests.

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

    • Improved network synchronization logic with enhanced null checks for network map updates.
    • Added support for skipping network map updates when flagged, preventing unnecessary processing.
  • Tests

    • Added test coverage for network synchronization edge cases, including nil network maps and skip flags.

✏️ Tip: You can customize this high-level summary in your review settings.


🔄 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/4546 **Author:** [@hakansa](https://github.com/hakansa) **Created:** 9/25/2025 **Status:** 🔄 Open **Base:** `main` ← **Head:** `feat/network-map-serial` --- ### 📝 Commits (7) - [`4b2cd97`](https://github.com/netbirdio/netbird/commit/4b2cd97d5fe5b15dc0b355ec3fec0b7d1c8ea621) [client] Enhance SyncRequest with NetworkMap serial tracking - [`f241bfa`](https://github.com/netbirdio/netbird/commit/f241bfa3396e53dd821c90478215044500816c8b) Refactor flag setting in Info struct to use CopyFlagsFrom method - [`d0c65fa`](https://github.com/netbirdio/netbird/commit/d0c65fa08e3060d8bbc5150d1b3ffdeed9fcfce5) [client] Add skipNetworkMapUpdate field to SyncResponse for conditional updates - [`fc141cf`](https://github.com/netbirdio/netbird/commit/fc141cf3a31e5b16637b1681c6965e9288e4e895) [client] Refactor lastNetworkMapSerial handling in GrpcClient - [`20f5f00`](https://github.com/netbirdio/netbird/commit/20f5f0063511bf8d93a8e38206d6e7d5fc87c5ac) [client] Add unit tests for engine synchronization and Info flag copying - [`b5dec3d`](https://github.com/netbirdio/netbird/commit/b5dec3df393e2d569547f3816bb326561162e095) Track network serial in engine - [`a1f1bf1`](https://github.com/netbirdio/netbird/commit/a1f1bf1f19e62db264fedac72b868abe958e5952) Merge branch 'main' into feat/network-map-serial ### 📊 Changes **11 files changed** (+264 additions, -41 deletions) <details> <summary>View changed files</summary> 📝 `client/internal/engine.go` (+2 -2) ➕ `client/internal/engine_sync_test.go` (+79 -0) 📝 `client/internal/engine_test.go` (+1 -1) 📝 `client/system/info.go` (+20 -0) 📝 `client/system/info_test.go` (+84 -0) 📝 `shared/management/client/client.go` (+1 -1) 📝 `shared/management/client/client_test.go` (+1 -1) 📝 `shared/management/client/grpc.go` (+17 -7) 📝 `shared/management/client/mock.go` (+3 -3) 📝 `shared/management/proto/management.pb.go` (+51 -26) 📝 `shared/management/proto/management.proto` (+5 -0) </details> ### 📄 Description ## Describe your changes - Added `networkMapSerial` field to `SyncRequest` for tracking the last known network map serial number. - Updated `GrpcClient` to store and utilize the last network map serial during sync operations, optimizing synchronization processes. - Improved handling of system info updates to ensure accurate metadata is sent with sync requests. ## Issue ticket number and link ## Stack <!-- branch-stack --> ### Checklist - [ ] Is it a bug fix - [ ] Is a typo/documentation fix - [x] 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** * Improved network synchronization logic with enhanced null checks for network map updates. * Added support for skipping network map updates when flagged, preventing unnecessary processing. * **Tests** * Added test coverage for network synchronization edge cases, including nil network maps and skip flags. <sub>✏️ Tip: You can customize this high-level summary in your review settings.</sub> <!-- 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 05:07:31 -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#20640