ReviewOS

also looking at this

craft-native/craft

test(android): the deferral table, and the no-op it was needed for

#149
Merged glennmichael123 wants to merge test/android-deferral-table into main
1 file +70 -0
10 days ago

Reports #148.

setBadge does nothing

fun setBadge(count: Int) {
    try {
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
            val notificationManager = NotificationManagerCompat.from(activity)
            // Badge is typically shown via notification count
            // Full implementation would require creating a notification
        }
    } catch (e: Exception) { log("Badge not supported: ${e.message}") }
}

It builds a NotificationManagerCompat, discards it, never reads count, and returns. The real work is two comments. clearBadge delegates to it.

Every part of the surface reports success anyway:

  • the injected JS exposes it — setBadge: function(count) { CraftAndroid.setBadge(count) }
  • craft.d.ts:506 declares setBadge(count: number): void for both platforms
  • the catch only fires on an exception, and nothing here throws — so not even a log line

And the same call works on iOS, where bridge_mobile_display.zig implements it for real including badge authorization. A page setting an unread count is correct on one platform and quietly wrong on the other, with nothing anywhere to say which.

Which is why it needs a row, and a row needs a table

Migrating it would mean porting a no-op — exactly what the iOS table already refuses for startVideoRecording (#115), for the same reason: there's no working contract to carry across.

The iOS deferral table exists because three of its reasons had expired and nothing re-checked them. A migration is where prose goes stale fastest, since what a reason describes is precisely what the next commit changes. So this table arrives with the first row that needs it rather than after the tenth.

mutationresult
table names a method the Kotlin lacksDeferralNamesNoSuchAction
Zig starts serving a deferred actionDeferralAlreadyMigrated
table emptied below its floorthe non-vacuity check

Deliberately non-exhaustive

Ninety-one actions are unmigrated and almost all are simply not reached yet — an honest state that needs no row. Demanding a reason for those would invite an invented one, which is worse than silence. A reason is owed only where someone would otherwise try and find out the hard way.

zig build test:android → 109 tests, 11/11 steps.

1 changed file on the files tab, with 0 review threads.

Sign in to comment on this pull request.