Review report

core: PR #36620

Design and approach

The PR says Backup() relies on overwrite_existing but does not say which builds are affected or what happens at runtime. The answer is narrow: a migration retried within the same second stops safely. The test only reports the problem in CI and in developer test runs. If the goal is a CI guard that keeps the project's own Windows toolchain from shipping this bug, say so in the commit message. If the goal is to protect users of affected builds, the fix belongs in the migration code, not in a test. Checked against the checkout. BerkeleyRODatabase::Backup() calls copy_file with overwrite_existing (migrate.cpp:745). Its only caller is migration, because BERKELEY_RO databases can only be opened there (walletdb.cpp:1437-1442). The destination name is <prefix>_<GetTime()>.legacy.bak (wallet.cpp:4279), and the code comment says this name is meant to be unique (wallet.cpp:4267). If copy_file fails, Backup returns false and migration stops with "Unable to make a backup of your wallet" before the wallet is unlocked or converted (wallet.cpp:4281-4283). The destination already exists only when a backup with the same name was made in the same second. One way this happens is an immediate retry after a failed migration: RestoreWallet copies the backup with copy_options::none and leaves it in place (wallet.cpp:459). The test is correct. Each test case gets its own data directory, it writes two distinct files, and it reads back the result. It also runs in the Windows-native CI job (ci.yml:391-392), so it can guard the project's own toolchain. But it changes nothing at runtime for affected builds. The PR's only repro needed a manual override of the pinned toolchain, and the PR never says which builds are at risk or what users would see. That is a real gap in the stated motivation, so the needs_motivation objection is supported and actionable. The candidate's 'avoid overwrite_existing' option moved to the top-level alternatives with an extra cost found in the checkout. The candidate's goal, baseline and benefit were tightened to match the source. 1 2 3 4

Coverage details