[management] fix fetching of missing settings in GetAccount call#6800
[management] fix fetching of missing settings in GetAccount call#6800dmitri-netbird wants to merge 4 commits into
Conversation
Signed-off-by: Dmitri Dolguikh <dmitri.external@netbird.io>
|
Caution Review failedAn error occurred during the review process. Please try again later. 📝 WalkthroughWalkthroughPostgreSQL account retrieval now includes auto-update and peer-exposure settings. A reflection-based helper populates deterministic struct values, and a store test verifies account settings survive save-and-retrieve operations. ChangesAccount settings persistence
Estimated code review effort: 3 (Moderate) | ~20 minutes Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
…ttings Signed-off-by: Dmitri Dolguikh <dmitri.external@netbird.io>
Release artifactsBuilt for PR head
GHCR images (amd64)
This comment is updated by the Release workflow. Artifact links expire according to the workflow retention policy. |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
management/server/store/sql_store_test.go (1)
345-346: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueCheck errors returned by
json.Marshal.The
errreturned by bothjson.Marshalcalls is currently unhandled. Asserting that no error occurs prevents linter warnings (e.g.,ineffassign,errcheck) and ensures test reliability in case serialization fails.♻️ Proposed refactor
settingJson, err := json.Marshal(settings) + assert.NoError(t, err) dbSettingJson, err := json.Marshal(accountFromDb.Settings) + assert.NoError(t, err)🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@management/server/store/sql_store_test.go` around lines 345 - 346, Handle the errors returned by both json.Marshal calls in the test, asserting each error is nil before using the serialized values. Update the test code around settingJson and dbSettingJson so neither marshal result is ignored and serialization failures fail the test clearly.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@shared/testing_helpers/populate_fields.go`:
- Around line 71-74: Update the Slice case in the field-population logic to
capture and return any error from p.setNonZero(s.Index(0)) before setting the
slice. Preserve the existing slice construction and assignment behavior when
element population succeeds, while ensuring unsupported element types fail
explicitly.
---
Nitpick comments:
In `@management/server/store/sql_store_test.go`:
- Around line 345-346: Handle the errors returned by both json.Marshal calls in
the test, asserting each error is nil before using the serialized values. Update
the test code around settingJson and dbSettingJson so neither marshal result is
ignored and serialization failures fail the test clearly.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 87ff71b7-772e-4868-bad9-40feaea3aa1b
📒 Files selected for processing (3)
management/server/store/sql_store.gomanagement/server/store/sql_store_test.goshared/testing_helpers/populate_fields.go
Signed-off-by: Dmitri Dolguikh <dmitri.external@netbird.io>
Signed-off-by: Dmitri Dolguikh <dmitri.external@netbird.io>
|



Describe your changes
Issue ticket number and link
Stack
Checklist
Documentation
Select exactly one:
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/__
Need help on this PR? Tag
/codesmithwith what you need. Autofix is disabled.Summary by CodeRabbit
Bug Fixes
Tests