[PR #249·254·255·260] Four Tests That Joined Screens Built on Fake Responses to the Real Server
Until now, the sub-milestone 3 screens (the feature that calculates and records the daily plan) were tested only with fake responses (server answers that the tests decide in advance). These four PRs joined those screens to the real server. In order: a customer app integration test (PR 249), admin web flow tests (PR 254), a server flow test that changes dates to see whether the plan follows (PR 255), and a check of the calculation against the 2022 sheet (PR 260).
The models differ by PR. Everything ran on my Windows computer.
- PR 249: a Claude Code session (Claude Sonnet 5.5) did the tests, verification, docs and PR. It only added tests, so Codex was not used.
- PR 254: a Claude Code session (Claude Sonnet 5.5) did the tests, work instructions, verification, docs and PR, and Codex (
gpt-6.1-terra) wrote the code. The final review wascodex exec review. - PR 255: a Claude Code session (Claude Opus 5.5) wrote the work instructions and checked the results, and Codex (
gpt-6.1-terra) wrote the tests. - PR 260: the conductor session (the session that hands work out to other sessions, Claude Opus 5.5) checked the sheet and did the tests, docs and PR. Codex was not used.
| PR | What was tested | Written by | Result |
|---|---|---|---|
| 249 | The customer app’s API functions against the real server | Claude (tests) | 16 tests passed three times in a row |
| 254 | Three admin web flows (Playwright) and matching the server | Claude (tests), Codex (implementation) | npm run e2e: 10 passed; 1 review finding fixed |
| 255 | Whether the plan follows date changes (server) | Codex (tests) | 5 new tests passed with no server code change |
| 260 | Matching the calculation to the 2022 sheet | Conductor session (tests) | 49 passed, including 2 new cases |
PR 249: Holding the customer app’s API functions up to the real server
What and why
Claude added an integration test (apps/app/integration/detail3.test.ts) that runs the customer app’s server functions (src/api/endpoints.ts) against the real server, to see whether both sides speak the same shape. No code changed. There are four tests.
- When the admin approves a calculation standard and enters the start information, today’s plan shows 4 rounds. Recording a round turns it into “recorded” and raises today’s total. Sending again with the same request number returns the same record, and the list holds only one. Recording the same round with a new number is refused with 409 (already exists).
- Recording a count change lowers today’s planned total.
- Recording a drop larger than the starting count is refused, and the existing plan comes back with it. This is why the customer app screen can show the refusal message and the plan together.
- Four devices come back. A refill up to the maximum capacity is saved, and one above it is refused with 400. A refill with zero water and zero product is refused. Sending twice with the same request number still saves one, and device input is added to the “input since the last refill” total.
Approach and rejected alternatives
- Only the app’s API functions are used. The screens are not drawn, since the fake-response tests already cover them. If the server’s response shape changes, this test breaks first.
- The test creates its own test data. The default test data may have no devices, and this keeps it apart from the sub-milestone 2 tests. Each test also creates and approves its own calculation standard (only one can be approved at a time, so the last one is used).
- Dates use the Korean calendar date, with the start date set 55 days ago (day 56 elapsed).
- Rejected: a full end-to-end test that also drives the screens. There is no tool to drive a phone screen, and a real-phone check happens separately.
How it was checked
npm run e2e:app: 16 tests in 3 suites passed three times in a row (about 50 seconds each).- The known problem of finding zero tests when the working folder path contains
.claude/worktreesis still there, so Claude ran it in a Codex clone with no dot (.) in its path, with the test file placed on the latest main. - App type check passed, 0 lint errors (the 11 warnings are all in existing files).
PR 254: Admin web flow tests (Playwright) and matching the server
What and why
Three admin web flow tests (apps/admin/e2e/detail3.spec.ts) were written with Playwright (a test tool that clicks through a browser automatically). In this PR, Claude wrote the tests and Codex did the implementation.
- Create two input materials → paste rates into a calculation standard draft and set the mix → approve → accept an invitation → enter the start date, start information and starting days elapsed → create a plan with a weight record and a today’s-plan request (sent straight to the server in place of the customer app) and leave an input record → check count, days elapsed (11), weight (recorded) and rate under “plan basis” in the work record detail.
- Rename the product on device B → check that “device settings changed” appears in the history.
- Save the planned start date → start date → planned send-out date on screen and check them in the module tab and history.
Codex built the server seed (data loaded when the tests start: 4 devices, 2 modules, 1 customer with a pending invitation) and matched the admin web to the server.
- Types the admin web kept on its own (work records, corrections, count summary) now come from the shared package (
@ficl/shared). - The device response now uses the shape the server actually sends.
- The history screen gained Korean names for 4 action names the server uses. Before, the English names showed as they were.
Approach and rejected alternatives
- The invitation-accept helper moved to a shared file (
support.ts) so the sub-milestone 2 tests use it too. It was not copied. - The plan basis total is checked only for its “total N kg” shape. A value like 6.885 can round to 6.88 or 6.89 because of floating point (how computers handle decimals), so the server tests own the exact value.
- Rejected: closing the cycle from the screen. There is neither a screen nor a request to close it, so flow 3 stops at the planned send-out date.
- After the implementation, Claude fixed the tests twice. Once because it had assumed the reason for a date change shows in the reason column, when it actually shows in the detail column; and once, following a review comment, to check the history separately as “this flow’s start date row” and “this flow’s planned send-out date row”. Both were separate commits that changed only the tests.
- Codex again could not commit, so Claude committed in the clone.
How it was checked
- 486 admin web unit tests, type checks (admin web and server) and lint passed.
npm run verify: 11 minutes 50 seconds, passed (server 832, customer app 752, admin web 486).npm run e2e: 10 passed (79 seconds, 42 seconds on a rerun). After the review changes, the three flow tests passed again (42 seconds).codex exec review(2 minutes 47 seconds) raised one finding: the history count in flow 3 could include rows made by other tests. It was fixed.
PR 255: Checking on the server that the plan follows date changes
What and why
This work checks in one go, on the server side, the “dates → plan” flow that the admin web had put off, and adds 2022 sheet cases to the calculation tests. In this PR, Codex wrote the tests and the implementation side did not edit them.
The flow test changes dates and watches whether the plan follows.
- With only a planned start date, there is no plan today and “no start information” is shown.
- After entering the start date, start information and starting days elapsed, today’s plan version 1 appears (day 10).
- Moving the start date one day earlier recalculates at day 11 and makes version 2 (total 1.8 → 3.6 kg); version 1 becomes past.
- After closing the cycle and moving to the next day, it shows “no start information” again and makes no plan.
The calculation tests gained values for days 35, 70 and 84 of the 2022 sheet, computed with the formula in the reference data document. A case where a temperature missing from a small temperature table means no calculation was added too.
Approach and rejected alternatives
- Closing the cycle: the server has no request to close a cycle. The sub-milestone 2 design put that feature off to a later milestone. The conductor session decided the test would close it by editing the database directly, with a comment explaining why.
- Rejected: making a new admin request now. Its shape is not in the design, and it would be hard to undo.
- 2022 sheet values: the original sheet is not in the repository. The only days for which the reference data document lists both the rate and the standard weight are 35, 70 and 84 (plus 56, already tested), and it does not list the sheet’s daily amount or that day’s temperature. The conductor session set the expected values for those three days from the reference data document’s formula. Temperatures were chosen to pass through each rule: inside the table, below the table, and at or above the top of the table.
- Rejected: pulling those three rows from where the original lives. That session had no permission to read the original.
How it was checked
- Codex wrote 5 tests (4 calculation, 1 flow), and all passed without any server code change. These tests check for gaps, so having no “fails before implementation” step is expected, as the conductor session confirmed.
- The test contents were checked so the passes were not empty passes (passes that actually check nothing). The flow test checks total, days elapsed, version state and no plan the next day with exact values, and the calculation tests check amount, rate, temperature rate and the round sum with exact values.
- 48 tests in the changed suites passed; the full
npm run verifypassed in 666 seconds (admin web 482, customer app 755, server 857). - The admin web code did not change, so
npm run e2ewas not run.
PR 260: Matching the calculation to the 2022 sheet
What and why
One of the sub-milestone 3 completion criteria is “the calculation matches the 2022 sheet values.” PR 255 built its cases from the formula because the original sheet was missing, so the criterion had not yet been checked against the sheet itself. I pointed to the shared drive that holds the original, and the conductor session read the rows for days 35, 56, 70 and 84 (weight, total weight, rate, temperature, daily amount) from the original sheet.
- Days 35 and 56 matched the existing cases.
- Days 70 and 84 could not be matched against the sheet, because PR 255 had moved their temperatures outside the table to test the temperature rules.
- So two cases for days 70 and 84, with the same temperature as the sheet, were added to the calculation tests (
calc.spec.ts).
Approach and rejected alternatives
- The out-of-table temperature cases test the temperature rules, so they stayed, and the sheet cases were added separately.
- Rejected: changing the out-of-table temperature cases to the sheet temperature. The temperature rule checks would be lost.
- The file in the folder I pointed to first was a different document, not the target sheet.
- The sheet file was not added to the repository. The original stays on the shared drive.
How it was checked
- 49 tests in
calc.spec.tspassed (including the 2 new cases). - The full
npm run verifyresult for this PR is not in the devlog, so it was not confirmed.
Lessons
- When tests decide the fake responses, they drift from the server. The admin web’s device response had a different shape from the server’s. Once the server exists, connect to the real response at least once right away.
- Before writing instructions, check that each step in the plan exists as a real request. Closing the cycle was in the plan, but the server had no request for it.
- Record where source material lives, not just its file name. The reference data document had only the file name and no folder path, so finding it took time.
- When several sessions run on one computer, do not wait for the machine to be completely idle. Verification runs queue up at the end of every turn, so the wait never ends (a lesson from PR 257, the wrap-up work the same week).