Skip to content

Merge latest fleet-desktop-macos changes from upstream and bump version to v1.4.0 - #49469

Merged
JordanMontgomery merged 5 commits into
mainfrom
JM-fleet-desktop-macos-merge
Jul 22, 2026
Merged

Merge latest fleet-desktop-macos changes from upstream and bump version to v1.4.0#49469
JordanMontgomery merged 5 commits into
mainfrom
JM-fleet-desktop-macos-merge

Conversation

@JordanMontgomery

@JordanMontgomery JordanMontgomery commented Jul 17, 2026

Copy link
Copy Markdown
Member

Related issue: Related to #45524

Checklist for submitter

If some of the following don't apply, delete the relevant line.

  • Input data is properly validated, SELECT * is avoided, SQL injection is prevented (using placeholders for values in statements), JS inline code is prevented especially for url redirects, and untrusted data interpolated into shell scripts/commands is validated against shell metacharacters.
  • Timeouts are implemented and retries are limited to avoid infinite loops
  • If paths of existing endpoints are modified without backwards compatibility, checked the frontend/CLI for any necessary changes

Testing

  • QA'd all new/changed functionality manually

Summary by CodeRabbit

Summary

  • New Features

    • Added fleet://install_all and fleet://install-all deep links with optional category_id to open the scoped self-service page and guide the install-all confirmation flow.
  • Bug Fixes

    • Improved macOS single-instance behavior by forwarding deep links and relaunch/reopen events to the already-running window.
    • Hardened SSO/auth navigation and external-link handling to prevent expired flows and stranded pages.
    • Improved download filename safety and ensured recovery back to the home view.
    • Strengthened configuration and device token validation; refined install/badge update timing.
  • Chores

    • Bumped version to 1.4.0, enforced single-instance in the app bundle, and parallelized Intel/Apple Silicon builds.

@JordanMontgomery
JordanMontgomery marked this pull request as ready for review July 17, 2026 12:38
Copilot AI review requested due to automatic review settings July 17, 2026 12:38

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 PR updates the fleet-desktop-macos app metadata to v1.4.0 and adds a single-instance strategy so duplicate launches forward fleet:// deep links (or reopen requests) to the primary instance instead of creating a second Dock icon.

Changes:

  • Bump Fleet Desktop macOS version/build numbers to 1.4.0 / 8.
  • Add LSMultipleInstancesProhibited to the app’s Info.plist.
  • Implement a single-instance guard + URL/reopen handoff using DistributedNotificationCenter.

Reviewed changes

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

File Description
apps/fleet-desktop-macos/FleetDesktop/Info.plist Version/build bump and prohibit multiple instances at the Launch Services level.
apps/fleet-desktop-macos/FleetDesktop/FleetDesktopApp.swift Add primary/secondary instance detection and distributed-notification handoff for URL opens and relaunches.

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

