Skip to content

Use ProcessInfo.hostName for postd SSE log line#26

Merged
odrobnik merged 1 commit into
mainfrom
claude/intelligent-hawking-722e5a
Jun 15, 2026
Merged

Use ProcessInfo.hostName for postd SSE log line#26
odrobnik merged 1 commit into
mainfrom
claude/intelligent-hawking-722e5a

Conversation

@odrobnik

Copy link
Copy Markdown
Contributor

What

postd's HTTP+SSE startup log built its URL with String.localHostname:

daemonLogger.info("MCP HTTP+SSE transport listening on http://\(String.localHostname):\(httpTransport.port)/sse")

SwiftMCP 1.5 (pulled in by #25) removed that helper. A Codex review on #25 flagged this as a P1 "won't compile" β€” but it was a false positive: the daemon kept building and CI stayed green, because SwiftMail 1.6.4 still vends an identical String.localHostname that leaks into PostDaemon.swift through PostServer's transitive import SwiftMail. CI compiles every target (swift build, debug + release, macOS + Linux), so a real break there would have gone red.

So nothing was broken β€” but the green build leaned on two fragile things:

  1. SwiftMail keeping localHostname. SwiftCross's own commit dropping it called it an "API smell inherited from SwiftMail/SwiftMCP," replacing it with the built-in ProcessInfo.hostName plus a new ProcessInfo.localIPAddress. SwiftMail's copy is a likely future removal.
  2. Leaky extension-member visibility through a transitive import β€” which SE-0444 (MemberImportVisibility) would eventually turn into an error requiring a direct import SwiftMail.

Change

Use Foundation's ProcessInfo.processInfo.hostName directly:

  • behavior-preserving β€” the old helper returned ProcessInfo.processInfo.hostName first (IP/localhost only as fallbacks);
  • no new dependency (Foundation is already imported; does not pull in SwiftCross, which intentionally has no hostname shim);
  • matches SwiftMCP's own convention β€” HTTPSSETransport.init defaults its host to ProcessInfo.processInfo.hostName.

Verification

  • swift build βœ… β€” post + postd link cleanly against the pinned SwiftMCP 1.5.1 / SwiftMail 1.6.4.

πŸ€– Generated with Claude Code

The HTTP+SSE startup log built its URL with String.localHostname, a helper
SwiftMCP 1.5 removed. The daemon still compiled β€” and CI stayed green β€”
only because SwiftMail 1.6.4 vends an identical String.localHostname that
leaks into PostDaemon.swift through PostServer's transitive import. That's
fragile on two counts: SwiftMail may drop it (its ecosystem already flagged
it as an API smell, and SwiftCross replaced it with ProcessInfo.hostName /
ProcessInfo.localIPAddress), and SE-0444 member-import-visibility would
require a direct `import SwiftMail`.

Use Foundation's ProcessInfo.processInfo.hostName directly: behavior-
preserving (the old helper returned hostName first), no new dependency, and
the same default SwiftMCP's own HTTPSSETransport uses for `host`.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@odrobnik odrobnik merged commit c7cbad1 into main Jun 15, 2026
2 checks passed
@odrobnik odrobnik deleted the claude/intelligent-hawking-722e5a branch June 15, 2026 09:57
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.

1 participant