Skip to content

Link container tool in error alert#70

Merged
andrew-waters merged 2 commits into
andrew-waters:mainfrom
dwrss:link-container-tool
Jul 23, 2026
Merged

Link container tool in error alert#70
andrew-waters merged 2 commits into
andrew-waters:mainfrom
dwrss:link-container-tool

Conversation

@dwrss

@dwrss dwrss commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

What does this PR do?

If the container binary cannot be found, this adds a "Download Apple Container" button to the error alert. It is clear you need this in the README, but I can't be the only one who thought they had it installed 😅.

Related issues

None

Screenshots / recording

Error alert from failing to find container binary (Before) Error alert from failing to find container binary (After)

Checklist

  • [x ] The project builds and runs (Orchard scheme)
  • [ x] Tests pass (⌘U / xcodebuild test)
  • [ x] I've added an entry to CHANGELOG.md (Added / Changed / Fixed)
  • [ x] The change is focused on a single logical concern

@coderabbitai

coderabbitai Bot commented Jul 15, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

AlertCenter now carries interactive buttons in user alerts. Missing Container binaries produce a download action, and ContentView renders extra alert buttons and opens their URLs.

Changes

Container startup alert

Layer / File(s) Summary
Alert action contract
Orchard/Services/AlertCenter.swift
Adds AlertButton, extends AppAlert with extraButtons, and accepts optional buttons in user-facing errors.
Missing binary error handling
Orchard/Services/SystemService.swift, CHANGELOG.md
Shows a download action for missing Container binaries while preserving the generic error path for other failures; documents the change.
Alert action rendering
Orchard/Views/Layout/Content.swift
Renders extra alert buttons and opens their URLs through SwiftUI’s openURL environment.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Sequence Diagram(s)

sequenceDiagram
  participant SystemService
  participant AlertCenter
  participant ContentView
  participant openURL
  SystemService->>AlertCenter: report missing Container binary with download button
  AlertCenter->>ContentView: publish alert with extraButtons
  ContentView->>openURL: open supplied download URL
Loading

Suggested reviewers: andrew-waters

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
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.
Title check ✅ Passed The title accurately reflects the main change: adding a download link/button for the missing container alert.
Description check ✅ Passed It follows the template with purpose, related issues, screenshots, and checklist, and is mostly complete.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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

@dwrss dwrss changed the title Link container tool Link container tool in error alert Jul 15, 2026

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🧹 Nitpick comments (2)
Orchard/Services/AlertCenter.swift (2)

3-8: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick win

Use a collision-proof identifier for alert buttons.

Concatenating text and the URL does not guarantee uniqueness; two identical buttons receive the same ID, which can make ForEach treat distinct actions as the same view. Use a stored UUID or another guaranteed-unique key. (developer.apple.com)

🤖 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 `@Orchard/Services/AlertCenter.swift` around lines 3 - 8, Update AlertButton’s
Identifiable implementation to use a stored UUID or another guaranteed-unique
key instead of deriving id by concatenating text and url. Preserve the existing
text and url properties while ensuring distinct button instances always receive
distinct identifiers for ForEach.

Source: MCP tools


3-5: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick win

Define behaviour for URL-less buttons.

url is optional, but ContentView renders every button and silently does nothing when it is nil. Make the URL required for this contract or add explicit non-URL action semantics to avoid clickable no-op buttons.

🤖 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 `@Orchard/Services/AlertCenter.swift` around lines 3 - 5, Update AlertButton
and the ContentView button-handling flow to define behavior when url is nil:
either make AlertButton.url non-optional and require every button to provide a
destination, or add an explicit action representation and handle it in
ContentView. Ensure no rendered button remains a clickable no-op.
🤖 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.

Nitpick comments:
In `@Orchard/Services/AlertCenter.swift`:
- Around line 3-8: Update AlertButton’s Identifiable implementation to use a
stored UUID or another guaranteed-unique key instead of deriving id by
concatenating text and url. Preserve the existing text and url properties while
ensuring distinct button instances always receive distinct identifiers for
ForEach.
- Around line 3-5: Update AlertButton and the ContentView button-handling flow
to define behavior when url is nil: either make AlertButton.url non-optional and
require every button to provide a destination, or add an explicit action
representation and handle it in ContentView. Ensure no rendered button remains a
clickable no-op.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 828c2460-a4a3-4893-87b6-ded7136fc4ce

📥 Commits

Reviewing files that changed from the base of the PR and between f4cd837 and 16a0214.

📒 Files selected for processing (4)
  • CHANGELOG.md
  • Orchard/Services/AlertCenter.swift
  • Orchard/Services/SystemService.swift
  • Orchard/Views/Layout/Content.swift

@dwrss

dwrss commented Jul 15, 2026

Copy link
Copy Markdown
Contributor Author

🧹 Nitpick comments (2)

Orchard/Services/AlertCenter.swift (2)> 3-8: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick win

Use a collision-proof identifier for alert buttons.
Concatenating text and the URL does not guarantee uniqueness; two identical buttons receive the same ID, which can make ForEach treat distinct actions as the same view. Use a stored UUID or another guaranteed-unique key. (developer.apple.com)

🤖 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 `@Orchard/Services/AlertCenter.swift` around lines 3 - 8, Update AlertButton’s
Identifiable implementation to use a stored UUID or another guaranteed-unique
key instead of deriving id by concatenating text and url. Preserve the existing
text and url properties while ensuring distinct button instances always receive
distinct identifiers for ForEach.

Source: MCP tools

3-5: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick win
Define behaviour for URL-less buttons.
url is optional, but ContentView renders every button and silently does nothing when it is nil. Make the URL required for this contract or add explicit non-URL action semantics to avoid clickable no-op buttons.

🤖 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 `@Orchard/Services/AlertCenter.swift` around lines 3 - 5, Update AlertButton
and the ContentView button-handling flow to define behavior when url is nil:
either make AlertButton.url non-optional and require every button to provide a
destination, or add an explicit action representation and handle it in
ContentView. Ensure no rendered button remains a clickable no-op.

🤖 Prompt for all review comments with AI agents
ℹ️ Review info

It's technically correct that the ID isn't collision resistant, but multiple buttons with identical text and link effectively are the same button for SwiftUI identity purposes (it would log warnings, but this would be a programming area so that's probably helpful…)

RE buttons without a link: They'll dismiss the alert. A future extension might be to pass in a closure, but that seems out-of-scope for this change.

@andrew-waters
andrew-waters merged commit b11dc4c into andrew-waters:main Jul 23, 2026
4 checks passed
@andrew-waters

Copy link
Copy Markdown
Owner

Thanks for this @dwrss 👍🏼

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.

2 participants