Skip to content

Improve Apple watch items execution and logs export#5186

Merged
bgoncal merged 5 commits into
mainfrom
watch-item-exec-2
Jul 20, 2026
Merged

Improve Apple watch items execution and logs export#5186
bgoncal merged 5 commits into
mainfrom
watch-item-exec-2

Conversation

@bgoncal

@bgoncal bgoncal commented Jul 20, 2026

Copy link
Copy Markdown
Member

Summary

Screenshots

Link to pull request in Documentation repository

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

Any other notes

@bgoncal bgoncal self-assigned this Jul 20, 2026
Copilot AI review requested due to automatic review settings July 20, 2026 10:22

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This pull request improves Apple Watch reliability for both Magic Item execution and exporting watch diagnostics by avoiding work scheduled on shared worker pools that can become starved on watch hardware.

Changes:

  • Run Magic Item execution on a dedicated Thread instead of Swift concurrency / GCD global queues, and add canary logs for both worker pools.
  • Refactor watch diagnostics export to build a .zip archive eagerly (off the UI thread) and share the finished file via ShareLink.
  • Update the Watch settings client-events screen to show a spinner until the diagnostics archive is ready.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
Sources/WatchApp/WatchSettingsView.swift Pre-builds the diagnostics archive on appear and shares a ready URL, showing a ProgressView until ready.
Sources/WatchApp/Utilities/WatchDiagnosticsArchive.swift Replaces the Transferable implementation with an eager archive builder (makeArchive() -> URL).
Sources/WatchApp/Home/MagicItemRow/WatchMagicViewRowViewModel.swift Moves execution onto a dedicated thread and adds diagnostic canaries for Swift concurrency + GCD global queue scheduling delays.

}

private func prepareDiagnosticsArchive() {
guard diagnosticsArchiveURL == nil, !events.isEmpty else { return }
Comment on lines +586 to +592
let thread = Thread {
do {
let url = try WatchDiagnosticsArchive.makeArchive()
DispatchQueue.main.async { diagnosticsArchiveURL = url }
} catch {
Current.Log.error("Failed to build watch diagnostics archive: \(error.localizedDescription)")
}
@github-actions

github-actions Bot commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

⚠️ Unused L10n strings detected

Found 6 unused localization strings in the codebase.

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

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

Checking for unused strings...
Checked 100/2183 strings...
Checked 200/2183 strings...
Checked 300/2183 strings...
Checked 400/2183 strings...
Checked 500/2183 strings...
Checked 600/2183 strings...
Checked 700/2183 strings...
Checked 800/2183 strings...
Checked 900/2183 strings...
Checked 1000/2183 strings...
Checked 1100/2183 strings...
Checked 1200/2183 strings...
Checked 1300/2183 strings...
Checked 1400/2183 strings...
Checked 1500/2183 strings...
Checked 1600/2183 strings...
Checked 1700/2183 strings...
Checked 1800/2183 strings...
Checked 1900/2183 strings...
Checked 2000/2183 strings...
Checked 2100/2183 strings...

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

Found 6 unused strings:


ONBOARDING:
  - L10n.Onboarding.ServerImport.Reauthenticate.errorsMissingPresenter
    Key: onboarding.server_import.reauthenticate.errors_missing_presenter
    Line: 3510

WATCH:
  - L10n.Watch.Complications.Builder.previewFooter
    Key: watch.complications.builder.preview_footer
    Line: 5901
  - L10n.Watch.Complications.Builder.sourceCustom
    Key: watch.complications.builder.source_custom
    Line: 5931
  - L10n.Watch.Complications.Builder.templateColor
    Key: watch.complications.builder.template_color
    Line: 5943
  - L10n.Watch.Complications.Builder.textTemplate
    Key: watch.complications.builder.text_template
    Line: 5961

ROOT:
  - L10n.debugSectionLabel
    Key: debug_section_label
    Line: 26

================================================================================
Total unused: 6
================================================================================

================================================================================
Copy-paste these keys into the "Lokalise: Delete Keys" workflow (keys input):
================================================================================
debug_section_label,onboarding.server_import.reauthenticate.errors_missing_presenter,watch.complications.builder.preview_footer,watch.complications.builder.source_custom,watch.complications.builder.template_color,watch.complications.builder.text_template

To remove them, run the
Lokalise: Delete Keys
workflow — it deletes the keys from Lokalise and opens a PR removing them from
Localizable.strings and regenerating Strings.swift. Copy-paste these keys into the keys input:

debug_section_label,onboarding.server_import.reauthenticate.errors_missing_presenter,watch.complications.builder.preview_footer,watch.complications.builder.source_custom,watch.complications.builder.template_color,watch.complications.builder.text_template

@bgoncal
bgoncal merged commit e8fcc21 into main Jul 20, 2026
13 checks passed
@bgoncal
bgoncal deleted the watch-item-exec-2 branch July 20, 2026 17:39
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