Skip to content

Comments

feat(macOS): Replace UNIX sockets with XPC#9463

Draft
i2h3 wants to merge 2 commits intomasterfrom
i2h3/feature/9430-all-xpc
Draft

feat(macOS): Replace UNIX sockets with XPC#9463
i2h3 wants to merge 2 commits intomasterfrom
i2h3/feature/9430-all-xpc

Conversation

@i2h3
Copy link
Collaborator

@i2h3 i2h3 commented Feb 17, 2026

The extensions shipped with our app should use XPC exclusively for interprocess communication and drop UNIX file sockets.

Copilot AI review requested due to automatic review settings February 17, 2026 10:54
@i2h3 i2h3 self-assigned this Feb 17, 2026
@i2h3 i2h3 added os: 🍎 macOS Apple macOS, formerly also known as OS X feature: 🐚 shell integration 3. to review feature: 📁 file provider macOS File Provider Extension, more general also known as virtual file system. labels Feb 17, 2026
@github-project-automation github-project-automation bot moved this to 🧭 Planning evaluation (don't pick) in 💻 Desktop Clients team Feb 17, 2026
@i2h3 i2h3 moved this from 🧭 Planning evaluation (don't pick) to 🏗️ In progress in 💻 Desktop Clients team Feb 17, 2026
@i2h3 i2h3 force-pushed the i2h3/feature/9430-all-xpc branch from 95d425a to e0d96a5 Compare February 17, 2026 10:55
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 pull request replaces UNIX socket-based IPC with XPC (Apple's Inter-Process Communication) for communication between the Nextcloud desktop client and its macOS FinderSync extension. This modernizes the macOS integration to use Apple's recommended XPC framework instead of file-based sockets.

Changes:

  • Introduced XPC-based communication infrastructure (FinderSyncXPC, FinderSyncService, FinderSyncXPCManager) to replace socket-based communication
  • Removed legacy socket server components (FileProviderSocketServer, FileProviderSocketController, FinderSyncSocketLineProcessor)
  • Added XPC protocol definitions (FinderSyncProtocol, FinderSyncAppProtocol) for bidirectional communication
  • Updated FinderSync extension to use XPC client instead of socket client
  • Maintained SocketApi as the core business logic layer (reused for XPC transport)

Reviewed changes

Copilot reviewed 34 out of 35 changed files in this pull request and generated 17 comments.

Show a summary per file
File Description
src/gui/macOS/findersyncxpc_mac.mm New XPC listener implementation for accepting FinderSync connections
src/gui/macOS/findersyncxpc.h XPC manager interface for broadcasting status updates to extensions
src/gui/macOS/findersyncservice.mm XPC service delegate implementing FinderSyncAppProtocol for extension requests
src/gui/macOS/findersyncservice.h Service interface wrapping SocketApi for XPC transport
src/gui/socketapi/socketapi.cpp Added XPC broadcast support alongside socket broadcasts
src/gui/socketapi/socketapi.h Added friend declaration for FinderSyncService to access FileData
src/gui/application.cpp Initialize XPC infrastructure on macOS
shell_integration/.../FinderSyncXPCManager.m XPC client for FinderSync extension to connect to main app
shell_integration/.../FinderSync.m Migrated from socket client to XPC manager
src/gui/macOS/fileprovidersocketserver*.* Removed legacy socket server (File Provider uses XPC now)
src/gui/CMakeLists.txt Updated build to include new XPC files and remove socket files

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@i2h3 i2h3 force-pushed the i2h3/feature/9430-all-xpc branch from e0d96a5 to d9f2bba Compare February 17, 2026 12:17
@i2h3 i2h3 added this to the 33.0.0 milestone Feb 17, 2026
@i2h3 i2h3 force-pushed the i2h3/feature/9430-all-xpc branch from d9f2bba to f521a65 Compare February 17, 2026 13:44
@i2h3 i2h3 requested a review from Copilot February 17, 2026 13:44
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

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


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.


for try await result in group {
for try await _ in group {
progress.completedUnitCount = 1
Copy link

Copilot AI Feb 17, 2026

Choose a reason for hiding this comment

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

Bug: progress.completedUnitCount is being set to 1 instead of incremented. This should be progress.completedUnitCount += 1 or progress.completedUnitCount++ to properly track progress. Currently, it will always show as 1 out of N items completed, never reaching 100%.

Suggested change
progress.completedUnitCount = 1
progress.completedUnitCount += 1

Copilot uses AI. Check for mistakes.
Comment on lines +336 to +341
const auto parts = msg.mid(7).split(':', Qt::SkipEmptyParts); // Skip "STRING:"
if (parts.size() >= 2) {
const QString key = parts[0];
const QString value = parts.mid(1).join(':'); // Rejoin in case value contains ':'
result[key] = value;
}
Copy link

Copilot AI Feb 17, 2026

Choose a reason for hiding this comment

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

Potential parsing issue: The split operation uses Qt::SkipEmptyParts which will skip empty values in the split result. If a localized string key or value is intentionally empty, it will be lost. Consider using Qt::KeepEmptyParts and checking parts.size() == 2 exactly, rather than >= 2, to handle this edge case correctly.

Copilot uses AI. Check for mistakes.
Copy link
Member

@nilsding nilsding left a comment

Choose a reason for hiding this comment

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

Some comments for now -- couldn't manage to get the FinderSync XPC connection working in a local dev setup due to sandboxing issues :(

Comment on lines +14 to +16
* This class replaces the LocalSocketClient for FinderSync, providing XPC-based
* communication instead of UNIX sockets. It establishes a connection to the main app's
* XPC service and handles method calls in both directions.
Copy link
Member

Choose a reason for hiding this comment

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

Speaking of LocalSocketClient, is the shell_integration/MacOSX/NextcloudIntegration/NCDesktopClientSocketKit still required?

Copy link
Member

Choose a reason for hiding this comment

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

is this duplicate of FinderSyncExt/Services/FinderSyncAppProtocol.h on purpose? if yes: could a symlink to it work here as well?

// Store socketApi pointer after null check to prevent TOCTOU race
auto *socketApi = _service ? _service->socketApi() : nullptr;
if (!socketApi) {
NSError *error = [NSError errorWithDomain:@"com.nextcloud.desktopclient.FinderSyncService"
Copy link
Member

Choose a reason for hiding this comment

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

Does this domain identifier need to be changed if the bundle ID is different as well?

Comment on lines 49 to 50
// Use __weak to safely capture the connection - it will be zeroed if connection is deallocated
__weak NSXPCConnection *weakConnection = newConnection;
Copy link
Member

Choose a reason for hiding this comment

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

This fails to compile: error: cannot create __weak reference in file using manual reference counting

{
}

void sendMessage(const QString &message, bool = false) const override
Copy link
Member

Choose a reason for hiding this comment

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

in order to allow this method to be overridden, the method in the parent class needs to be virtual


void sendMessage(const QString &message, bool = false) const override
{
// Cast away const to store messages (this is a mock for testing)
Copy link
Member

Choose a reason for hiding this comment

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

Would say this is a part of the socketless implementation, and not for testing

Comment on lines +15 to +17
// Note: SocketApi is NOT socket-specific - it's the core business logic class that handles
// file status queries, menu commands, and sync operations across ALL platforms.
// We reuse SocketApi here as a transport adapter to avoid duplicating business logic.
Copy link
Member

Choose a reason for hiding this comment

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

SocketApi still starts up a local socket for listeners to connect though -- if the goal is to remove this for macOS entirely, that class would need to be split into the listener handler + the actual actions to be performed (i.e. API).

i2h3 added 2 commits February 18, 2026 08:42
Signed-off-by: Iva Horn <iva.horn@nextcloud.com>
Signed-off-by: Iva Horn <iva.horn@nextcloud.com>
@i2h3 i2h3 force-pushed the i2h3/feature/9430-all-xpc branch from f521a65 to e630785 Compare February 18, 2026 07:43
@github-actions
Copy link

Artifact containing the AppImage: nextcloud-appimage-pr-9463.zip

Digest: sha256:7ba1d3f60499fde436fc12d4480beef3bc4ff7414b582e4799cd1dd24e702259

To test this change/fix you can download the above artifact file, unzip it, and run it.

Please make sure to quit your existing Nextcloud app and backup your data.

@sonarqubecloud
Copy link

Quality Gate Failed Quality Gate failed

Failed conditions
D Security Rating on New Code (required ≥ A)
C Maintainability Rating on New Code (required ≥ A)
40 New Code Smells (required ≤ 0)

See analysis details on SonarQube Cloud

Catch issues before they fail your Quality Gate with our IDE extension SonarQube for IDE

@i2h3 i2h3 removed this from the 33.0.0 milestone Feb 18, 2026
@i2h3 i2h3 marked this pull request as draft February 18, 2026 08:41
@i2h3 i2h3 added this to the 33.0.0 milestone Feb 18, 2026
@i2h3 i2h3 removed this from the 33.0.0 milestone Feb 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

3. to review feature: 📁 file provider macOS File Provider Extension, more general also known as virtual file system. feature: 🐚 shell integration os: 🍎 macOS Apple macOS, formerly also known as OS X

Projects

Status: 🏗️ In progress

Development

Successfully merging this pull request may close these issues.

2 participants