[PR #204] Recording in the Customer App: Four Bugs Where Saved Values Came Back as Drafts and Photos Went Missing
I asked for a full review of parts 1 and 2 of the customer app work. The full verification passed, but while reviewing, Claude found bugs in the customer app’s recording screens that the tests could not catch, and I approved the fix plan (“go ahead as planned”). A draft here is a copy of a half-written record kept on the phone.
The work was split up on my Windows computer. One Claude Code (Claude Fable 5.2) session directed, reviewed and implemented, and the same session went on to fix the bugs its review found. Codex (GPT-5.6 Luna) wrote the tests, and the implementation side did not change the test files. The final review was done by codex exec review (GPT-5.6 Luna).
- The four fixes:
- Saved values came back as a draft: In the two record types that take measured values, closing the screen after saving left the values just saved behind as a draft. The request number (a number attached so that sending the same request twice is handled only once) was also the same, so the next time the values were changed and saved, the server returned the old record and the new values were not saved.
- Photos dropped after the re-check screen: Going through the “re-check your input” screen for measured values dropped the photos. A new record lost all its photos, and an edit lost the newly uploaded ones.
- Photos vanished when switching tabs: Moving between the three record-type tabs made photos just added disappear from the screen, and every time the screen reopened, all photos in the draft were uploaded again.
- Two record types shared a request number: Claude found this while rereading the implementation. The field record and one measured-value record shared the same new draft, so their request numbers were the same. Saving one left the other’s draft holding a number that had already been used.
- What was chosen, and what was dropped:
- Blocking the comeback in one place, the draft store: When a save succeeds, the store remembers that request number as “already used” and ignores any request to write a draft with the same number. Blocking it separately on three screens was dropped because that could not cover the input screen still sitting under the re-check screen. A light marker was also added to the measured-value record screens.
- Writing the server’s photo number and upload time into the draft: The re-check screen reads and sends that number, and when the screen reopens, photos that already have a number are not uploaded again.
- Not trusting photo numbers older than six days: The server deletes photos not attached to a record after seven days. So numbers older than six days are dropped and the photo is uploaded again. The plan said “upload again if the server refuses”, but it was hard for the app to tell refusal reasons apart, so this became a time rule.
- Hiding tabs instead of removing them: A tab once opened is hidden rather than removed. Rereading the draft on every tab switch was dropped because the screen filled in a beat late and photos got uploaded again.
- Closing the screens underneath after saving from re-check: After saving from the re-check screen, the input screen left underneath is closed too and the app moves to the done screen (
router.dismissAll(), Expo Router docs, recorded in the log as checked on 2026-11-10). - No cleanup of duplicate code: Merging the overlapping code of the three tabs was not done this time. Mixing it with bug fixes would make review harder.
- How it was checked:
- Reproducing the bug before fixing: Before implementing, a temporary test confirmed the comeback (save → close the screen, and the values stay in the draft). The temporary test file was deleted.
- Tests first: Codex wrote the tests first, and 15 failed before implementation. After implementation, 3 remained because of problems on the test side (a test guarding old behavior, a wording mismatch, and a fake function left by an earlier test), and they went back to Codex to fix. One request-number test was received separately, confirmed to fail, and then fixed.
- Results: 140 record-related tests passed, the app’s type check (a check that values are of the right kind) passed, and lint (a check of coding habits) showed 0 errors.
codex exec review --base mainhad no findings. The admin web did not change, so its integration tests were not run.
The Fixes at a Glance
| Bug | How it was fixed | Key point |
|---|---|---|
| Saved values came back | The draft store remembers used numbers | Blocked in one place, not per screen |
| Photos dropped on re-check | The server’s photo number goes in the draft | Reopening does not upload again |
| Photos vanished on tab switch | Opened tabs are hidden, not removed | Rereading was late and re-uploaded |
| Shared request number | Test received separately, failed, then fixed | Found while rereading the code |
Who Did What
- I: asked for the full review of parts 1 and 2, and approved the fix plan.
- Claude Code (Claude Fable 5.2) on my Windows computer: directed, reviewed and implemented in one session. It found the bugs in review, reproduced them with a temporary test, and fixed the app. It did not change the test files.
- Codex (GPT-5.6 Luna): wrote the tests first and fixed the test problems sent back to it. The final review (
codex exec review) was also Codex.
Not Checked
- This was not checked on a real phone. Whether reopening the recording screen after saving measured values shows an empty screen, whether photos attach when saved together with out-of-range values, and whether going back feels natural after saving from re-check were checked only by tests.
Lessons
- Even when every test passes, a review that follows the flow by reading is needed. All four bugs this time came out in review while the tests were passing.
- When the same problem shows up on several screens, block it in the one place those screens share. Blocking it per screen leaves gaps, like a screen left underneath another.
- Do not look only at the exit code. Once, Codex lost its network connection, wrote nothing, and still ended with exit code 0 (the success signal). Check that the working folder actually changed.
- Run the full verification when no other heavy job is running. Running it at the same time as the Codex review made one unrelated screen test fail once; run separately three times, it passed.