← Binderdex dev log

Moving a paywall no test could reach

#mobile#product#tcg

A line leaves a panel and forks: the solid branch carries three dots to a dim outlined card, while a dashed branch stops short of a glowing amber card

The purchase flow in Binderdex's mobile app lived inside the paywall screen: about 135 lines of orchestration in one component, with no test. Binderdex is a Pokémon card collection and price app, and the paywall is the screen where someone buys its Pro subscription through the app store. A repo-wide review called it fragile, and I agreed. The awkward part came when I tried to prove the cleanup was safe.

A pure move, statement for statement

I moved the flow into its own module as one function that takes its dependencies as arguments. The screen keeps a thin wrapper that passes them in. Refs, React's mutable references, go in as getters, so they're still read at the moment of use. Thirty-six unit tests now cover the flow, and the wider suite of 681 tests still passes.

The review had overstated the dead code, too. The paywall variant, which is an alternate version of the screen, was a constant, so every guard that checked for it was always true. That came to about 50 lines, far less than the review suggested. They're gone.

The device tests never ran the code I moved

Every simulator run passed, and none of them proved anything about the move. My simulator test runs use fixture billing, a stand-in for the real store, and in that mode the paywall calls a different function. The real purchase path never executes there.

So the evidence is the unit tests plus two line-by-line comparisons of old against new: mine, and one from a reviewer agent with fresh context. Both found no difference. I also left two things that look like bugs exactly as they were, because fixing them would've turned a move into a change nobody could compare.

Write down what you didn't verify

A green run only counts for the code it executed. When a test lane can't reach what you changed, say so in the commit, list the check you still owe, and keep the change boring enough to diff by eye. Mine owes a sandbox purchase, which is a test purchase against the store's test environment, plus a cancel and a restore before it ships.

This is the build log for Binderdex (www.binderdex.com) · All entries · Weekly essays