Skip to content

Fix mtls profile info request on macos#4555

Merged
bgoncal merged 2 commits intomainfrom
mac-mtls-prof-pic
Apr 24, 2026
Merged

Fix mtls profile info request on macos#4555
bgoncal merged 2 commits intomainfrom
mac-mtls-prof-pic

Conversation

@bgoncal
Copy link
Copy Markdown
Member

@bgoncal bgoncal commented Apr 23, 2026

Summary

Screenshots

Link to pull request in Documentation repository

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

Any other notes

@bgoncal bgoncal self-assigned this Apr 23, 2026
Copilot AI review requested due to automatic review settings April 23, 2026 14:01
@bgoncal bgoncal linked an issue Apr 23, 2026 that may be closed by this pull request
2 tasks
Copy link
Copy Markdown
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 updates the app’s user/profile fetching to use REST endpoints (not cache/WebSocket-derived values), addressing mTLS-related issues on macOS and adding unit coverage for the new behavior.

Changes:

  • Add HATypedRequest.fetchCurrentUser() and expose HomeAssistantAPI.currentUser() plus user-scoped profile picture helpers.
  • Update multiple UI surfaces to load usernames/avatars via the new REST-backed APIs.
  • Add a new Shared test suite validating REST request usage for current user and profile picture URL.

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
Tests/Shared/HomeAssistantAPIIdentity.test.swift Adds tests asserting auth/current_user and states are fetched via REST and that profile URL resolution is correct.
Sources/Shared/HATypedRequest+App.swift Adds a typed REST request builder for auth/current_user.
Sources/Shared/API/HAAPI.swift Implements REST-based current user/profile picture fetching and refactors profile URL resolution.
Sources/App/Settings/Settings/HomeAssistantAccountRowView.swift Switches username/avatar loading to currentUser + profilePicture(for:).
Sources/App/Settings/Eureka/AccountRow.swift Refactors avatar fetching to use the new API helpers (removing previous cancellation/dedup logic).
Sources/App/Settings/Connection/ConnectionSettingsViewModel.swift Populates loggedInUser using the new currentUser method.
Sources/App/Servers/ServerSelectView.swift Switches username/avatar loading to currentUser + profilePicture(for:).
HomeAssistant.xcodeproj/project.pbxproj Registers the new test file in the Xcode project/test target.

Comment thread Sources/App/Settings/Settings/HomeAssistantAccountRowView.swift
Comment thread Sources/App/Servers/ServerSelectView.swift
Comment thread Sources/Shared/API/HAAPI.swift
Comment thread Sources/App/Settings/Eureka/AccountRow.swift Outdated
@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 24, 2026

Codecov Report

❌ Patch coverage is 53.00000% with 47 lines in your changes missing coverage. Please review.
⚠️ Please upload report for BASE (main@7c852db). Learn more about missing BASE report.

Files with missing lines Patch % Lines
Sources/Shared/API/HAAPI.swift 52.04% 47 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main    #4555   +/-   ##
=======================================
  Coverage        ?   43.18%           
=======================================
  Files           ?      275           
  Lines           ?    16694           
  Branches        ?        0           
=======================================
  Hits            ?     7209           
  Misses          ?     9485           
  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.

@bgoncal bgoncal merged commit 3310bb6 into main Apr 24, 2026
15 checks passed
@bgoncal bgoncal deleted the mac-mtls-prof-pic branch April 24, 2026 14:00
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.

[mTLS] macOS User and user picture not shown for connected server

2 participants