# repo22 legacy full-index fix manual report

- Date: 2026-08-08 UTC
- Source baseline: `377d467a652beb2124d4adc0d1f8e735fca22344`
- FreeBSD guest: 15.0-RELEASE-p8 amd64, QEMU TCG
- Module SHA256: `f3b9fa70bfb8e98e2cef436583fd13cb91787514a5be76f9f108698d7586ca3c`
- Scope: legacy full-index and partial-reference minimum regression only

## Root cause and fix

The proven legacy Layout 1 fixture maps its second extent as `HEAD1` with
`clusterofs=28`, `pblk=2`, `m_la=639004`, `m_llen=409572`, and
`m_plen=4096`. The LZ4 stream completes after consuming 2627 bytes; the
remaining 1469 bytes of the pcluster are zero padding. The repo22 decoder
incorrectly required all 4096 input bytes to be consumed and returned `EIO`.

The decoder now accepts complete output only when the remaining pcluster bytes
are all zero, while continuing to reject nonzero trailing data. The mapping
recorder also no longer clears `compressedblks` and `partialref` on every
lcluster load, matching the Linux state machine and preserving lookback state.

## Results

| Test | Mount | Full SHA256 | Boundary read | Result |
|---|---:|---|---|---|
| Legacy full index `/shape.dat` | PASS | `370eb0a8df86868c4842ca535ed64670f0277ea2ed47a703f089bbb13ee4ac52` matches | offset 638972, 128 bytes: `941b6e3cb9a7384428d93ca248eb9630782538e04caba30dbfbe31baacca8f60` matches | **PASS** |
| Partial reference `/b.dat` | PASS | read returns `EIO` | offset 641020 read returns no data | **KERNEL-FAIL** |

`./build.sh`, `kldload`, and exact-name `kldunload` passed. The isolated dmesg
delta was empty, with no panic, trap, or integrity diagnostic.

## Remaining partial-reference hypothesis

The minimal reproducer is the existing
`lz4-partial-ref.erofs` fixture: mount it and read `/b.dat`; the companion
compact `/a.dat` remains the known-good source extent. The full-index mapping
blocker is removed, but `zdata.c` still invokes `z_erofs_decompress()` with
`partial=false` for every mapped extent even when `EROFS_MAP_PARTIAL_REF` is
set. Linux propagates this state to partial LZ4 decoding. Per the convergence
instruction, this batch records that hypothesis without further debugging or
additional source changes.
