FiCl Dev Blog한국어

[PR #261·263] When You Don't Know Whether a Save Went Through: Resending Only the Same Content, and Writes That Arrive After Logout

Work completed 2026-11-22 10:34 KST · Published 2026-11-25 14:09 KST · AI model used for the work Claude Opus 5.5

[PR #261·263] When You Don't Know Whether a Save Went Through: Resending Only the Same Content, and Writes That Arrive After LogoutSummary figure. In the customer app: locking input while saving, telling failures with an unknown result apart from definite failures, a race where a late read re-locked the screen, and clearing input drafts at logout while blocking late writesPR #261·263When you don't knowwhether a save went throughLock → request number → late read → logoutI choseoption '2'Claude testedCodex builtLockNumberReadLogoutⅠLockPR 2611Lock everything while savingFields, choices,buttons on 8 screensOpen iOS pickers are closed2Skipped recordsAn edit button that can't editThe button is hiddenⅡNumberPR 261:changed 3 times3Unknown-result failureDrop, timeout, or 5xx:resend only the same content4Definite failureA 4xx was not stored,so edit and resendⅢReadPR 261: fullcheck failed5A read that finished lateTook its own sendfor an old oneand locked the screen again6Discard late resultsOnce the screen has sent,a late read is not usedⅣLogoutPR 2637Clear input drafts tooOne function does the clearingNo previous user's notes8Late writesIf the session number changed,skip; remove one just writtenKey: if it may have been saved, resend only the same content. Aclear isn't done until writes arriving after it are blocked too.FiCl Dev Blog · Post summary figure
[PR #261·263] When You Don't Know Whether a Save Went Through: Resending Only the Same Content, and Writes That Arrive After LogoutSummary figure. In the customer app: locking input while saving, telling failures with an unknown result apart from definite failures, a race where a late read re-locked the screen, and clearing input drafts at logout while blocking late writesPR #261·263When you don't knowwhether a save went throughLock → request number → late read → logoutI choseoption '2'Claude testedCodex builtLockNumberReadLogoutⅠLockPR 2611Lock everything while savingFields, choices,buttons on 8 screensOpen iOS pickers are closed2Skipped recordsAn edit button that can't editThe button is hiddenⅡNumberPR 261:changed 3 times3Unknown-result failureDrop, timeout, or 5xx:resend only the same content4Definite failureA 4xx was not stored,so edit and resendⅢReadPR 261: fullcheck failed5A read that finished lateTook its own sendfor an old oneand locked the screen again6Discard late resultsOnce the screen has sent,a late read is not usedⅣLogoutPR 2637Clear input drafts tooOne function does the clearingNo previous user's notes8Late writesIf the session number changed,skip; remove one just writtenKey: if it may have been saved, resend only the same content. Aclear isn't done until writes arriving after it are blocked too.FiCl Dev Blog · Post summary figure

These two PRs fix how the customer app saves. PR 261 fixes the three customer-app items among the candidates left over from an earlier review, and PR 263 fixes one gap found while reviewing PR 261. On 2026-11-22 I approved PR 261 with “go with the recommendations” and PR 263 with “fix this now.”

PR What was wrong What changed
261 Fields could still be changed while saving, so the screen and the server disagreed While saving, every field, choice, and button is locked
261 After a failure, an edited value went out with the same request number and was dropped, yet the screen said “Recorded” Failures with an unknown result are now told apart from definite failures
261 Skipped records had an edit button that only said “This can’t be edited” The button is hidden
263 Input-screen drafts survived logout and could be seen by the next user They are cleared at logout, and late writes are discarded

Who did what:

PR 261: Locking during saves, and request numbers

1. Input is locked while saving

Only the save button was disabled; fields and choices stayed open. If a value changed while the request was in flight, the screen showed the new value while the server stored the old one. On eight screens — input record, after-input check, material preparation, input edit, plan change, device input, refill, and count change — every field, choice, and button is now locked while saving. An open iOS date or time picker is also closed when the lock starts.

2. Edited values dropped after a failure

When the server receives a request number it has already seen (clientRequestId, a number attached so one request is never stored twice), it returns what it stored the first time. So if sending failed and the user edited the value and sent again, the edit was dropped while the screen said “Recorded.” This was found on the material preparation screen, and five other save screens behaved the same way.

The fix changed three times.

Following further review, the unknown-result state is written to the phone before sending. If the user leaves the screen or the app dies mid-request, the screen reopens locked with the same content. Device input and refill remember this per device. If the phone can’t store it, the request is simply sent without it.

Input edit, count change edit, and plan change don’t use this. Those screens prevent overlaps with a standard version (the server rejects with 409), so they reopen after a failure.

3. A late read that re-locked the screen

The full check run by the Stop hook (a check that runs automatically when work ends) failed twice, so the cause was tracked down. When reading the “remembered send” at screen open finished late, it mistook the record left by the user’s own save in the meantime for an old one and locked the screen again. It only showed up in the heavily loaded full check, but it is a race condition (a result that depends on which of two jobs finishes first) that could happen on a real phone too.

Five screens now discard a late read result once that screen has sent anything. A test helper that deliberately delays the read was added. While building it, a mistake on the test side was fixed too: using spyOn and mockRestore (test tools that watch a function and then restore it) on the fake store wiped its fake implementation and broke the next test.

Alternatives dropped

PR 263: Clearing input drafts at logout

What was wrong

Logout clears record drafts and the photo folder with a single draftStore.clearAll(). But drafts on the input plan change, input record, and input edit screens were stored under different names and stayed behind. On a shared phone, the next user opening those screens could see the amounts and notes the previous user was writing.

What was chosen

Alternatives dropped

The “remembered send” from PR 261 was placed under the same name as record drafts from the start, so it was already cleared at logout. It was not touched this time.

How it was checked

PR 261

PR 263

What wasn’t checked

Lessons