ReviewOS

also looking at this

craft-native/craft

fix(ios): report async pool exhaustion as busy

#267
Merged glennmichael123 wants to merge codex/ios-busy-error-code into main
19 files +53 -65

Review threads live on the whole diff, not on one commit, so none are shown here - a thread's line means something in the branch's final form, and painting it into an intermediate step would put it on code it is not about.

packages/zig/src/bridge_mobile_permissions.zigmodified+3-6
Changes to packages/zig/src/bridge_mobile_permissions.zig
@@ -542,7 +542,7 @@ pub const PermissionsBridge = struct {
542542 "openSettings: no free reply slot; {d} native calls are already awaiting one",
543543 .{ios_async.max_in_flight},
544544 );
545 return bridge_error.BridgeError.NativeCallFailed;
545 return bridge_error.BridgeError.Busy;
546546 };
547547 errdefer ios_async.abandon(ticket);
548548 publishSettingsCall(ticket);
@@ -564,13 +564,10 @@ pub const PermissionsBridge = struct {
564564 }
565565};
566566
567/// The answer for a full block pool. `BridgeError` has no "Busy";
568/// INVALID_PARAMETER is the designated stand-in from the migration notes,
569/// and the point is that the sixteen-plus-first concurrent prompt gets an
570/// explicit rejection instead of a promise that never settles.
567/// Reject a call when every asynchronous reply slot is already in use.
571568fn poolFull() bridge_error.BridgeError {
572569 std.log.warn("permission request refused: all {d} async slots in flight", .{ios_async.max_in_flight});
573 return bridge_error.BridgeError.InvalidParameter;
570 return bridge_error.BridgeError.Busy;
574571}
575572
576573// =============================================================================
packages/zig/src/bridge_mobile_siri.zigmodified+1-1
Changes to packages/zig/src/bridge_mobile_siri.zig
@@ -172,7 +172,7 @@ pub const SiriBridge = struct {
172172 "awaiting one",
173173 .{ios_async.max_in_flight},
174174 );
175 return BridgeError.NativeCallFailed;
175 return BridgeError.Busy;
176176 };
177177 errdefer ios_async.abandon(ticket);
178178
packages/zig/src/bridge_mobile_vision.zigmodified+1-1
Changes to packages/zig/src/bridge_mobile_vision.zig
@@ -191,7 +191,7 @@ pub const VisionBridge = struct {
191191 "{s}: no free reply slot; {d} native calls are already awaiting one",
192192 .{ kind.action(), ios_async.max_in_flight },
193193 );
194 return BridgeError.NativeCallFailed;
194 return BridgeError.Busy;
195195 };
196196
197197 work.* = .{ .handler = handler, .request = request, .kind = kind, .ticket = ticket };
packages/zig/src/bridge_mobile_watch.zigmodified+1-1
Changes to packages/zig/src/bridge_mobile_watch.zig
@@ -318,7 +318,7 @@ pub const WatchBridge = struct {
318318 "sendToWatch: no free reply slot; {d} native calls are already awaiting one",
319319 .{ios_async.max_in_flight},
320320 );
321 return bridge_error.BridgeError.NativeCallFailed;
321 return bridge_error.BridgeError.Busy;
322322 };
323323 errdefer ios_async.abandon(ticket);
324324 publishWatchCall(ticket);