also looking at this
test(ios): record registerPush, so every unmigrated action now has a checked reason
#123
1 file
+20
-1
| @@ -294,6 +294,17 @@ const deliberate_deferrals = [_]Deferral{ | ||
| 294 | 294 | .{ .action = "registerBackgroundTask", .reason = "BGTaskScheduler.register must run before launch finishes; a page call is late by construction" }, |
| 295 | 295 | .{ .action = "getInitialURL", .reason = "DeepLinkManager is pure Swift with no @objc; the launch URL is not re-derivable" }, |
| 296 | 296 | |
| 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 | ||
| 297 | 308 | // The recorder is a CLLocationManager plus two files that |
| 298 | 309 | // `CraftWebView.Coordinator.init` re-adopts at launch, so a Zig-owned stop |
| 299 | 310 | // 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" { | ||
| 345 | 356 | } |
| 346 | 357 | |
| 347 | 358 | // 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. | |
| 349 | 368 | |
| 350 | 369 | // And the table cannot claim more than remain unmigrated. |
| 351 | 370 | try testing.expect(deliberate_deferrals.len <= max_not_yet_migrated); |