Port the States, Not the Screen
The native Android forecast turned every failure into one “try again” dialog. On iOS, the same screen shows a different notice for each kind of server error. City search on Android failed silently. The radar’s Advisories layer said “no advisories” while it was actually failing to load them.
All three were first-pass ports of Hello Weather iOS features, and all three got the happy path right. Most Android work is now a port of something iOS already does. In late October, a retro over about 35 Android PRs found six issues filed for missing error and empty states. Three more PRs had added accessibility only after review asked for it.
Why ports drop states
A screen’s look is easy to copy. Its states aren’t on the screen. They live in the service that fetches the data and the view model that decides what to show. Porting from a screenshot or a design file shows the happy path, and that’s what gets built. Each missing state then gets found by a reviewer or on a phone, one round at a time.
The fix was to change where the port starts. The ios-port skill, added on October 29, has the agent read the iOS source before writing any Android code, in a fixed order:
- The service file, for each error case it distinguishes, such as each HTTP status and reason.
- The view model, where each published
show*flag is a UI state. - The views and their notices, for layout values, copy, and what each control does.
- Accessibility: labels, grouping, and text-size caps.
- The string catalog, for the exact English.
Build every state in one pass
The skill then asks for one Android state per iOS error case and per show* flag, with the iOS copy. That covers each error kind, offline as distinct from a server error, empty or no results, loading, stale data, and permission denied. Permission denied has an Android twist: after two denials the system stops asking, so the state links to the app’s settings. The skill also covers a non-OK result from any screen the feature opens. The rule is that none of these get folded into one generic dialog or a silent close, and each status-to-state mapping gets a unit test.
The same list makes a QA test plan, whether or not you’re porting anything, which is why the adapted version below drops the porting details.
The skill also asks for a citation where a reviewer would wonder about a value. A one-line comment names the iOS file and number: “iOS pads 28pt below each section.” That came from the same retro, which found three cases where an Android default was later changed to the iOS value.
Translate, don’t copy
Some iOS behavior has no direct Android equivalent, and the porting agent needs to know which differences matter. The skill has a table that maps iOS concepts to what this codebase uses, and a list of platform rules. The QA-relevant ones:
- Screen reader. Each element should read as one sentence on TalkBack, as it does on VoiceOver. iOS’s combined accessibility elements become merged semantics on Android.
- Text size. Android 14 and later scale text to 200%, so screens get tested at the largest size.
- Tap targets. 48dp on Android, not iOS’s 44pt.
- Recreation. Dark mode, font size, locale, resize, and folding all recreate the Android activity, and the process can die in the background. iOS does neither, so ported code often assumes state survives when it doesn’t. Developer options has a “Don’t keep activities” switch that forces this.
- Tablets. On Android 16, a portrait lock is ignored at 600dp and wider, so every screen has to survive rotation.
- Back. Predictive back is on, and there’s no iOS back chevron to copy.
The check list at the end is short: the largest font, a 360dp-wide screen, dark mode set through the app’s own setting, offline, permission denied, one rotation, and TalkBack on each new control. The PR description then lists the iOS files read, the deliberate differences from iOS with a reason for each, and any iOS details left out, each with its issue.
Track what Android owes
The skill fixed how a port gets built. It didn’t say which iOS changes needed porting.
On the same day as the skill, iOS gained a rule: a PR that adds or changes a user-facing feature files an Android issue to port it. A month later that became three labels, written into the shared issue skill and merged in all three repos together on November 29:
needs-androidon an iOS issue or PR means Android should have it and hasn’t shipped it. It stays on after the iOS PR merges, and comes off only when the Android port merges.ios-onlymeans there’s nothing to port: Watch, Siri, Live Activities, CarPlay, or docs and tooling. An agent never ports one.waits-on-ioson an Android PR means it ports an iOS PR that’s still open. It never merges before the iOS PR, and it follows that PR when it changes or closes.
An iOS PR with needs-android also carries an Android: line in its description, naming the port PR or issue as soon as either exists. So gh pr list --label needs-android lists everything Android owes. When the labels landed, 81 open iOS PRs carried needs-android, 42 carried ios-only, and 50 open Android PRs carried waits-on-ios.
Porting from an open iOS PR was a deliberate choice. The owner was asked whether a port should start while its iOS PR is still open, or only once it lands. His answer was “Yes, file it early.” The work is then ready when iOS merges, and the waits-on-ios label keeps it from landing first.
Results
- Ports now start from the iOS service and view model, and their PRs list the states built and the differences kept.
- What Android owes is one labeled list instead of something each session rediscovers.
- We haven’t counted missing-state issues since the skill landed, so the improvement is reported here, not measured.
Lessons Learned
- Start a port from the code that decides state, not from the screen or the design.
- Write one state per error case and per UI flag, and test each mapping.
- Keep a table of platform differences next to the porting instructions. Those differences are where parity bugs hide.
- Track owed ports with labels that stay on until the port merges.
The skill
Adapted from the Android repo’s ios-port, with the repo-specific porting table and labels left out.
---
name: state-coverage
description: Build and verify every state a feature has (errors, offline, empty, loading, stale, permission denied) in the first pass, including when porting a feature from one platform to another. Use for parity work, a port, or QA of a new screen.
---
# State coverage
First passes tend to ship only the happy path: every failure becomes one "try again"
dialog, a search fails silently, an empty state shows during an error. Reviews then find the
rest one round at a time. Read everything first, and build and test it all at once.
## 1. List the states
From the reference implementation (the other platform, the spec, or the existing screen):
1. Each error case the service layer distinguishes (each HTTP status and reason it handles).
2. Each UI-state flag in the view model (each `show*`/`is*` flag is a state).
3. The views and notices: layout constants, copy, what each control does.
4. Accessibility: labels, grouping, text-size caps.
5. The exact English copy from the string catalog.
## 2. Build and test every state
One state per error case and per flag, with the reference copy: each error kind, offline
apart from server error, empty or no results, loading, stale data, permission denied (with
a link to settings; on Android two denials make it permanent), and a non-OK result from a
screen it opens. Never fold them into one generic dialog or a silent close. Unit-test each
status-to-state mapping.
## 3. Platform differences to check (iOS to Android)
- **Screen reader:** each element reads as one sentence on both. iOS combined elements become
merged semantics on Android; custom actions map to custom actions; headers stay headings.
- **Text size:** Android 14+ scales text to 200%; test at the largest size.
- **Tap targets:** at least 48dp on Android, 44pt on iOS.
- **Insets:** a recent targetSdk forces edge-to-edge; a new screen pads for system bars.
- **Recreation:** dark mode, font size, locale, resize and fold recreate the Android activity,
and the process can die in the background; iOS has neither. Test with Developer options >
"Don't keep activities".
- **Tablets:** on recent Android a portrait lock is ignored at 600dp and wider, so screens
must survive rotation.
- **Back:** predictive back is on; there is no iOS back chevron.
## 4. Check and hand off
On the device: largest font, a narrow width (360dp), dark mode, offline, permission denied,
one rotation, and the screen reader on each new control.
The PR lists the reference files read, "Deliberate differences" with a reason for each, and
"Details left out", each with its issue.