Skip to content

android: drop health warnings when backend reports none - #902

Open
thekonz wants to merge 1 commit into
tailscale:mainfrom
thekonz:healthnotifier-null-warnings
Open

thekonz wants to merge 1 commit into
tailscale:mainfrom
thekonz:healthnotifier-null-warnings

Conversation

@thekonz

@thekonz thekonz commented Oct 23, 2026

Copy link
Copy Markdown

When the backend is fully healthy it sends Health.State with Warnings = null (a nil Go map), not an empty map. HealthNotifier only called notifyHealthUpdated through a ?.let chain:

health?.Warnings?.values?.filterNotNull()?.toTypedArray()?.let(::notifyHealthUpdated)

so a null Warnings skipped the update and a previously shown warning was never removed.

Symptom

After a short dns-forward-failing blip (bad mobile network, switching Wi-Fi), the main screen kept showing the warning triangle and "DNS unavailable" for hours, while DNS worked again. logcat at the time:

17:02:27  health: Health updated: [dns-forward-failing]
17:02:56  health(warnable=dns-forward-failing): ok
17:02:59  health: Health updated: null
18:20     UI still shows "DNS unavailable"

Seen on 1.104.2 (Android 15). Toggling Tailscale off and on cleared it, because leaving Running calls dropAllWarnings().

Fix

Treat a null Warnings as an empty set and always call notifyHealthUpdated.

Test

The existing tests passed only because they used emptyMap(). Added warningClearsWhenBackendSendsNullWarnings, which uses Warnings = null. It fails without the fix (1 of 12 in HealthNotifierTest) and passes with it. ktfmtCheck is clean.

🤖 Generated with Claude Code

https://claude.ai/code/session_01EXBrJu3voaKptscn5jq7vt

When the backend is fully healthy it sends Health.State with
Warnings = null (a nil Go map), not an empty map. HealthNotifier only
called notifyHealthUpdated through a ?.let chain, so a null Warnings
skipped the update entirely and a previously shown warning was never
removed. In practice a short dns-forward-failing blip (e.g. switching
networks) left "DNS unavailable" on the main screen for hours after
the backend had logged "Health updated: null".

Treat null Warnings as an empty set. The existing tests passed only
because they used emptyMap(); add one with Warnings = null.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EXBrJu3voaKptscn5jq7vt
Signed-off-by: Konstantin Duczek (Claude Opus 5.5) <konz.duczek@gmail.com>
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