Skip to content

fix: merge account extra settings at the subkey level - #66

Merged
SunsetDrifter merged 1 commit into
netbirdio:mainfrom
tkloda:fix/account-extra-settings-shallow-merge
Aug 25, 2026
Merged

fix: merge account extra settings at the subkey level#66
SunsetDrifter merged 1 commit into
netbirdio:mainfrom
tkloda:fix/account-extra-settings-shallow-merge

Conversation

@tkloda

@tkloda tkloda commented Aug 16, 2026

Copy link
Copy Markdown
Collaborator

The account settings PUT is full-replace with no server-side nil-check on the nested extra object, so a task naming only one extra_* option (e.g. extra_network_traffic_logs_enabled) silently reset every other extra setting (peer_approval_enabled, user_approval_required, etc.) to its zero value. Merge extra against the current settings at the subkey level instead of splicing the whole nested object in wholesale, mirroring the fallback pattern already used in netbird_group.

Summary by CodeRabbit

  • Bug Fixes

    • Account updates now preserve existing nested extra settings when only some values are changed.
    • Existing top-level settings continue to be retained during partial updates.
    • Unchanged account settings no longer trigger unnecessary updates.
  • Tests

    • Added coverage for partial, empty, and unchanged extra settings updates.

The account settings PUT is full-replace with no server-side nil-check
on the nested `extra` object, so a task naming only one extra_* option
(e.g. extra_network_traffic_logs_enabled) silently reset every other
extra setting (peer_approval_enabled, user_approval_required, etc.) to
its zero value. Merge `extra` against the current settings at the
subkey level instead of splicing the whole nested object in wholesale,
mirroring the fallback pattern already used in netbird_group.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Aug 16, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 4c54d711-e004-4217-9d35-3ff5bec8404a

📥 Commits

Reviewing files that changed from the base of the PR and between 82fb22a and add1e9a.

📒 Files selected for processing (3)
  • changelogs/fragments/fix-account-extra-settings-shallow-merge.yml
  • plugins/modules/netbird_account.py
  • tests/unit/plugins/modules/test_netbird_account.py

Included review availability: Your plan includes up to 1 review per rolling hour; 0 remain after this review.


📝 Walkthrough

Walkthrough

netbird_account now preserves omitted nested extra settings during full-replacement updates. Unit tests cover merge behavior, missing values, top-level settings, and no-op updates.

Changes

Account settings merge

Layer / File(s) Summary
Nested extra settings merge
plugins/modules/netbird_account.py, changelogs/fragments/...
The update payload merges current top-level settings and nested extra settings before sending the replacement request.
Merge behavior validation
tests/unit/plugins/modules/test_netbird_account.py
Tests verify preserved fields, individual updates, missing extra settings, and skipped unchanged updates.

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

Merge Risk: ⚪ Minimal · up to add1e

The change is localized to account settings merging and no actionable merge-blocking risk remains beyond normal checks and review.

Possibly related PRs

Poem

A rabbit checks each setting twice,
Keeps hidden fields from rolling dice.
Extra keys stay safely near,
No-op updates disappear.
Merge complete—ears up with cheer!

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 26.67% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: merging account extra settings at the subkey level.
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.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

@SunsetDrifter
SunsetDrifter merged commit 239dfb5 into netbirdio:main Aug 25, 2026
13 checks passed
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