Skip to content

Conversation

hakansa
Copy link
Member

@hakansa hakansa commented Sep 25, 2025

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

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/__

- 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.
@Copilot Copilot AI review requested due to automatic review settings September 25, 2025 12:29
Copy link
Contributor

@Copilot Copilot AI left a comment

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 enhances the SyncRequest protocol buffer message with network map serial tracking functionality to optimize synchronization processes between clients and management servers.

  • 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
  • Improved system info handling to ensure accurate metadata is sent with sync requests

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
shared/management/proto/management.proto Added networkMapSerial field to SyncRequest message
shared/management/proto/management.pb.go Auto-generated protobuf code with new field and getter method
shared/management/client/grpc.go Updated client to track network map serial and recompute system info for sync requests

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment on lines 232 to 243
recomputed.SetFlags(
sysInfo.RosenpassEnabled,
sysInfo.RosenpassPermissive,
&sysInfo.ServerSSHAllowed,
sysInfo.DisableClientRoutes,
sysInfo.DisableServerRoutes,
sysInfo.DisableDNS,
sysInfo.DisableFirewall,
sysInfo.BlockLANAccess,
sysInfo.BlockInbound,
sysInfo.LazyConnectionEnabled,
)
Copy link
Preview

Copilot AI Sep 25, 2025

Choose a reason for hiding this comment

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

[nitpick] The manual copying of individual flags is error-prone and difficult to maintain. Consider implementing a method like MergeFlags() or CopyFlags() on the system.Info struct to handle this logic centrally and reduce the risk of missing fields when new flags are added.

Suggested change
recomputed.SetFlags(
sysInfo.RosenpassEnabled,
sysInfo.RosenpassPermissive,
&sysInfo.ServerSSHAllowed,
sysInfo.DisableClientRoutes,
sysInfo.DisableServerRoutes,
sysInfo.DisableDNS,
sysInfo.DisableFirewall,
sysInfo.BlockLANAccess,
sysInfo.BlockInbound,
sysInfo.LazyConnectionEnabled,
)
recomputed.CopyFlagsFrom(sysInfo)

Copilot uses AI. Check for mistakes.

Copy link

- Removed atomic operations for lastNetworkMapSerial and replaced them with mutex-based methods for thread-safe access.
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.

1 participant