[PR #206·207·208·210] Twelve Problems Found by a Code Review, Fixed in the Customer App's Recording Screens, the Admin Web, and the App's Server Calls
I asked for the server sub-milestone 1·2 development code to be reviewed by Codex. I had it start with server sub-milestone 1 and the admin web, which an earlier review had only skimmed. The list of problems from that review became a fix plan (PR #206), and the plan’s groups were fixed one at a time. This post covers three of them: the customer app’s recording screens (PR #207), the admin web (PR #208), and the customer app’s server communication (PR #210).
The work was split up on my Windows computer. One Claude Code session (Claude Opus 5.5) directed the review and the plan, and Codex (GPT-6.1 Sol) did the review. For PRs #207 and #208, a separate Claude Code session (Claude Opus 5.5), started by the directing session, wrote the work order, implemented, and checked; the tests were written by Codex (GPT-5.6 Luna). PR #210 was implemented by a Claude Code session (Claude Sonnet 5.5), with tests written by Codex (GPT-6.1 Terra). The implementing side did not edit test files in any of the PRs.
Step 1: Code review and fix plan (PR #206)
- Review result: Codex raised 24 findings. Claude re-read each one in the code, and 23 were correct. One was left out because it had already been postponed in the decision log, and none of the findings were wrong. This PR contains no code changes, only the plan file and the decision record.
- Getting the model: I asked for “solar 6.1”, which turned out to be Codex’s
gpt-6.1-sol. It was first rejected for the signed-in account, and after I approved upgrading Codex from 0.146.0 to 0.167.1 it was accepted. The first update failed because Git Bash’starread aC:path as a remote address, so it was redone in PowerShell. - How it was run: The existing run script (
scripts/codex-run.mjs) pins the model, so it was left alone andcodex execwas run directly with the same sandbox options (network off, writes only inside the working folder). Two separate clones were used, one for the server and one for the screens, because another session’s watcher could treat new files as “written outside”. - Reproduction: Claude re-ran the reproduction tests (tests that show the defect really happens) that Codex made in the clones for 6 admin web findings and 7 customer app findings, and all passed. The 11 server findings could not be reproduced against a real database because Docker Desktop would not start, so they were classed as “confirmed by reading the code”.
- Checks after each Codex run: After every run,
git status,.git/config, and.git/hooksof the main repository were checked and were unchanged.
Step 2: The problems that were fixed
Customer app recording screens (PR #207)
- Four fixes:
- Switching modules while a recording screen was open left the previous module’s memo on the new module’s screen, and it was saved into the new module’s draft (a saved copy of unfinished input).
- Editing a past water-quality record erased the values of deactivated items. The server returns only active items, and the app built the values to send by looping over only the items it had received.
- After logging out, the closing recording screen saved the previous user’s draft again.
- If the user logged out while the camera was open, the returned photo was uploaded and put into the previous user’s draft.
- Chosen approaches and discarded alternatives:
- For 1, the screen is keyed by
user:module: When the key changes, the screen is rebuilt, so the input, loaded draft, and open tab all start fresh. Clearing each piece of state one by one was discarded because a new state added later could be missed. While testing, Claude also found that a field-record form discards its input if it closes within the 0.3-second autosave delay after the first keystroke, so the “has content to keep” flag is now set the moment the user types, a one-line fix. - For 2, the current values of items missing from the received list are attached as they are: The edit screen also reads deactivated items from the values in the record and shows them read-only. One line in
edit.tsx, which was not in the plan’s file list, changed here. - For 3, each form captures a session number when it first opens and saves only with that number: Logging out raises the number, so later saves are dropped by the store. The cause was reading the number fresh each time it saved.
- For 4, the session number from before the camera opened is passed to adding the photo: If it differs, the existing check discards the result.
- No duplicate-code cleanup: The code shared by the three forms was left alone again because it was outside the plan.
- For 1, the screen is keyed by
- How it was checked: Of the 10 new tests Codex wrote first, 9 failed on the code at that time (one guards normal behavior), and after the fix all 89 tests in the 4 changed test files passed. The full verification and the app integration tests that use fake responses instead of a real server (
npm run e2e:app) also passed, andcodex exec reviewhad no findings. The old tests’ fake responses returned deactivated items too, which hid problem 2; Codex corrected them to the real server’s shape.
Admin web (PR #208)
- Five fixes:
- Pressing “register and issue an invite code” issued the code but never showed it on screen. The old test used a fake screen in place of the detail screen, which hid the problem.
- When the login time ran out while saving in a dialog, only “could not save” appeared. A notice component had been built but was used nowhere.
- With customer A’s edit dialog open, going to customer B through browser history left the dialog holding A’s input, and saving overwrote B with A’s values.
- Closing a dialog with Esc during a save and reopening it released the double-save guard, so the same save was sent twice.
- Reopening a record detail and receiving a new photo address still showed the old, expired address.
- Chosen approaches and discarded alternatives:
- For 1, the whole issue response is passed to the existing code dialog: The plan passed only the code string, but then the code ID and expiry time needed by the “passed it on” button would be missing, so the whole response is passed. The history state is cleared right after reading so refreshing or going back does not show it again. One test was flaky in the full verification, so the code dialog is drawn only after the state is cleared, and
codex exec reviewpointed out that the code would be lost if loading the customer failed, so it is drawn in the same place in that case too. - For 2, it is fixed in
api(), the one place every request passes through: The save functions each catch errors themselves, so the shared save helper cannot see them.api()announces a 401admin_session_expired, and open dialogs show a notice with a “log in in a new tab” link. Adding it to each dialog was discarded because it would be missed for new dialogs. - For 3, all open dialogs close the moment the customer
idchanges: Rebuilding the whole screen byidwould have meant changing the router setup, which was outside the plan. - For 4, the dialog ignores Esc while saving: This was applied only to the water-quality item dialog; other dialogs are outside this scope.
- For 5, the thumbnail switches to the new address and clears its failure mark when the address changes.
- For 1, the whole issue response is passed to the existing code dialog: The plan passed only the code string, but then the code ID and expiry time needed by the “passed it on” button would be missing, so the whole response is passed. The history state is cleared right after reading so refreshing or going back does not show it again. One test was flaky in the full verification, so the code dialog is drawn only after the state is cleared, and
- How it was checked: Of the tests Codex wrote first, all but one guarding test failed before the fix, and all 34 in the three files passed after. The test writing took four runs: in the first, 4 of 13 failed because they used an assertion function this project does not have rather than because of a defect, and there were also overlapping screens and meaningless values being checked, so they were sent back. The full verification and the admin web integration tests against a real server (
npm run e2e, 7 tests) also passed.
Customer app server communication (PR #210)
The PR’s title, translated from Korean, is “Customer app communication: shared handling after a refresh retry, fixing late responses and save races (verification fix PR 2)”.
- Three fixes:
- When a pass expired and was refreshed, a request that was re-sent and then failed with
403 consent_required,module_forbidden, or401 session_revokedskipped the shared handling (such as going to the consent screen). Only the first request went through it. - A late
403 account_suspendedfrom a previous account’s request logged out the new account that had signed in in the meantime. - When the previous account’s token-refresh save (a write to secure storage) was slow, it finished after logout and a new login and overwrote the new account’s refresh key and pass.
- When a pass expired and was refreshed, a request that was re-sent and then failed with
- Chosen approaches and discarded alternatives:
- For 1, error handling moved into one function used by both the first and the re-sent request.
- For 2, the session number at request start is captured, and the session-end handler runs only if it matches at response time.
- For 3, in-progress saves are registered in a list and
clear()runs after they finish: If the session number changed by the time a save ends, the pass is not replaced and the result is dropped. Waiting separately on the logout side was discarded in favor of an approach that stays safe even if clearing happens in several places. Only one file outside the plan’s list changed,token-store.ts.
- How it was checked: Codex (GPT-6.1 Terra) wrote 12 tests; before the fix 8 failed and 4 (controls) passed. After the fix the 50 related tests and the app type check passed. In the full verification, 4 tests in 3 screen test files exceeded the 25-second limit under load, but run one at a time all 71 passed; those screens are unrelated to the changed files. The 12 app integration tests against a real server passed, and
codex exec reviewhad no findings. This was the first real task where GPT-6.1 Terra wrote the tests.
The fixes at a glance
| Area | Problems fixed | Key idea |
|---|---|---|
| Recording screens (PR #207) | Memo stays after switching modules, deactivated item values vanish, previous draft saved after logout, logout while the camera is open | Rebuild the screen by key, filter saves by session number |
| Admin web (PR #208) | Invite code not shown, no notice when login expires, overwriting another customer, double save, expired photo address | Fix in one shared place, close open dialogs |
| Customer app communication (PR #210) | Re-sent request skips shared handling, late response logs out the new account, late save overwrites the new account | One error handler, session number, wait for in-progress saves |
Who did what
- I: asked for the review of the server sub-milestone 1·2 code and approved the Codex upgrade and the fix plan.
- Claude Code (Claude Opus 5.5): directed the review and plan and re-checked the 24 findings against the code. For PRs #207 and #208, a separate session given the work wrote the work order, implemented, and checked.
- Claude Code (Claude Sonnet 5.5): implemented and checked PR #210.
- Codex: GPT-6.1 Sol did the review, GPT-5.6 Luna wrote the tests for PRs #207 and #208, and GPT-6.1 Terra wrote the tests for PR #210. The final review (
codex exec review) was also Codex.
What was not verified
- I did not check on a real phone or in a browser. The module-switch and logout flows in the recording screens, editing a past record with a deactivated water-quality item, the invite code display and the login-expiry notice in the admin web, and the races in the customer app’s server communication were checked only with tests.
- The 11 server findings could not be reproduced against a real database.
Lessons
- When fake responses are friendlier than the real server, tests hide bugs. It happened again with the water-quality item list, and in the admin web a fake detail screen hid the invite code problem. Fake responses must follow the shape of the real server code.
- When a test reports “failed”, look at why. In the admin web’s first round, 4 of 13 failed because an assertion function was missing, not because of a defect.
- When deleting a “show once” value, think about the case where the screen to show it has not loaded. The code could have been lost while loading or after a failed load.
- Fix a shared problem in one shared place. The login-expiry notice in
api()and the customer app’s error handling in one function stop dialogs or call sites from being missed. - After an edit, check what actually changed. The first edit script silently changed nothing, so run
git diff --statfirst.