Fix iOS composer compile break (nonisolated image helpers)#6198
Fix iOS composer compile break (nonisolated image helpers)#6198lawrencecchen wants to merge 2 commits into
Conversation
TerminalComposerView is a View (implicitly @mainactor), so its static boundedSendPayload / downsampledImageData were main-actor-isolated, but prepare(url:) is nonisolated and calls them synchronously off-actor inside its background TaskGroup. That fails to compile for ios-simulator ("main actor-isolated static method ... cannot be called from outside of the actor" + "expression is 'async' but is not marked with await"). These are pure ImageIO functions with no main-actor state (the doc comment already states the decode must not run on the main actor), so mark both nonisolated. Referenced size constants are static let Sendable Ints, already nonisolated-accessible. Landed on main via #6102 because ios-simulator is not a required check (iOS CI false-green).
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
📝 WalkthroughWalkthroughImage-encoding helpers and size constants across two modules are marked Image-encoding concurrency isolation
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~3 minutes Possibly related PRs
Poem
Important Pre-merge checks failedPlease resolve all errors before merging. Addressing warnings is optional. ❌ Failed checks (1 error)
✅ Passed checks (20 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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. Comment |
The iOS build runs in Swift 6 mode (-swift-version 6), where static let on a @mainactor type is also main-actor-isolated. Marking the decode functions nonisolated surfaced the next error: prepare()/boundedSendPayload() read the size-cap constants (thumbnailMaxPixelSize, sendMaxPixelSize, maxImageBytes) from the nonisolated path. Mark those three nonisolated; maxImageBytes derives from CMUXMobileShellStore.maxPendingAttachmentImageBytes, so mark that store constant nonisolated too. All are immutable Sendable Int literals with no main-actor state, and nonisolated static lets stay readable from @mainactor callers, so no caller breaks.
main's iOS build is currently broken.
TerminalComposerView: Viewis implicitly@MainActor, so its staticboundedSendPayload/downsampledImageDataare main-actor-isolated, but thenonisolatedprepare(url:)calls them synchronously off-actor inside a backgroundTaskGroup. ios-simulator fails to compile:These are pure ImageIO functions with no main-actor state (the doc comment already says the decode must not run on the main actor), so both are marked
nonisolated. The size constants they read arestatic letSendable Ints, already nonisolated-accessible;PreparedAttachmentis aSendablenested struct (no inherited isolation).Landed on main via #6102 because
ios-simulatoris not a required check (iOS CI false-green). Unblocks the in-flight iOS PRs (#6038, #6044, #6096, #6119) which all merged main and inherited the break.🤖 Generated with Claude Code
Need help on this PR? Tag
/codesmithwith what you need. Autofix is disabled.Note
Low Risk
Isolation annotations only; image encode logic and store caps are unchanged.
Overview
Fixes the iOS simulator compile failure where background image staging called main-actor-isolated static helpers on
TerminalComposerView.prepare(url:)already runs ImageIO in a backgroundTaskGroup;boundedSendPayloadanddownsampledImageDataare nownonisolatedso they can be invoked from that path without crossing the main actor. Related size constants (maxImageBytes,sendMaxPixelSize,thumbnailMaxPixelSize) andCMUXMobileShellStore.maxPendingAttachmentImageBytesare also markednonisolatedso the off-main encode path can read the same caps. No change to attachment limits or encoding behavior.Reviewed by Cursor Bugbot for commit ffadba7. Bugbot is set up for automated code reviews on this repo. Configure here.
Summary by cubic
Fix iOS build by marking
TerminalComposerViewimage helpers and size-cap constants asnonisolatedso background calls fromprepare(url:)compile under Swift 6. Keeps ImageIO work off the main thread and removes the main-actor isolation error in the iOS simulator.boundedSendPayloadanddownsampledImageDatainTerminalComposerViewasnonisolated.maxImageBytes,thumbnailMaxPixelSize,sendMaxPixelSize, and the store’smaxPendingAttachmentImageBytesasnonisolatedfor off-actor reads.Written for commit ffadba7. Summary will update on new commits.
Summary by CodeRabbit
nonisolatedfor safe reads from the composer image-encoding workflow.