TL;DR: I put a manifest-permission check in the check task. check runs when you run tests. bundleRelease does not run tests. So the build that went to the store was the one build my check never saw.
The claim that has to survive a build
I build offline practice banks for UK qualification tests — SIA licences, CSCS, personal licences, Life in the UK. The apps work with no network and no account. That is the product's promise, and it is trivially easy to break: one analytics SDK, one crash reporter, one convenience call added in a hurry, and the promise is false while the store listing still says it.
So the promise is a build check, not a paragraph in a README. Two of them:
- one fails the build if a known networking library appears among the dependencies;
- one reads the merged manifest of the actual release variant and fails if a permission appears that is not on a short, deliberate allowlist.
The second one exists because permissions usually arrive transitively. You do not type android.permission.ACCESS_NETWORK_STATE anywhere; a library update pulls it in, and suddenly your "works offline" app declares a permission that reads like network access.
Where I put it, and why that was wrong
I attached the manifest check to check. It felt right: check is the aggregate task, everything runs there, CI runs check, done.
Except check runs when you run tests. And building a release bundle does not run tests. bundleRelease is its own path through the build, and it does not detour through check.
Which means: for the entire time that check existed, the one build it never inspected was the build that goes to the store. Local test runs were clean. CI was green. The APK/AAB that a person downloaded could have carried anything.
Nothing bad happened. That is the worst kind of bug: it does not announce itself, it just removes a guarantee you believe you have.
The fix is the boring one
The check now hangs off the packaging tasks themselves — the tasks that produce the artifact, not the tasks that verify the source. Same code, different anchor point.
The general rule I took from it: a check belongs to the artifact it protects, not to the command you happen to run often. "It runs in CI" is not the same as "it runs on the thing you ship", and the difference is invisible until it matters.
The same mistake, second form
The free set taught me the same lesson in a different place. Eight questions from the start of each section are free forever — 32 for a four-paper qualification, 72 for a nine-chapter one. The naive implementation is "the first eight by id".
Sort ids as strings and hist-100 comes before hist-38. The day a chapter crosses a hundred questions, the free set silently shifts, and people who had revised those questions find part of what they learned behind a payment, through no action of their own.
Sorting by the numeric suffix is not pedantry. It is the difference between a promise and a coincidence.
What I would check first in someone else's project
Not the number of tests. The question I ask now: which artifact does each check attach to, and is that the artifact you ship? A suite that runs on every commit but not on the release task is a suite that describes a program you do not distribute.
The longer write-up, with the source-verification pipeline: every question needs a source. Exam formats and pass marks for seven UK tests: the study guides. Practice, free in the browser and offline on Android: trynoeta.com.
