Noted in #249's review and measured: five SIGKILLs during writes left five orphaned temp files, and nothing ever removes them. Two shapes of litter today:
- write-file-atomic temp files (name is the target plus a hash suffix) next to config.json, the account store and the catalog cache. The catalog cache is the worst host since entries run to 16 MB and have no TTL of their own.
- Download .part files (src/ipc/workers/download.ts names them pid + timestamp), abandoned when a download dies hard.
A crash between write and rename is exactly the case atomic writes exist for, so the litter is the cost of correctness; the missing piece is a sweep. Cheapest honest shape: on startup, in each directory we own (userData root, the catalog cache dir, the downloads staging), remove files matching our own temp patterns older than some generous age, and log what was removed at debug. No timers, no background service.
Noted in #249's review and measured: five SIGKILLs during writes left five orphaned temp files, and nothing ever removes them. Two shapes of litter today:
A crash between write and rename is exactly the case atomic writes exist for, so the litter is the cost of correctness; the missing piece is a sweep. Cheapest honest shape: on startup, in each directory we own (userData root, the catalog cache dir, the downloads staging), remove files matching our own temp patterns older than some generous age, and log what was removed at debug. No timers, no background service.