Skip to content

Fix patch policy for swiftDialog to not pick up orbit installation#49362

Draft
jkatz01 wants to merge 4 commits into
mainfrom
48667-swift-dialog-patch-policy-fix
Draft

Fix patch policy for swiftDialog to not pick up orbit installation#49362
jkatz01 wants to merge 4 commits into
mainfrom
48667-swift-dialog-patch-policy-fix

Conversation

@jkatz01

@jkatz01 jkatz01 commented Jul 15, 2026

Copy link
Copy Markdown
Member

Related issue: Resolves #48667
Changes:
Adds AND path NOT LIKE '/opt/orbit/bin/% to the path policy to not pick up the swiftDialog version orbit installs in /opt/orbit/bin/swiftDialog/macos/stable/Dialog.app.
I kept it pretty open, but something like AND path != '/opt/orbit/bin/swiftDialog/macos/stable/Dialog.app' would also work.

Checklist for submitter

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

  • Changes file added for user-visible changes in changes/, orbit/changes/ or ee/fleetd-chrome/changes.
    See Changes files for more information.
    • No changefile because this is a live change to an FMA manifest

Testing

image image

Summary by CodeRabbit

  • Bug Fixes
    • Corrected SwiftDialog patch-status reporting by excluding Orbit-installed copies from patch checks.
    • Updated SwiftDialog detection to account for the application’s installation path, preventing incorrect outdated-app alerts.
  • Tests
    • Added validation coverage for SwiftDialog Homebrew installations and their patch-status queries.

@codecov

codecov Bot commented Jul 15, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 67.99%. Comparing base (0e78132) to head (3327947).
⚠️ Report is 57 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #49362      +/-   ##
==========================================
+ Coverage   67.97%   67.99%   +0.02%     
==========================================
  Files        3823     3857      +34     
  Lines      241031   245526    +4495     
  Branches    12702    12702              
==========================================
+ Hits       163831   166956    +3125     
- Misses      62325    63432    +1107     
- Partials    14875    15138     +263     
Flag Coverage Δ
backend 69.53% <100.00%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 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.

@jkatz01
jkatz01 marked this pull request as ready for review July 15, 2026 21:09
@jkatz01
jkatz01 requested a review from a team as a code owner July 15, 2026 21:09
@coderabbitai

coderabbitai Bot commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Walkthrough

SwiftDialog Homebrew ingestion now excludes applications installed under /opt/orbit/bin/ from patched queries. The SwiftDialog Darwin output configuration applies the same path restriction to its patched existence query. Ingestion validation tests add SwiftDialog request data, test cases, and assertions for the updated SQL conditions.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: excluding Orbit-installed swiftDialog from patch policy evaluation.
Description check ✅ Passed The description matches the template well, includes the related issue, change summary, testing, and notes about the missing change file.
Linked Issues check ✅ Passed The change implements the requested exclusion of Orbit-installed swiftDialog and the tests/output update confirm the intended behavior for issue #48667.
Out of Scope Changes check ✅ Passed The PR stays focused on the swiftDialog patch-policy fix, related test coverage, and the corresponding output manifest update.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ 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 48667-swift-dialog-patch-policy-fix

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 `@ee/maintained-apps/ingesters/homebrew/ingester.go`:
- Around line 234-240: Update the swiftdialog handling in the ingester’s Exists
query generation to exclude apps whose path matches /opt/orbit/bin/, while
preserving the bundle identifier filter and ensuring the SQL includes the
required WHERE criteria. Update the corresponding swiftdialog out.Queries.Exists
assertion in ingester_test.go to reflect this filtering.
🪄 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: b1f97c83-7c87-4ab5-b5df-38d45b76a1f7

📥 Commits

Reviewing files that changed from the base of the PR and between 0e78132 and b225614.

📒 Files selected for processing (3)
  • ee/maintained-apps/ingesters/homebrew/ingester.go
  • ee/maintained-apps/ingesters/homebrew/ingester_test.go
  • ee/maintained-apps/outputs/swiftdialog/darwin.json

Comment on lines +234 to +240
if input.Token == "swiftdialog" {
// Orbit installs swiftDialog v2.5.6 for setup experience, MDM migration, or enrollment profile renewal; do not consider it for patch status.
out.Queries.Patched = fmt.Sprintf(
"SELECT 1 WHERE NOT EXISTS (SELECT 1 FROM apps WHERE bundle_identifier = '%s' AND version_compare(bundle_short_version, '%s') < 0 AND path NOT LIKE '/opt/orbit/bin/%%');",
out.UniqueIdentifier, out.Version,
)
}

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.

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Consider excluding the Orbit path in the Exists query as well.

The Patched query correctly ignores Orbit's swiftDialog installation, ensuring the patch policy passes. However, the Exists query (generated at line 149) still only filters by bundle_identifier.

