[PR #6736] [MERGED] [management] Add agent_network_only account setting #29842

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

📋 Pull Request Information

Original PR: https://github.com/netbirdio/netbird/pull/6736
Author: @mlsmaycon
Created: 7/12/2026
Status: Merged
Merged: 7/12/2026
Merged by: @mlsmaycon

Base: mainHead: feature/agent-network-account-setting


📝 Commits (2)

  • cc3f8cb [management] Add agent_network_only account setting
  • 50cbe52 [management] Load agent_network_only in pgx account loader and cover persistence

📊 Changes

7 files changed (+111 additions, -2 deletions)

View changed files

📝 management/server/http/handlers/accounts/accounts_handler.go (+4 -0)
📝 management/server/http/handlers/accounts/accounts_handler_test.go (+64 -0)
📝 management/server/store/sql_store.go (+6 -2)
📝 management/server/store/sql_store_test.go (+25 -0)
📝 management/server/types/settings.go (+5 -0)
📝 shared/management/http/api/openapi.yml (+4 -0)
📝 shared/management/http/api/types.gen.go (+3 -0)

📄 Description

Describe your changes

Adds a per-account agent_network_only setting that lets the dashboard limit a
tenant's view to the Agent Network surface. The mark is applied by the dashboard
after signup (mirroring the AWS Marketplace enrich flow) and can be disabled
later by the user; the backend simply stores and returns it as a standard
account setting.

  • types.Settings.AgentNetworkOnly (+ Settings.Copy)
  • agent_network_only in the OpenAPI spec, types.gen.go regenerated
  • request/response mapping in the accounts handler (PUT/GET /accounts)
  • pgx GetAccount loader updated to select and scan the new column — without
    this the field silently reads back false in production (the gorm write path
    persists it, but the hand-written pgx read path lists columns explicitly)
  • store round-trip test covering enable→persist→disable, plus handler test
    cases toggling the setting

Defaults to false for new accounts; the value never reaches the peer client
(dashboard-only view setting, so it is not added to the sync conversion).

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)

The account setting's raw API field is generated automatically into the API
reference. The user-facing behavior it drives (the Agent Network focused view
and its opt-out) is documented in the docs PR below.

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


🔄 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/6736 **Author:** [@mlsmaycon](https://github.com/mlsmaycon) **Created:** 7/12/2026 **Status:** ✅ Merged **Merged:** 7/12/2026 **Merged by:** [@mlsmaycon](https://github.com/mlsmaycon) **Base:** `main` ← **Head:** `feature/agent-network-account-setting` --- ### 📝 Commits (2) - [`cc3f8cb`](https://github.com/netbirdio/netbird/commit/cc3f8cbc577b313060ba56dea553cda5dc1b7fff) [management] Add agent_network_only account setting - [`50cbe52`](https://github.com/netbirdio/netbird/commit/50cbe52498730170f5c5c429e87bee2b9c7db429) [management] Load agent_network_only in pgx account loader and cover persistence ### 📊 Changes **7 files changed** (+111 additions, -2 deletions) <details> <summary>View changed files</summary> 📝 `management/server/http/handlers/accounts/accounts_handler.go` (+4 -0) 📝 `management/server/http/handlers/accounts/accounts_handler_test.go` (+64 -0) 📝 `management/server/store/sql_store.go` (+6 -2) 📝 `management/server/store/sql_store_test.go` (+25 -0) 📝 `management/server/types/settings.go` (+5 -0) 📝 `shared/management/http/api/openapi.yml` (+4 -0) 📝 `shared/management/http/api/types.gen.go` (+3 -0) </details> ### 📄 Description ## Describe your changes Adds a per-account `agent_network_only` setting that lets the dashboard limit a tenant's view to the Agent Network surface. The mark is applied by the dashboard after signup (mirroring the AWS Marketplace enrich flow) and can be disabled later by the user; the backend simply stores and returns it as a standard account setting. - `types.Settings.AgentNetworkOnly` (+ `Settings.Copy`) - `agent_network_only` in the OpenAPI spec, `types.gen.go` regenerated - request/response mapping in the accounts handler (`PUT`/`GET /accounts`) - pgx `GetAccount` loader updated to select and scan the new column — without this the field silently reads back `false` in production (the gorm write path persists it, but the hand-written pgx read path lists columns explicitly) - store round-trip test covering enable→persist→disable, plus handler test cases toggling the setting Defaults to `false` for new accounts; the value never reaches the peer client (dashboard-only view setting, so it is not added to the sync conversion). ## Issue ticket number and link <!-- internal: agent-network onboarding via signup_source=netbird.ai --> ## Stack <!-- branch-stack --> ### Checklist - [ ] Is it a bug fix - [ ] Is a typo/documentation fix - [x] Is a feature enhancement - [ ] It is a refactor - [x] 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: - [x] I added/updated documentation for this change - [ ] Documentation is **not needed** for this change (explain why) The account setting's raw API field is generated automatically into the API reference. The user-facing behavior it drives (the Agent Network focused view and its opt-out) is documented in the docs PR below. ### 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/848 --- <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:09:08 -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#29842