Skip to content

[client] Don't abort UI debug bundle when up/down fails#5780

Merged
lixmal merged 3 commits intomainfrom
fix/ui-debug-bundle-no-abort
Apr 8, 2026
Merged

[client] Don't abort UI debug bundle when up/down fails#5780
lixmal merged 3 commits intomainfrom
fix/ui-debug-bundle-no-abort

Conversation

@lixmal
Copy link
Copy Markdown
Collaborator

@lixmal lixmal commented Apr 2, 2026

Describe your changes

Mirror the CLI fix from #5657 for the UI debug bundle: when Up/Down/SetLogLevel/SetSyncResponsePersistence calls fail during debug collection, log a warning and continue instead of aborting the entire bundle.

  • Log warnings instead of returning errors in configureServiceForDebug, so the bundle is still generated even if service state changes fail
  • Downgrade restoreServiceState error logging from Errorf to Warnf for consistency

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)

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)

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

Summary by CodeRabbit

  • Bug Fixes

    • Debug data collection now continues even if initial setup calls fail; failures are logged without blocking the process.
    • Timing/waiting delays during debug setup now occur only after successful operations to avoid unnecessary waits.
  • Chores

    • Reduced log severity for restore-related failures from error to warning.
    • Added conditional tracking to ensure the service is restored to its prior "up" state when appropriate.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 2, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 85258419-f3b7-4e1b-b46f-bc6e8156adda

📥 Commits

Reviewing files that changed from the base of the PR and between 0293cc2 and ad2c07d.

📒 Files selected for processing (2)
  • client/cmd/debug.go
  • client/ui/debug.go

📝 Walkthrough

Walkthrough

configureServiceForDebug no longer returns an error and now logs RPC failures instead of failing. Sleep delays were moved into success branches. Debug collection proceeds even if service setup RPCs fail. A new debugInitialState.needsRestoreUp field tracks whether to bring the service back up; restore logic uses this flag and downgrades some restore failures to warnings.

Changes

Cohort / File(s) Summary
Debug service configuration
client/ui/debug.go
Removed error return from configureServiceForDebug; RPC failures (Up, SetLogLevel, Down, SetSyncResponsePersistence) are logged, not returned. time.Sleep calls moved to success branches. Added debugInitialState.needsRestoreUp and changed restore log severity from Errorf to Warnf.
Debug command lifecycle / restore flow
client/cmd/debug.go
Introduced needsRestoreUp tracking in runForDuration to mark when a final Up (restoration) is required; set/cleared based on successful Down/Up calls and conditionally perform final Up if still needed.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Suggested reviewers

  • pappz
  • mlsmaycon

Poem

🐰 I hopped in logs and RPC streams bright,

Warnings now whisper where errors took flight,
I nudged the up-flag back into place,
So debugging blooms at gentler pace,
Hooray — the bundle hops on through the night! 🎋

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the main change: preventing debug bundle generation from aborting when service up/down operations fail.
Description check ✅ Passed The description includes the key motivation (mirroring CLI fix #5657), explains the specific changes made, and properly documents why the changes are needed.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ 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 fix/ui-debug-bundle-no-abort

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 and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1


ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: dfa4b328-932c-4005-a8dd-badac43dbcea

📥 Commits

Reviewing files that changed from the base of the PR and between c2c6396 and 0293cc2.

📒 Files selected for processing (1)
  • client/ui/debug.go

Comment thread client/ui/debug.go
@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud Bot commented Apr 8, 2026

Comment thread client/ui/debug.go
log.Warnf("failed to bring service up: %v", err)
} else {
log.Info("Service brought up for debug")
time.Sleep(time.Second * 10)
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is not it block the UI?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's running in a goroutine, and it's just moved. The sleep was already there

Comment thread client/ui/debug.go
log.Warnf("failed to bring service down: %v", err)
} else {
state.needsRestoreUp = !state.wasDown
time.Sleep(time.Second)
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is not it block the UI?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's running in a goroutine, and it's just moved. The sleep was already there

Comment thread client/ui/debug.go
log.Warnf("failed to bring service back up: %v", err)
} else {
state.needsRestoreUp = false
time.Sleep(time.Second * 3)
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is not it block the UI?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's running in a goroutine, and it's just moved. The sleep was already there

@lixmal lixmal merged commit 332c624 into main Apr 8, 2026
44 of 45 checks passed
@lixmal lixmal deleted the fix/ui-debug-bundle-no-abort branch April 8, 2026 08:33
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