FiCl Dev Blog한국어

[PR #233·235·236·240·243·250] Building the Server Requests Screens Call: Locking Concurrent Requests and Overlapping Codex Runs

Work completed 2026-11-19 21:12 KST · Published 2026-11-22 13:05 KST · AI model used for the work Claude Opus 5.5

[PR #233·235·236·240·243·250] Building the Server Requests Screens Call: Locking Concurrent Requests and Overlapping Codex RunsSummary. Six PRs built the server requests admin web and customer app screens call: locks so only one concurrent request is processed, database checks as the last line of defense, a bug loose tests missed but the type check found, and rules for Codex runs when jobs overlap on one computerPR #233·235·236·240·243·250Server Requests for the ScreensLocks · last defense · type check · overlapping runsCodex wrote tests, reviewedClaude implementedI chose to keep results1Only one concurrent requestApprovals take turns under a lockPlans and records lock the module rowRecheck the request number after the lock2DB checks as last defenseCode rejects first with 409 or 400Relying on the trigger gives a bare 500Lists read in one query3Bug the type check found14 toMatchObject tests passedDetail response held raw DB rowsClaude fixed it4Overlapping Codex runsExit code 0 but nothing writtenStopped when Claude edited the folderStopped on a field that did not existRules learnedCheck that the clone changed, not just the exit code.Only read the working folder while Codex runs.KeyRecheck after the lock for requests that can arrive together.Look at the result even when a run ends in "success".FiCl Dev Blog · Post summary figure
[PR #233·235·236·240·243·250] Building the Server Requests Screens Call: Locking Concurrent Requests and Overlapping Codex RunsSummary. Six PRs built the server requests admin web and customer app screens call: locks so only one concurrent request is processed, database checks as the last line of defense, a bug loose tests missed but the type check found, and rules for Codex runs when jobs overlap on one computerPR #233·235·236·240·243·250Server Requests for the ScreensLocks · last defense · type check · overlapping runsCodex wrote tests, reviewedClaude implementedI chose to keep results1Only one concurrent requestApprovals take turns under a lockPlans and records lock the module rowRecheck the request number after the lock2DB checks as last defenseCode rejects first with 409 or 400Relying on the trigger gives a bare 500Lists read in one query3Bug the type check found14 toMatchObject tests passedDetail response held raw DB rowsClaude fixed it4Overlapping Codex runsExit code 0 but nothing writtenStopped when Claude edited the folderStopped on a field that did not existRules learnedCheck that the clone changed, not just the exit code.Only read the working folder while Codex runs.KeyRecheck after the lock for requests that can arrive together.Look at the result even when a run ends in "success".FiCl Dev Blog · Post summary figure

These six PRs are server tasks 3 to 8 of part 3. They built, one after another, the server requests (the addresses a screen calls to tell the server “save this” or “show me this”) that admin web and customer app screens use. Some of those screens had been built first against fake responses, and this time the real server filled in.

Everything ran on my Windows computer. A Claude Code session (Claude Opus 5.5) did the implementation, and Codex (gpt-6.1-terra) wrote and fixed the tests and did the final code review (codex exec review). A separate coordinating session (Claude Opus) set the order of work and some of the rules. Codex wrote the tests and the implementation side did not edit the test files (track A).

What was built

PR Server requests built
233 Admin web: calculation standard versions (create draft, edit, approve), input material types (add, rename, deactivate), cycle start value, count adjustment
235 Customer app: daily plan (created the first time it is viewed that day), recalculation after records change, customer plan changes and accepting a new proposal
236 Customer app: input records, post-input checks, material preparation records
240 Customer app: count change records (decrease, sent out, moved)
243 Customer app: device input and refill records; admin web: device settings
250 Admin web: plans and work records in one list, notes on corrected records

Response shapes (types) live in a shared package so the server and the screens use the same definitions.

Processing only one of two concurrent requests

When the same request arrives twice at almost the same moment, both see “nothing here yet” and try to save, so one fails or two rows appear. So wherever requests can overlap, a lock (a device that makes the next request wait until the first one finishes) was added.

The Codex review on PR 236 found two more gaps.

  1. If the app missed a response and resent the same request 48 hours later, the server returned a “record too old” error instead of the saved record. It now checks whether the request number is the same before checking the time.
  2. If the same request arrived twice at once, the second could get a “round already recorded” error. It now checks the request number once more after taking the lock.

Database checks as the last line of defense

There was already a database trigger (a check the database runs by itself when saving) that blocks edits to an approved standard version. But relying only on the trigger means the user gets a 500 error with no reason. So the service code checks first and returns “cannot edit, not a draft” (409), and the trigger stays as a last line of defense for anything the code misses.

In the same spirit, integers with no defined range are accepted only up to the database integer limit. Larger values are rejected with 400 at the input step instead of reaching the database and becoming a 500.

Other choices:

The type check found a bug the tests missed

In PR 236, after all 14 new tests passed, the type check (the computer confirming code keeps the data shapes it declared) found a bug. The edit history field in the record detail response held raw database rows instead of the screen-facing shape.

The tests compared responses with toMatchObject (a comparison that checks only the expected fields and ignores the rest). The overlapping fields matched, so the tests passed even with extra fields attached. Claude fixed it, and the devlog noted “treat the type check as evidence as trustworthy as the tests”.

PR 235 had a different kind of silent failure. Three services ended up importing each other in a loop, and Nest (the server framework) could not find a dependency. When services import each other, an injected value can quietly end up empty, so the shared calculation function moved to a file that is not a service.

When several jobs overlap on one computer

During this period, server, admin web and customer app jobs ran at the same time on the same computer. Because of that, Codex test runs ended in unexpected ways several times.

The rules that came out of this:

How it was checked

Lessons