* fix: add -verifyCrc to leave needles with damaged data out of the index
weed fix reads only record headers, so a needle whose data was damaged is
indexed and fails on every read. With -verifyCrc it reads each body and
checks it; a needle that fails is not indexed, an older copy of its key is
not brought back, and fix exits non-zero.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* fix: read each record to verify it, so a read error fails instead of dropping it
The scan passes a body buffer even when reading it failed, so -verifyCrc
took bytes it never read for damage. Read the record through a handle of
its own, drop it only when its bytes are corrupt, and fail the scan on any
other read error. -verifyCrc needs the local .dat.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* fix: -verifyCrc rejects a record with a size but no data
A needle with no data is written with size 0, and the CRC covers only the
data, so a record whose data size was zeroed parsed cleanly and skipped
the CRC check. Treat it as corrupt, as the tail repair does.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* fix: index a needle that fails -verifyCrc as deleted
Leaving it out of the index let loading the volume read the bytes past
the last indexed needle as an interrupted append: the older copy of the
key came back and the damaged record was cut. Handle it like a delete
marker, so with -includeDeleted its tombstone keeps the key deleted and
the loader leaves the .dat alone.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>