Skip to content

Conversation

@bgoncal
Copy link
Member

@bgoncal bgoncal commented Dec 18, 2025

Summary

Screenshots

Link to pull request in Documentation repository

Documentation: home-assistant/companion.home-assistant#

Any other notes

@bgoncal bgoncal self-assigned this Dec 18, 2025
Copilot AI review requested due to automatic review settings December 18, 2025 15:52
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR enhances the local push notification reliability by implementing automatic reconnection logic with exponential backoff and extensive diagnostic logging. The changes aim to handle network disruptions more gracefully by detecting when local push becomes unavailable and automatically attempting to re-establish the connection.

Key changes:

  • Adds automatic reconnection mechanism with backoff delays (5s, 10s, 30s) when local push connections fail
  • Introduces comprehensive verbose logging throughout the local push infrastructure for better debugging
  • Refactors manager configuration code into smaller, well-documented helper methods

Copy link
Contributor

Copilot AI commented Dec 22, 2025

@bgoncal I've opened a new pull request, #4132, to work on those changes. Once the pull request is ready, I'll request review from you.

Copy link
Contributor

Copilot AI commented Dec 22, 2025

@bgoncal I've opened a new pull request, #4133, to work on those changes. Once the pull request is ready, I'll request review from you.

Copy link
Contributor

Copilot AI commented Dec 22, 2025

@bgoncal I've opened a new pull request, #4134, to work on those changes. Once the pull request is ready, I'll request review from you.

@github-actions
Copy link
Contributor

github-actions bot commented Dec 22, 2025

⚠️ Unused L10n strings detected

Found 1 unused localization strings in the codebase.

Click to see details
Parsing Strings.swift...
Found 1274 L10n strings

Reading all Swift source code...
Read 4745148 characters of Swift code

Checking for unused strings...
Checked 100/1274 strings...
Checked 200/1274 strings...
Checked 300/1274 strings...
Checked 400/1274 strings...
Checked 500/1274 strings...
Checked 600/1274 strings...
Checked 700/1274 strings...
Checked 800/1274 strings...
Checked 900/1274 strings...
Checked 1000/1274 strings...
Checked 1100/1274 strings...
Checked 1200/1274 strings...

================================================================================
UNUSED STRINGS REPORT
================================================================================

Found 1 unused strings:


WATCH:
  - L10n.Watch.Labels.noAction
    Key: watch.labels.no_action
    Line: 3913

================================================================================
Total unused: 1
================================================================================

To clean up these strings, manually remove them from the Localizable.strings files
and regenerate Strings.swift using SwiftGen.

bgoncal and others added 2 commits December 23, 2025 17:00
## Summary
Adds comprehensive unit tests for the reconnection logic introduced in
PR #4113, covering backoff delays, timer cancellation, state
transitions, and edge cases with rapid disconnect/reconnect events.

## Screenshots
N/A - Test coverage only

## Link to pull request in Documentation repository
Documentation: home-assistant/companion.home-assistant#

## Any other notes
This PR addresses feedback from the code review on #4113 requesting test
coverage for the `scheduleReconnection()`, `attemptReconnection()`, and
`cancelReconnection()` methods.

**Implementation approach:**
- Added DEBUG-only test accessors to
`NotificationManagerLocalPushInterfaceExtension` to expose internal
state for verification without compromising production code
- Created 13 focused test cases that directly verify private state and
behavior through test helpers

**Test coverage includes:**
- Exponential backoff delay calculation (5s, 10s, 30s capped)
- Timer cancellation when all servers reconnect
- State tracking of disconnected servers across multiple events
- Rapid disconnection/reconnection event handling
- Attempt counter increment and reset behavior
- Edge cases: reconnection during active timer, multiple servers
disconnecting simultaneously, inactive managers

**Note:** Due to NetworkExtension framework constraints
(NEAppPushManager requires provisioning/entitlements), full integration
testing requires Xcode environment. The unit tests verify all testable
logic through internal accessors.

<!-- START COPILOT CODING AGENT TIPS -->
---

💡 You can make Copilot smarter by setting up custom instructions,
customizing its development environment and configuring Model Context
Protocol (MCP) servers. Learn more [Copilot coding agent
tips](https://gh.io/copilot-coding-agent-tips) in the docs.

---------

Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Co-authored-by: bgoncal <[email protected]>
Co-authored-by: Copilot <[email protected]>
@codecov
Copy link

codecov bot commented Jan 6, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
⚠️ Please upload report for BASE (main@f823d89). Learn more about missing BASE report.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #4113   +/-   ##
=======================================
  Coverage        ?   45.17%           
=======================================
  Files           ?      249           
  Lines           ?    14286           
  Branches        ?        0           
=======================================
  Hits            ?     6453           
  Misses          ?     7833           
  Partials        ?        0           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants