[PR #185·189·190] When Full Verification Fails Every Time: A Longer Time Limit, One Run at a Time, Half the Test Workers
Claude Code is set up to run full verification (npm run verify, the command that runs all server, customer app and admin web tests) automatically at the end of every reply. This is called a hook (a command that runs automatically at a set moment). On my Windows computer, this verification was marked as failed every time. The basis for merging is the verification result on this computer, so a check that always fails is no basis at all. Three PRs solved the causes one by one.
- What was done:
- PR 185: raised the verification time limit from 540 to 1500 seconds.
- PR 189: made verification run only one at a time, and skip when the code is unchanged.
- PR 190: cut the number of test workers (processes that split up and run the test files) to half the logical CPUs.
Step 1: A longer time limit (PR 185)
- Problem: verification went past 540 seconds and failed every time. The server tests alone take about 4 minutes, and the app and admin web tests add more. It was a time problem, not a code problem.
- Method chosen: Of three options, I chose “raise the time limit”. The hook limit went to 1500 seconds and the hook setting’s timeout to 1600 seconds, and the number in the guide document was updated to match. Verification still runs in full, and putting the values back restores the old behavior.
- Alternatives dropped:
- Skip tests when only documents change: if that judgment is wrong, code checks could be skipped, and it would need new code.
- Leave it as is: the failure marks would stay as noise.
- Check: The change is two numbers and one line of text. Whether the new value actually works could only be seen after merging, when the hook reads it, so it could not be checked within this PR.
Step 2: One at a time, and no rerun for the same code (PR 189)
- Problem: When several sessions finished at once, their verifications overlapped and slowed each other down, causing false failures. Even with unchanged code, every reply reran verification for up to 25 minutes.
- Two things added:
- Taking turns: A lock file inside the
.gitfolder, which all worktrees (separate folders for one repository) share, makes only one verification run at a time. If another one is running, it waits. - Skipping the same code: The code state, including uncommitted changes and new files, is turned into a fingerprint (a git tree hash) and recorded on a pass. If the next fingerprint is exactly the same, verification does not run.
- Taking turns: A lock file inside the
- Method chosen: Claude split the deciding part into its own file and added 16 tests. The hook body itself is hard to test, so it was checked by hand. It also checks the pass record once more after waiting for the lock. This keeps a second session in the same folder, finishing at almost the same moment, from rerunning the same code. This was an addition not in the plan.
- Fixed after Codex review: Codex (gpt-5.6-luna) reviewed in read-only mode and found two issues, which Claude fixed.
- If the hook was force-stopped and left its lock, the next verification waited 25 minutes. The lock now records the process number, and if that process is gone, the lock is taken over at once.
- An owner that finished late could delete a lock someone else had taken over. Each lock now records a random value, and a run deletes it only if it is its own.
- Two points not accepted: the code changing between making the fingerprint and comparing it (Claude does not edit code while the hook runs), and changes to files git is set to ignore not being in the fingerprint (a scope accepted in the plan).
- Alternatives dropped: turning the hook off per session with a setting (no way to give it to just one session in the app was confirmed), and skipping when only documents change (the judgment could be wrong).
- Check: The 16 tests passed, including folder names with Korean letters and spaces. Claude also ran the hook directly in a temporary repository with a 3-second fake check: the second run skipped, two at once meant the second waited and then skipped, a lock from an ended process was taken over at once, a failure still blocked the reply from ending as before, and no lock was left behind.
- Cost: When waiting for another verification, a reply can take up to about 50 minutes to end.
Step 3: Half the test workers (PR 190)
- Problem: Verification still failed. Customer app screen tests such as login and invitation, and admin web tests such as the date table and registration, failed only in a full run and passed when run alone.
- Cause: Every failure went past the 5-second-per-test limit (or the 1-second
waitForthat waits for the screen to change). The test tools (jest and vitest) start “logical CPUs - 1” workers by default. This computer has 20 logical CPUs, so 19 workers start, but only some of the cores are fast and the rest are slow. Crowded workers slowed down each test. The failure also showed up when running only the app tests in full, which confirmed it was not other work or state left between tests.
Here is what Claude measured.
| Workers | Total time | Slowest test | Failed runs | |
|---|---|---|---|---|
| Customer app | 19 (default) | 50–98 s | 4.7 s | 2 of 6 |
| Customer app | 10 (half) | 34–40 s | 2.7 s | 0 of 4 |
| Admin web | 19 (default) | 31 s | 5.3 s | 2 of 5 |
| Admin web | 10 (half) | 40–42 s | 3.3 s | 0 of 4 |
- Method chosen:
maxWorkers: '50%'was added to the test settings of the customer app and the admin web. No test content, wait time or time limit was touched. - Alternatives dropped: raising test time limits or
waitFortimes (hides the symptom and leaves the cause), and changing how slow tests type input (could change what the test checks). - Cost: the admin web tests become about 10 seconds slower.
- Check: Claude ran the full
npm run verifytwice in a row, and both passed (310 admin web, 353 customer app and 591 server tests).
Who did what
- Me: in PR 185, I chose “raise the time limit” out of three options.
- Claude (Claude Sonnet 5.5, Claude Code on my Windows computer): changed the values in PR 185.
- Claude (Claude Opus 5.5, Claude Code on my Windows computer): built the hook and tests in PR 189, and measured the cause and changed the settings in PR 190.
- Codex (gpt-5.6-luna, reasoning high): reviewed PR 189 in read-only mode.
Lessons
- A check that fails every time is no basis. Even when it is a time problem rather than a code problem, fix it first.
- Leave an owner mark on a lock. With a process number and a random value, a lock whose owner is gone can be taken over, and someone else’s lock is never deleted.
- When a test passes alone, first see whether it fails when only its own group runs in full. That quickly tells state leaking between tests apart from load.
- Before raising limits for slow tests, look at the number of workers. This time, cutting the workers fixed it without changing a single test.