Only prune a nonempty segment after every byte is proven zero. A zero header alone is not evidence that recovery data is absent. Scan with bounded memory and preserve the file on read failure.
Signed-off-by: trvon <me@trevon.dev>
WALManager::Config defaulted walDirectory to "./wal", so any manager built
from a default config wrote segments into the process working directory.
The repo root had accumulated 43,577 such files (42,499 zero-byte, 1,078
zero-filled 1 MiB mmap preallocations from killed writers; 1.1 GB, no
entries). The daemon already passes <dataDir>/wal explicitly.
- walDirectory has no default; initialize() returns InvalidArgument when
it is empty. The default constructor is removed (it had no callers).
- initialize() still derives the sequence from every segment name, then
deletes plain segments that never received an entry: zero bytes, or a
zero magic word at offset 0 (a preallocation left by an unclean exit).
Compressed segments and anything with real bytes are untouched.
Tests: unconfigured directory is rejected; 50 empty + 1 preallocated
segments are pruned, a non-empty one survives, and the sequence still
advances past the pruned names.
Signed-off-by: trvon <me@trevon.dev>