Skip to content

Fix CI build: unwrap responsible pid explicitly - #1

Open
eko wants to merge 1 commit into
mainfrom
fix/tapcapture-pid-optional
Open

Fix CI build: unwrap responsible pid explicitly#1
eko wants to merge 1 commit into
mainfrom
fix/tapcapture-pid-optional

Conversation

@eko

@eko eko commented Sep 4, 2026

Copy link
Copy Markdown
Owner

Problem

The Unit tests job failed to compile (not on an assertion):

Sources/MicroCast/TapCapture.swift:59:54: error: value of optional type 'pid_t?' must be unwrapped to a value of type 'pid_t'

In AudioApp.running(), this chain

let owner = responsibleFunction.map { $0(pid) }.flatMap { $0 > 0 ? $0 : nil } ?? pid

infers owner as pid_t on Swift 6.3 (local) but as pid_t? on the toolchain the GitHub runner uses, so every use of owner below it fails to build.

Fix

Replace the map/flatMap chain with an explicit form whose type is unambiguous on every Swift version:

let responsible = responsibleFunction?(pid) ?? 0
let owner: pid_t = responsible > 0 ? responsible : pid

No behaviour change. swift build (clean) and all 64 tests pass locally.

🤖 Generated with Claude Code

https://claude.ai/code/session_013A9rfM4sZpbLNzgX771ns8

The `responsibleFunction.map { $0(pid) }.flatMap { ... } ?? pid` chain
inferred `owner` as a non-optional `pid_t` on Swift 6.3 but as `pid_t?`
on the toolchain CI runs, which broke every use of `owner` below it and
failed the build (and therefore the test job). Replace the chain with an
explicit `responsibleFunction?(pid) ?? 0` and a plain ternary so the type
is unambiguous on every Swift version.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013A9rfM4sZpbLNzgX771ns8
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