[PR #1891] Refactor Route IDs #3239

Open
opened 2025-11-20 08:05:24 -05:00 by saavagebueno · 0 comments
Owner

Original Pull Request: https://github.com/netbirdio/netbird/pull/1891

State: closed
Merged: Yes


Describe your changes

We have at least 3 distinct IDs in use for routes:

  • ID in route.Route, which is the ID in the database
  • NetID in route.Route, which is the Name/ID in the dashboard
  • HAUniqueID which is a combination of Route.NetID and Route.Network

Having so many IDs using all string it's hard to distinguish them from each other.
This PR refactors the IDs to use dedicated types to avoid mixing them up.
Conversions from/to string must be done explicitly. Conversions between the types must not happen.

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)
  • Extended the README / documentation, if necessary
**Original Pull Request:** https://github.com/netbirdio/netbird/pull/1891 **State:** closed **Merged:** Yes --- ## Describe your changes We have at least 3 distinct IDs in use for routes: - `ID` in `route.Route`, which is the ID in the database - `NetID` in `route.Route`, which is the Name/ID in the dashboard - `HAUniqueID` which is a combination of `Route.NetID` and `Route.Network` Having so many IDs using all `string` it's hard to distinguish them from each other. This PR refactors the IDs to use dedicated types to avoid mixing them up. Conversions from/to `string` must be done explicitly. Conversions between the types must not happen. ## Issue ticket number and link ### Checklist - [ ] Is it a bug fix - [ ] Is a typo/documentation fix - [ ] Is a feature enhancement - [x] It is a refactor - [ ] Created tests that fail without the change (if possible) - [ ] Extended the README / documentation, if necessary
saavagebueno added the pull-request label 2025-11-20 08:05:24 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: SVI/netbird#3239