Skip to content

Add an anonymization level picker to the debug bundle screen - #263

Open
pappz wants to merge 1 commit into
mainfrom
fix/debug-bundle-anonymize-level
Open

pappz wants to merge 1 commit into
mainfrom
fix/debug-bundle-anonymize-level

Conversation

@pappz

@pappz pappz commented Sep 11, 2026

Copy link
Copy Markdown
Collaborator

The troubleshoot screen exposed anonymization as a plain on/off switch that kept no state: it reset to off on every fragment recreation, so a bundle went up unanonymized unless the user toggled it again right before uploading. The strict level the Go binding already exports was unreachable, because EngineRunner passed AnonymizeLevelDefault unconditionally.

Replace the switch with a None / Default / Strict picker that mirrors the desktop client. The selection persists in the app-wide SharedPreferences and defaults to Default. The row moves from the Logging section into the Debug bundle section, since it only affects the bundle.

The picker is a bottom sheet built on the existing SplitTunnelModeSheet pattern, so each level carries a description explaining what it hides. The level-to-parameter mapping follows the desktop client: "none" turns the anonymize flag off, and the daemon only ever sees "default" or "strict".

Level names and descriptions are taken from the already translated desktop strings for all ten locales.

Summary by CodeRabbit

  • New Features
    • Added selectable debug-bundle anonymization levels: None, Default, and Strict.
    • The Troubleshoot screen now displays the selected anonymization level and saves it for future use.
    • Debug bundles use the selected anonymization level when generated.
    • Added localized descriptions and labels for anonymization options in multiple languages.

The troubleshoot screen exposed anonymization as a plain on/off switch that
kept no state: it reset to off on every fragment recreation, so a bundle went
up unanonymized unless the user toggled it again right before uploading. The
strict level the Go binding already exports was unreachable, because
EngineRunner passed AnonymizeLevelDefault unconditionally.

Replace the switch with a None / Default / Strict picker that mirrors the
desktop client. The selection persists in the app-wide SharedPreferences and
defaults to Default. The row moves from the Logging section into the Debug
bundle section, since it only affects the bundle.

The picker is a bottom sheet built on the existing SplitTunnelModeSheet
pattern, so each level carries a description explaining what it hides. The
level-to-parameter mapping follows the desktop client: "none" turns the
anonymize flag off, and the daemon only ever sees "default" or "strict".

Level names and descriptions are taken from the already translated desktop
strings for all ten locales.
@coderabbitai

coderabbitai Bot commented Sep 11, 2026

Copy link
Copy Markdown
Contributor

Review Change StackReview Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Advanced

Run ID: bef5b0b6-36dd-4344-9e31-0f94378f187d

📥 Commits

Reviewing files that changed from the base of the PR and between 0d1a201 and 14fc04a.

📒 Files selected for processing (19)
  • app/src/main/java/io/netbird/client/MainActivity.java
  • app/src/main/java/io/netbird/client/ServiceAccessor.java
  • app/src/main/java/io/netbird/client/ui/troubleshoot/AnonymizeLevelSheet.java
  • app/src/main/java/io/netbird/client/ui/troubleshoot/TroubleshootFragment.java
  • app/src/main/res/layout/fragment_troubleshoot.xml
  • app/src/main/res/layout/sheet_anonymize_level.xml
  • app/src/main/res/values-de/strings.xml
  • app/src/main/res/values-es/strings.xml
  • app/src/main/res/values-fr/strings.xml
  • app/src/main/res/values-hu/strings.xml
  • app/src/main/res/values-it/strings.xml
  • app/src/main/res/values-ja/strings.xml
  • app/src/main/res/values-pt/strings.xml
  • app/src/main/res/values-ru/strings.xml
  • app/src/main/res/values-zh-rCN/strings.xml
  • app/src/main/res/values/strings.xml
  • tool/src/main/java/io/netbird/client/tool/EngineRunner.java
  • tool/src/main/java/io/netbird/client/tool/Preferences.java
  • tool/src/main/java/io/netbird/client/tool/VPNService.java

Included review availability: Your plan provides up to 2 included reviews per hour; 1 remains after this review.


📝 Walkthrough

Walkthrough

The troubleshoot screen now lets users select None, Default, or Strict anonymization. The selected level is stored in preferences and passed through the VPN service to debug bundle generation. The screen layout and localized strings support the new selector.

Changes

Debug bundle anonymization

Layer / File(s) Summary
Preference and service propagation
tool/src/main/java/io/netbird/client/tool/Preferences.java, app/src/main/java/io/netbird/client/ServiceAccessor.java, app/src/main/java/io/netbird/client/MainActivity.java, tool/src/main/java/io/netbird/client/tool/VPNService.java, tool/src/main/java/io/netbird/client/tool/EngineRunner.java
Preferences define None, Default, and Strict levels. The selected level passes from the activity through the VPN service to goClient.debugBundle.
Anonymization level picker and screen integration
app/src/main/java/io/netbird/client/ui/troubleshoot/*, app/src/main/res/layout/*, app/src/main/res/values*/strings.xml
The troubleshoot screen opens a bottom-sheet selector, persists the selected level, displays its label, derives debug bundle parameters, and adds localized level descriptions.

Priority: ⬇️ Low

Estimated code review effort: 3 (Moderate) | ~20 minutes

Change: Feature

Sequence Diagram(s)

sequenceDiagram
  participant TroubleshootFragment
  participant AnonymizeLevelSheet
  participant Preferences
  participant MainActivity
  participant VPNService
  participant EngineRunner
  TroubleshootFragment->>AnonymizeLevelSheet: Open level picker
  AnonymizeLevelSheet->>TroubleshootFragment: Return selected level
  TroubleshootFragment->>Preferences: Save anonymize level
  TroubleshootFragment->>MainActivity: Request debug bundle
  MainActivity->>VPNService: Forward anonymize and anonymizeLevel
  VPNService->>EngineRunner: Forward debug bundle parameters
  EngineRunner->>EngineRunner: Call goClient.debugBundle
Loading

Merge Risk: ⚪ Minimal · up to 14fc0

The selected anonymization level is persisted and reaches debug bundle generation as intended, with no actionable merge risk identified.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 3.33% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 30 functions across 7 files. (12 skipped: … 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: adding an anonymization level picker to the debug bundle screen.
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.
Full details: Docstring Coverage

Explanation

Docstring coverage is 3.33% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 30 functions across 7 files. (12 skipped: 12 unsupported.)

  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/debug-bundle-anonymize-level

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

A rabbit reads each line,
The patch grows clear beneath the moon,
Small changes hop in place,
Tests guard the garden path,
Reviews bloom before the dawn.

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

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.

1 participant