ReviewOS

also looking at this

craft-native/craft

test(ios): record registerPush, so every unmigrated action now has a checked reason

#123
Merged glennmichael123 wants to merge test/account-for-register-push into main
1 file +20 -1
packages/zig/test/ios_conformance_test.zigmodified+20-1
Changes to packages/zig/test/ios_conformance_test.zig
@@ -294,6 +294,17 @@ const deliberate_deferrals = [_]Deferral{
294294 .{ .action = "registerBackgroundTask", .reason = "BGTaskScheduler.register must run before launch finishes; a page call is late by construction" },
295295 .{ .action = "getInitialURL", .reason = "DeepLinkManager is pure Swift with no @objc; the launch URL is not re-derivable" },
296296
297 // The device token is delivered to
298 // `didRegisterForRemoteNotificationsWithDeviceToken` on `CraftAppDelegate`,
299 // which SwiftUI instantiates and owns via
300 // `@UIApplicationDelegateAdaptor` — Zig cannot replace it or reliably graft
301 // a method onto it. The token then reaches the page through an
302 // `NSNotification` that Swift posts. Zig *can* observe that notification,
303 // so this is a coupling rather than a wall, and it is recorded as what it
304 // is: serving the action would mean depending on Swift to keep posting a
305 // name the spec is free to change.
306 .{ .action = "registerPush", .reason = "the device token lands on a SwiftUI-owned app delegate; Zig could only observe a notification Swift posts" },
307
297308 // The recorder is a CLLocationManager plus two files that
298309 // `CraftWebView.Coordinator.init` re-adopts at launch, so a Zig-owned stop
299310 // cannot stop a recording Swift has already restored into its own state.
@@ -345,7 +356,15 @@ test "every recorded deferral is real, and still a deferral" {
345356 }
346357
347358 // Non-vacuity: the loop above is satisfied by an empty table.
348 try testing.expect(deliberate_deferrals.len >= 22);
359 try testing.expect(deliberate_deferrals.len >= 23);
360
361 // As of this commit the table happens to cover every unmigrated action,
362 // but that is not asserted. Pinning the exact count would make migrating a
363 // deferred action a three-edit chore — delete the row, lower the ratchet,
364 // fix the count — and would buy nothing the two checks above do not
365 // already catch. The table also stays deliberately non-exhaustive:
366 // "nobody has reached it yet" is an honest state for a newly-added action,
367 // and demanding a reason for one would only invite an invented reason.
349368
350369 // And the table cannot claim more than remain unmigrated.
351370 try testing.expect(deliberate_deferrals.len <= max_not_yet_migrated);