Update BonjourPico integration with new API and async/await#1
Conversation
BonjourPico's v2 rewrite replaced its discovery surface with an @observable facade. Migrate SelectServerView to the new API: - bonjourPico.servers -> bonjourPico.endpoints ([BonjourEndpoint]) - server.name -> endpoint.displayName - server.ipAddress -> endpoint.ipAddresses.first (falls back to hostName) - startStop() -> async startScanning() / stopScanning(), toggled in a Task; the initial scan is kicked off via .task Repoint the example app's BonjourPico dependency from the 0.0.1 tag (old API) to the main branch, where v2 is merged, and refresh Package.resolved. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XhgHkRGhNMDrJ525CAeiga
There was a problem hiding this comment.
Code Review
This pull request updates the BonjourPico dependency to the main branch and refactors SelectServerView.swift to use the new asynchronous endpoints API. It also transitions scanning operations to Swift concurrency using Task and the .task modifier. The review feedback points out a potential issue where IPv6 addresses containing colons will fail to parse as valid URLs unless they are enclosed in square brackets, and provides a code suggestion to handle this case.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
The package has no SwiftUI/UIKit/AppKit or platform-conditional code, so a single macOS SwiftPM run compiles and exercises both library targets (OpenResponses, OpenResponsesSwiftUI) and both Swift Testing suites. Runs on pushes to main and on pull requests. Uses the latest stable Xcode to provide the Swift 6.2 toolchain the package's tools-version requires. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XhgHkRGhNMDrJ525CAeiga
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: c51ddccd9e
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
A discovered endpoint may advertise an IPv6 address as its first IP. Interpolating it raw into "http://<host>:<port>" produces an invalid URL (URL(string:) returns nil), so the server can't be selected. Prefer the Bonjour host name (which BonjourPico documents as the way to connect) and fall back to an advertised IP, bracketing IPv6 literals so the URL host is valid. Addresses the IPv6 review feedback on PR #1. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XhgHkRGhNMDrJ525CAeiga
With the new BonjourPico API, stopScanning() clears `endpoints`, which made the "Stop scanning" button wipe every discovered server from the list. Restore the previous behavior by rendering from a local @State snapshot that mirrors bonjourPico.endpoints while scanning and is preserved when scanning stops, so the list stays visible and selectable. Addresses the review feedback on PR #1. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XhgHkRGhNMDrJ525CAeiga
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 1183db8b3b
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
The local discoveredServers snapshot is intentionally preserved when a scan stops, so the list stays selectable. But the onChange guard only copies endpoints while isScanning is true, so a *new* scan that finds nothing never overwrote the old snapshot — leaving stale servers from the previous scan visible and selectable. Clear discoveredServers at the start of each scan (via a startScan() helper used by both .task and the Scan button) so a fresh scan begins empty and only shows servers it actually rediscovers. Stopping a scan still keeps the list. Addresses Codex review feedback on PR #1. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XhgHkRGhNMDrJ525CAeiga
Codex flagged that CI only built the SwiftPM package, so the example app (the subject of this PR) and its Xcode package resolution were never compiled. Wiring it up for CI surfaced stale, pre-existing dependencies: - The project linked products PicoResponsesCore / PicoResponsesSwiftUI from a local sibling package ../../PicoResponses (the repo's pre-rename name), while the sources import the renamed OpenResponses / OpenResponsesSwiftUI modules. Repoint that dependency to the in-repo package (..) and link the OpenResponses / OpenResponsesSwiftUI products. - PicoMarkdownView was a local sibling (../../PicoMarkdownView) absent from this repo, so CI could not resolve it. Convert it to a remote package reference (github.com/PicoMLX/PicoMarkdownView, main) and pin it. Add a shared ResponsesExample scheme so xcodebuild can build it by name, and add a build-example CI job that resolves packages and builds the app for macOS with code signing disabled. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XhgHkRGhNMDrJ525CAeiga
|
@codex review |
|
Codex Review: Didn't find any major issues. What shall we delve into next? Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
Summary
This PR updates the SelectServerView to work with the latest BonjourPico API, which introduces breaking changes to the data model and scanning interface. The changes modernize the code to use async/await patterns and improve the server connection logic.
Key Changes
bonjourPico.serverstobonjourPico.endpointswith updated property names (displayNameinstead ofname,ipAddressesarray instead of singleipAddress)startStop()method with asyncstartScanning()andstopScanning()methods.onAppearto.taskmodifier for proper async initializationNotable Implementation Details
endpoint.ipAddresses.first ?? endpoint.hostNameisScanningstate to call the appropriate async methodhttps://claude.ai/code/session_01XhgHkRGhNMDrJ525CAeiga