33dce0eb7e
Addresses review feedback on the regression test. The test previously parsed the update_cmd.py AST to assert that each auto-restore call site cleared the destination's sidecars before copying. That bound the fix to source text rather than behaviour, and would break on unrelated refactors. Extract _restore_state_db_from_snapshot(state_path, snap_state), which performs the clear -> copy -> verify sequence as one unit and returns whether the restored file passes its integrity check. Both auto-restore paths now call it, so the ordering is guaranteed by construction instead of by inspection, and the two byte-identical blocks collapse to a single call each. The regression test now exercises that helper directly against a database that still owns a hot WAL: removing the clear from inside the helper fails it with 201 rows where 400 were expected, so the guard remains bound to behaviour. Also covers the two failure modes the callers already handle: a snapshot that does not survive the copy returns False, and a missing snapshot raises OSError.