My audit agents wrote the bug; a simulator screenshot found it
I build Homies, a bilingual React Native app, on the side, and the release gates behind it are in its case study, so I will not repeat them here.
This post is about what runs in front of that system on an ordinary day. There are two loops. One reads the code and one looks at the app. Over six days the first one broke login and the second one noticed.
The reading loop
Each audit round, I dispatch independent finder agents, one per lens. The lenses are in the commit subjects: correctness, performance, effects, dependencies and types in one round; security, ledger integrity, accessibility, i18n and CI in another. Each finder reports through its lens only. Then a second set of agents gets a different instruction: try to refute each finding. Prove it is wrong, already handled, or unreachable. What survives becomes a remediation commit.
With one person and no review queue, the cadence is fast: three rounds on the first day, each smaller than the last, and a dozen within the week.
A finder that says "this looks insecure" gets nothing until a verifier fails to refute it. The agents widen the search. I own the verdict and write the guard.
What the reading loop did to login
One of those first-day remediations was titled "lift Accessibility from 3 to 4". Among its changes was a line in the design system's Text component that multiplied lineHeight by the OS font scale. It reads like an accessibility improvement. It was the bug.
Then, for five days, nothing happened. The rounds kept running and none of them removed the multiply. One re-audit remediation on the sixth day touched the symptom: it capped how far the OTP digits could grow, under a comment that describes the multiply and designs around it. At the default text size the multiply is times one, so nothing at that size, in source or on screen, shows a squared line box.
The symptom
Set an iPhone to the largest accessibility text size (AX5) and open Homies, the bilingual React Native app I build on the side. The login screen fell apart. Headings collided. Spacing blew out. Worst of all, the one-time-passcode controls got pushed off the bottom of the screen, past where a thumb could reach. There was no scroll that recovered them. At AX5, you could not enter your code. You could not log in.
That is a lockout. A user who turns the text size up because they need it cannot get into the app at all. The accessibility setting that exists to help them is the exact thing that shuts the door.
The looking loop
What caught it was the other loop. I drive the iOS simulator through forced states (text sizes up to AX5, both locales, light and dark), capture the screens and look at them. The fix commit records how it went: "Root-caused in sim QA by forcing the multiplier to 1, which instantly restored normal layout."
Reproducing it was the same loop: a simulator forced to each Dynamic Type accessibility size, climbing from the default up to AX5. The breakage scaled with the setting. Larger text, worse layout, in a way that looked like it was accelerating rather than growing linearly.
That acceleration was the tell. I forced the font-scale multiplier in the layout code to a constant 1. The layout snapped back to correct at every text size. That single experiment isolated the culprit: something in the code was reading the OS font scale and applying it by hand, on top of whatever the platform was already doing.
The root cause
React Native has a built-in behavior for text: allowFontScaling. When it is on (the default), the OS font scale is applied to the text for you. The important detail that is easy to miss: it scales both fontSize and lineHeight. You do not have to touch either one.
The code touched lineHeight anyway. One of my audit agents had added a manual step that multiplied lineHeight by the current font scale, in that first-day remediation, on the assumption that line height needed scaling that the platform was not doing. But the platform was already doing it. So the line height got scaled twice: once by React Native, once by hand. Two multiplications by the same factor is that factor squared.
At AX5 the font scale is large. Squaring it produced a line box about 9.7 times the default where about 3.1 times was right, so every line of text took three lines of space. That is what shoved the OTP field off the screen. The bug was fontScale^2 hiding inside what looked like a reasonable line-height adjustment.
The fix is a removal
The instinct under pressure is to clamp: cap the scale, special-case AX5, add a guard. That would have hidden the symptom while leaving the wrong math in place. The correct fix was to delete the manual multiply entirely and let the platform do the one scaling pass it was always going to do.
// src/design-system/components/Text.tsx
// BEFORE: RN already scales
// lineHeight by fontScale, so this
// multiply makes it fontScale^2
// (about 9.7x at AX5).
- const scaledLineHeight =
- typeof variantStyle.lineHeight === 'number'
- ? {
- lineHeight: Math.round(
- variantStyle.lineHeight *
- PixelRatio.getFontScale(),
- ),
- }
- : null;
+ // Do NOT scale lineHeight by
+ // PixelRatio.getFontScale(): RN's
+ // allowFontScaling already scales
+ // BOTH fontSize and lineHeight.
style={[
variantStyle,
- scaledLineHeight,
{ color: resolvedColor },
]}The fix removes the double scaling and adds no clamp, cap or special case to Text. The line height now scales exactly once, the way every other piece of text in the platform does.
I clamped it first
I know the clamping instinct because I followed it. The fix landed at 16:49. At 13:15 the same day, another commit had already gone in with a fix for the OTP row: maxFontSizeMultiplier of 1.4 on the digit, plus slot geometry that grows with the font scale up to the same cap.
The comment above that cap is still in OtpInput.tsx. It says Text.tsx "multiplies glyphs + line boxes by PixelRatio.getFontScale(), uncapped", and then designs around that: a fixed 48 by 56 box lets an oversized line box escape the border, so the box has to grow. A second comment further down notes that past the cap the line box "still tracks the RAW font scale, but that overshoot is an invisible layout box".
Both comments describe the bug. They record the multiply and then build geometry to live with it. Neither asks why a design-system text component was scaling anything by hand. Three and a half hours later the forced-to-1 experiment asked it.
The clamp stays, because it is right on its own terms: six digits in fixed-width slots cannot grow without bound on a 360pt-wide screen, so capping that control is a design decision. But the order matters. The clamp made the most visible symptom smaller and would have let the squared line height ship under every other piece of text in the app. The two comments are stale now, since Text.tsx no longer multiplies anything, and they are a fair record of what the code was understood to do at 13:15.
What guards it
No automated test covers this bug, and none is planned.
Two things stand in for one. The first is a comment block in Text.tsx that explains the fontScale^2 failure, so the next person who is tempted to "fix" line height under accessibility scaling reads why not to. The second is the OTP clamp, which bounds the specific control that got pushed off-screen.
A comment is not a test. The font-scale tests the repo does have (Avatar.fontScaling, Badge.fontScaling, mockKit.fontScaling) assert on props: that an avatar's initials opt out of scaling, that a badge drops its numberOfLines clamp at 1.3x. Jest has no layout engine, so none of them can see a line box, and none renders login or the OTP screen. A real regression test would be a Maestro flow on a simulator with the content size forced to AX5, asserting that the OTP field is visible and tappable. No Maestro flow sets the text size today.
The looking loop at the time was a habit with nothing in the repository behind it. It has since gained a runbook, .claude/skills/test-homies-mobile/SKILL.md, written so an agent can run one verification pass and come back with a screenshot. Its rules are specific enough to show where screenshots go wrong:
takeScreenshotgoes inside the Maestro flow. Asimctlscreenshot taken after the flow ends captures the springboard, because the app has backgrounded.- Dark mode is set against an explicit simulator UDID, never
booted. The appearance toggle is global and leaks into whatever else is running. scrollUntilVisible, not a bare scroll, at large font scales. A bare scroll moves too little to reach the primary action.- Hebrew goes through the in-app language toggle and gets toggled back, because one tap is a persistent change.
What the runbook does not do is set the text size. The state that found the lockout is still one I have to remember to set, so it is manual and skippable. I triage what shows up there as functional, because a control pushed off-screen on the login path has the same severity as a crash on the login path.
The checks behind these loops later moved to a self-hosted runner, which is its own post. The short version of the bug, with the diff, is exhibit 1 in the bug museum.
What I take from it
The reading loop is wide and cheap, and it wrote the bug. The looking loop is narrow and manual, and it found it. I keep both. A clean audit round tells me about what can be seen from source, and nothing about layout, scale, locale or the keyboard.