If Fleet relies on the Exists query to determine whether a managed app is already installed before running its installer, returning true for Orbit's copy could prevent users from successfully deploying the user-facing FMA version of swiftDialog to hosts that currently only have the Orbit copy (since the system will erroneously consider the FMA app already installed).

Consider applying the same path exclusion to the Exists query to fully isolate FMA's evaluation from Orbit's internal copy. As per path instructions, ensure that appropriate filtering criteria are applied and check for missing WHERE clauses that could lead to incorrect results.

💡 Proposed change
 	if input.Token == "swiftdialog" {
 		// Orbit installs swiftDialog v2.5.6 for setup experience, MDM migration, or enrollment profile renewal; do not consider it for patch status.
+		out.Queries.Exists = fmt.Sprintf(
+			"SELECT 1 FROM apps WHERE bundle_identifier = '%s' AND path NOT LIKE '/opt/orbit/bin/%%';",
+			out.UniqueIdentifier,
+		)
 		out.Queries.Patched = fmt.Sprintf(
 			"SELECT 1 WHERE NOT EXISTS (SELECT 1 FROM apps WHERE bundle_identifier = '%s' AND version_compare(bundle_short_version, '%s') < 0 AND path NOT LIKE '/opt/orbit/bin/%%');",
 			out.UniqueIdentifier, out.Version,
 		)
 	}

(Note: If applied, the corresponding out.Queries.Exists assertion for swiftdialog in ingester_test.go will also need to be updated).

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
if input.Token == "swiftdialog" {
// Orbit installs swiftDialog v2.5.6 for setup experience, MDM migration, or enrollment profile renewal; do not consider it for patch status.
out.Queries.Patched = fmt.Sprintf(
"SELECT 1 WHERE NOT EXISTS (SELECT 1 FROM apps WHERE bundle_identifier = '%s' AND version_compare(bundle_short_version, '%s') < 0 AND path NOT LIKE '/opt/orbit/bin/%%');",
out.UniqueIdentifier, out.Version,
)
}
if input.Token == "swiftdialog" {
// Orbit installs swiftDialog v2.5.6 for setup experience, MDM migration, or enrollment profile renewal; do not consider it for patch status.
out.Queries.Exists = fmt.Sprintf(
"SELECT 1 FROM apps WHERE bundle_identifier = '%s' AND path NOT LIKE '/opt/orbit/bin/%%';",
out.UniqueIdentifier,
)
out.Queries.Patched = fmt.Sprintf(
"SELECT 1 WHERE NOT EXISTS (SELECT 1 FROM apps WHERE bundle_identifier = '%s' AND version_compare(bundle_short_version, '%s') < 0 AND path NOT LIKE '/opt/orbit/bin/%%');",
out.UniqueIdentifier, out.Version,
)
}
🤖 Prompt for 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.

In `@ee/maintained-apps/ingesters/homebrew/ingester.go` around lines 234 - 240,
Update the swiftdialog handling in the ingester’s Exists query generation to
exclude apps whose path matches /opt/orbit/bin/, while preserving the bundle
identifier filter and ensuring the SQL includes the required WHERE criteria.
Update the corresponding swiftdialog out.Queries.Exists assertion in
ingester_test.go to reflect this filtering.

Source: Path instructions

@allenhouchins

Copy link
Copy Markdown
Member

@jkatz01 thanks! Let me discuss with @noahtalerman in an upcoming Unpacking meeting before merging. I don't like the idea that our patch policy will be green/passing but a potentially vulnerable version of software is still lingering on the device. That will make us and the customer's IT and security teams look bad should something happen.

This might be reason enough for us to keep the orbit-managed version of swiftDialog up to date. As well as the other tools we deploy...

@jkatz01

jkatz01 commented Jul 15, 2026

Copy link
Copy Markdown
Member Author

@allenhouchins thanks, I'll keep this PR as a draft for now.

I think there are reasons why orbit keeps swiftDialog at version 2: https://fleetdm.slack.com/archives/C019WG4GH0A/p1781807932716669?thread_ts=1781807771.352189&cid=C019WG4GH0A

@jkatz01
jkatz01 marked this pull request as draft July 15, 2026 21:27
@allenhouchins

Copy link
Copy Markdown
Member

@allenhouchins thanks, I'll keep this PR as a draft for now.

I think there are reasons why orbit keeps swiftDialog at version 2: https://fleetdm.slack.com/archives/C019WG4GH0A/p1781807932716669?thread_ts=1781807771.352189&cid=C019WG4GH0A

Thanks! I'll dig into what some of those challenges might have been with upgrading the orbit-managed version of swiftDialog. Worst case, I'll update the patch policy with the more explicit path you proposed: AND path != '/opt/orbit/bin/swiftDialog/macos/stable/Dialog.app'

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.

SwiftDialog FMA install conflicts with orbit-installed version in patch policies

3 participants