Skip to content

[management] Add agent_network_only account setting#6736

Merged
mlsmaycon merged 2 commits into
mainfrom
feature/agent-network-account-setting
Jul 12, 2026
Merged

[management] Add agent_network_only account setting#6736
mlsmaycon merged 2 commits into
mainfrom
feature/agent-network-account-setting

Conversation

@mlsmaycon

@mlsmaycon mlsmaycon commented Jul 12, 2026

Copy link
Copy Markdown
Collaborator

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

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:

netbirdio/docs#848

@coderabbitai

coderabbitai Bot commented Jul 12, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

Adds the AgentNetworkOnly account setting across API definitions, internal settings, PostgreSQL persistence, account update handling, response serialization, and related tests.

Changes

Agent Network account setting

Layer / File(s) Summary
Define the account setting
shared/management/http/api/openapi.yml, shared/management/http/api/types.gen.go, management/server/types/settings.go
Defines agent_network_only in the API contract and adds it to internal settings and copy logic with a default of false.
Persist the account setting
management/server/store/sql_store.go, management/server/store/sql_store_test.go
Loads and stores settings_agent_network_only and verifies enabling and disabling the value across save/load cycles.
Wire account HTTP handling
management/server/http/handlers/accounts/accounts_handler.go, management/server/http/handlers/accounts/accounts_handler_test.go
Maps the setting from update requests and includes it in account responses, with coverage for default, enabled, and disabled values.

Estimated code review effort: 2 (Simple) | ~10 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title clearly summarizes the main change: adding the agent_network_only account setting.
Description check ✅ Passed It follows the template with change summary, stack checklist, docs section, and docs PR URL; the issue-ticket field is minimally filled but present.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/agent-network-account-setting

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@sonarqubecloud

Copy link
Copy Markdown

@github-actions

Copy link
Copy Markdown

Release artifacts

Built for PR head 50cbe52 in workflow run #16638.

Artifact Link
All release artifacts Download
Linux packages Download
Windows packages Download
macOS packages Download
UI artifacts Download
UI macOS artifacts Download

GHCR images (amd64)

This comment is updated by the Release workflow. Artifact links expire according to the workflow retention policy.

@mlsmaycon mlsmaycon merged commit aa92ad3 into main Jul 12, 2026
50 checks passed
@mlsmaycon mlsmaycon deleted the feature/agent-network-account-setting branch July 12, 2026 12:46
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.

2 participants