Comment thread apps/fleet-desktop-macos/FleetDesktop/FleetDesktopApp.swift
Comment on lines +141 to +143
@objc private func handleForwardedReopen(_ notification: Notification) {
fleetService.run()
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Sounds valid enough? I'm not too sure about the threading in Swift UI

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Done — dispatched to main in a860fd4, same as the URL handler above.

Comment thread apps/fleet-desktop-macos/FleetDesktop/Info.plist
@coderabbitai

coderabbitai Bot commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: f7b451fd-7dc2-43a3-be69-90ed3ebb7ca8

📥 Commits

Reviewing files that changed from the base of the PR and between a860fd4 and af69030.

📒 Files selected for processing (1)
  • apps/fleet-desktop-macos/FleetDesktop/FleetService.swift
🚧 Files skipped from review as they are similar to previous changes (1)
  • apps/fleet-desktop-macos/FleetDesktop/FleetService.swift

Walkthrough

The macOS app now enforces single-instance behavior, forwarding duplicate-instance reopen and fleet:// events to the primary process. BrowserWindow adds expiring, host-restricted SSO navigation, safer external-link handling, and sanitized downloads. FleetService supports categorized install-all deep links and stricter URL and token validation. The bundle version is 1.4.0, and arm64/x86_64 builds run concurrently.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning The template is only partially filled out; several required sections and checklist items are missing. Add the missing template sections or explicitly delete non-applicable lines, and include any relevant change files and Fleet Desktop validation notes.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title is concise and accurately reflects the upstream merge and v1.4.0 version bump.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch JM-fleet-desktop-macos-merge

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot 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.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@apps/fleet-desktop-macos/FleetDesktop/FleetDesktopApp.swift`:
- Around line 45-47: Update the handoff flow around isAlreadyRunningElsewhere
and the related launch/reopen handling so a detected older primary without
distributed-notification support does not cause the new instance to exit while
dropping the action. Use a backward-compatible OS handoff mechanism or verify
protocol support before setting isSecondaryInstance and returning, with a
fallback that preserves the URL/reopen request.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 8ff1e848-7b2a-4aab-ad66-7075fe67c5c7

📥 Commits

Reviewing files that changed from the base of the PR and between 88ed1db and 1b7f287.

📒 Files selected for processing (2)
  • apps/fleet-desktop-macos/FleetDesktop/FleetDesktopApp.swift
  • apps/fleet-desktop-macos/FleetDesktop/Info.plist

Comment thread apps/fleet-desktop-macos/FleetDesktop/FleetDesktopApp.swift
@JordanMontgomery

Copy link
Copy Markdown
Member Author

@allenhouchins tagging you in for a review if it's OK when you have time. I have not really changed the fleet desktop code itself, just the build process so we can pakcage up the SSO extension. This PR is just merging in your latest changes and bumping the version so that QA can start next week on this feature. I think with the upcoming release of v1.4.0 of fleet desktop we should be able to switch to publishing it from this repo for good

@allenhouchins

Copy link
Copy Markdown
Member

@JordanMontgomery I just have one change to merge in in my repo — supporting the ability to link to the Install all button within a category. Will do my best to get that integrated this weekend then will code freeze until we build/release out of the Fleet repo. So we'll want to do one more upstream merge after that change goes through.

@allenhouchins

Copy link
Copy Markdown
Member

@JordanMontgomery the upstream version of Fleet Desktop has been updated to 1.3.4. It includes quite a few bug fixes. Do you mind doing a new merge of that code and we can see where the code reviewers land?

Brings in the remaining work from allenhouchins/fleet-desktop (through
v1.3.4, now frozen — this repo is the home of the code going forward):

- fleet://install_all deep link with optional category_id, from v1.3.3
  (the earlier partial merge only picked up FleetDesktopApp.swift)
- v1.3.4: badge-count race fix for update_all/install_all deep links,
  WebView recovery after an expired SSO flow, security hardening
- build.sh: build arm64/x86_64 in parallel
- README: document the new deep links

Kept fleet-side changes: PSSO extension build/signing support and the
/var/run running-flag location (equivalent hardening to upstream's
/var/db move). CFBundleVersion bumped to 10 so v1.4.0 sorts above
upstream v1.3.4's build 9.

@coderabbitai coderabbitai Bot 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.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@apps/fleet-desktop-macos/FleetDesktop/BrowserWindow.swift`:
- Around line 515-519: Update the safeFilename validation near the
suggestedFilename handling to treat "." and ".." the same as an empty
lastPathComponent, replacing either with the existing "download" fallback before
appending it to downloadsDir. Preserve normal sanitized filenames unchanged.

In `@apps/fleet-desktop-macos/FleetDesktop/FleetService.swift`:
- Around line 323-331: Update categoryID(from:) so category_id validation
accepts only characters in the ASCII digit range 0–9, replacing the broader
Character.isNumber check. Preserve the existing non-empty requirement and nil
return for invalid values.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 55e3b98d-b0d8-4436-ab37-c58a15c6c104

📥 Commits

Reviewing files that changed from the base of the PR and between 1b7f287 and 5c4d4f6.

⛔ Files ignored due to path filters (1)
  • apps/fleet-desktop-macos/README.md is excluded by !**/*.md
📒 Files selected for processing (4)
  • apps/fleet-desktop-macos/FleetDesktop/BrowserWindow.swift
  • apps/fleet-desktop-macos/FleetDesktop/FleetService.swift
  • apps/fleet-desktop-macos/FleetDesktop/Info.plist
  • apps/fleet-desktop-macos/build.sh
🚧 Files skipped from review as they are similar to previous changes (1)
  • apps/fleet-desktop-macos/FleetDesktop/Info.plist

Comment thread apps/fleet-desktop-macos/FleetDesktop/BrowserWindow.swift
Comment thread apps/fleet-desktop-macos/FleetDesktop/FleetService.swift

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

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

Comments suppressed due to low confidence (2)

apps/fleet-desktop-macos/FleetDesktop/FleetDesktopApp.swift:139

  • FleetService.setup() assumes handleFleetURL() runs on the main thread (FleetService.swift:413-416). DistributedNotificationCenter delivery thread isn’t guaranteed, so this can race with setup’s pending-state consumption. Also validate the forwarded URL’s scheme like the Apple Event handler does.
    @objc private func handleForwardedURL(_ notification: Notification) {
        guard let urlString = notification.userInfo?["url"] as? String,
              let url = URL(string: urlString) else { return }
        fleetService.handleFleetURL(url)
    }

apps/fleet-desktop-macos/FleetDesktop/FleetDesktopApp.swift:143

  • For consistency with other UI entry points and to avoid relying on DistributedNotificationCenter’s delivery thread, dispatch this to the main queue before calling into the service.
    @objc private func handleForwardedReopen(_ notification: Notification) {
        fleetService.run()
    }

Comment thread apps/fleet-desktop-macos/FleetDesktop/FleetService.swift Outdated
Comment thread apps/fleet-desktop-macos/build.sh Outdated
Comment thread apps/fleet-desktop-macos/FleetDesktop/FleetService.swift Outdated
@JordanMontgomery

Copy link
Copy Markdown
Member Author

@allenhouchins just reran the reviews. Let me know what you think of the latest round of comments

… sync

- Validate scheme and dispatch to main thread in forwarded-URL/reopen
  distributed notification handlers
- Fix stale header comment about the token refresh timer
- Restrict device token charset to explicit ASCII alphanumerics
- Accept only ASCII digits for deep-link category_id
- Treat '.'/'..' suggested download filenames as invalid
- Collect both swiftc exit statuses in build.sh so a failed arch build
  doesn't leave the other running
Copilot AI review requested due to automatic review settings July 22, 2026 14:01

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

Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.

Comment thread apps/fleet-desktop-macos/FleetDesktop/FleetService.swift
URL(string:) accepts host-less values like "https://", which passed the
scheme-only guard and later produced a device URL whose host was the
literal segment "device", with the token in the path. Fail early with a
clearer error instead.
Copilot AI review requested due to automatic review settings July 22, 2026 14:07

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

Copilot reviewed 6 out of 6 changed files in this pull request and generated no new comments.

Comments suppressed due to low confidence (1)

apps/fleet-desktop-macos/FleetDesktop/BrowserWindow.swift:76

  • The new comments for onWindowClose/onWindowShow say they exist “so the timer can be paused/resumed”, but FleetService’s refresh timer is documented to run for the service lifetime (and this file doesn’t actually pause/resume any timer). This is misleading documentation; please revert to a generic callback description (or update to match real behavior).
    /// Called when the window is closed (so the timer can be paused).
    var onWindowClose: (() -> Void)?

    /// Called when the window is shown (so the timer can be resumed).
    var onWindowShow: (() -> Void)?

@allenhouchins

Copy link
Copy Markdown
Member

@JordanMontgomery this should be good to go!

@MagnusHJensen MagnusHJensen left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Not fully in the loop on why the changes, but from an overall standpoint I think it looks reasonable

@JordanMontgomery
JordanMontgomery merged commit 8b6b486 into main Jul 22, 2026
12 checks passed
@JordanMontgomery
JordanMontgomery deleted the JM-fleet-desktop-macos-merge branch July 22, 2026 15:25
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.

4 participants