The previous post, Building deploys in a clean copy, moved the deploy build into a git worktree, .live: the code comes only from what has been pushed, while data, logs and node_modules are still shared with the original folder. A day later I ran a full-project health check, and tsc, eslint and all 469 vitest tests passed, so it looked healthy.
But reading logs/ told another story. The four things below were happening every day, and none of them took the site down, so none of them was noticed.
1. A hand-assembled node_modules path does not exist in a worktree
The architecture diagrams are pre-rendered at deploy time: Playwright opens a browser and draws mermaid into SVG, so visitors do not have to download mermaid. The script located mermaid like this:
.live has no node_modules of its own. import { chromium } from "playwright" is fine, because Node's module resolution keeps looking in parent folders until it finds the live site's copy; what broke was this kind of hand-assembled path, which does not look upward.
This step was deliberately designed so that "failure does not block the deploy" (when the SVG is missing, the page falls back to drawing in the browser), so every deploy added just one [WARN] line and the site was fine. I counted 48 of them across two deploy logs. The consequence was that a diagram added later was never pre-rendered, and visitors to that page kept downloading mermaid.
I changed it to let Node resolve it itself:
Run for real in a worktree that likewise has no node_modules, it drew the diagram that had been missing all along.
2. Git for Windows updated, and openssl changed folders
The daily backup packs the data, encrypts it with openssl, and pushes it to a private GitHub repo as an off-site backup in case the whole machine dies. The script hard-coded:
The new Git for Windows uses ucrt64, and that path no longer exists. From 11-26 the backup failed at the encryption step 4 days in a row: the local copy was made every day, while the off-site one was never pushed. I changed it to look in ucrt64, mingw64 and usr\bin in order, and only if none has it, use the one on PATH; on the PowerShell 5.1 that the desktop's schedule uses, it found the ucrt64 one, and an encrypt-then-decrypt round trip gave identical hashes.
Hard-coding the install path of a third-party tool writes "they will never move house" into your program.
3. "Could not read" was treated as "recovered"
The program that monitors the Raspberry Pi's temperature SSHes in every 15 minutes, sends mail at 75°C and above, and a recovery mail when it falls below 70°C. One morning the watchdog sent this:
The cause was that the condition looked only at "the temperature read this time":
In the round where SSH did not get a reading, temp was null, "too hot" became false, and the watchdog saw the state go from present to absent and sent the recovery mail. The power supply, memory card and disk-space checks were written the same way.
The fix is to separate "there is no new number" from "the number is normal": with no new number, the previous round's judgment is kept, and recovery is decided only when a real reading arrives. The mail text now uses the last temperature actually read, so null°C cannot appear again. I added a unit test, first confirming that it fails on the old code and then that the new code passes.
4. Two processes fighting over the same .tmp
The server's log had dozens of lines an hour like:
The file is written the usual way, "write a .tmp first, then rename", so that the API never reads a half-written file. The problem is that two servers were writing at once: the live site, plus a test server another session had started for verification without turning off its radar polling. Both used the same temp file name, so when one finished renaming, the other found the file gone (ENOENT) or collided exactly (EPERM). The time the errors began matched the time the test server started.
Adding the pid to the temp name (radar-track.json.<pid>.tmp) stops the two stepping on each other. The root fix is still that a test server should not read the real radar and write the real data file, a rule that was already in the test procedure and had simply not been followed.
What they have in common
The four share one shape: assumptions that happened to hold in the original environment: node_modules is right beside it, openssl is in that folder, the data can be read, only one process is writing. When the environment changes, the program raises no error; it just quietly does the wrong thing.
And all of them slipped past the tests: the type check does not care whether a path exists, and the unit tests run in clean temp folders. What caught them was the most boring step: reading the logs from start to end and counting how many times each kind of error appears.