# FriiDump 0.5.3.7 — PFES-Aligned Redump Evidence Reporting

## Scope

This update refines the automatic Redump verifier introduced in 0.5.3.6. It
changes evidence presentation and report durability only. It does not add or
modify any optical-drive write, firmware-update, flash, erase, `3B06`, `3B07`,
or `FLASHUP` path.

## Live baseline confirmed before refinement

The 0.5.3.6 run on `HL-DT-ST/CDRW/DVD GCC4244/B101` completed Sonic Mega
Collection successfully:

- media preflight: OK
- seed retrieval: 3 seconds
- output sectors: 712,880
- dump status: OK
- STOP UNIT: OK
- duration: 2,324.52 seconds
- observed average: 2,156.33 MiB/h
- Redump entries scanned: 2,019
- exact matches: 1

Observed hashes:

```text
CRC32    01b52739
MD5      85a525df1481d0ad67d8761f832dca12
SHA-1    06eb6d15b4d7f90ec0fed9ce9a77db41358d74ed
SHA-256  30098da93f5de9ece8da44f8afdfb85cf9bcdc24d77131221e64e3038a529010
```

The B101 drive remains a live-validated legacy Type3 fallback while exact
parser metadata is pending analyzer results. This update does not promote B101
by analogy with B103.

## Scope boundary for Xbox reference dumping

The bundled Xbox DAT remains mapped for Xbox ISO paths that return through
FriiDump's normal dumper/hash state. The copied GDR-8050L reference-dumper
bridge uses its own full-file hashing and sidecar writer and remains excluded
from this verifier call. No claim is made here that schema-2 DAT evidence is
produced for that separate bridge path.

## Corrected log behavior

The schema-1 JSON report itself was valid on disk, but its structural writes
used FriiDump's logged `fprintf` wrapper. String values were emitted by a
different direct-file helper, so the human-readable run log received an
incomplete mirror such as:

```text
"status": ,
"output": ,
```

0.5.3.7 writes JSON exclusively through unlogged file-output functions. The
human log now contains only the report completion line, while the complete JSON
remains in its own evidence artifact.

## Evidence-oriented console result

Exact match:

```text
Redump verification
------------------------------------------------------------
DAT                  redump_dat/Nintendo - GameCube.dat
Entries scanned      2019
Matched entry        Sonic Mega Collection (USA)
ROM                  Sonic Mega Collection (USA).iso
Image size           PASS
CRC32                PASS
MD5                  PASS
SHA-1                PASS
Overall              VERIFIED AGAINST REDUMP
Confidence           Exact archive match
```

A non-exact result displays a closest candidate only when at least one hash
correlates. Otherwise, FriiDump reports aggregate size/hash match counts and
states that no archive identity was established.

## JSON schema 2

Schema 2 preserves the original top-level fields and adds:

- `overall`
- `confidence`
- `sha256`
- `match_kind`
- `field_match_counts`
- `expected`
- `evidence`

The `evidence` object records `PASS`, `FAIL`, or `N/A` for size, CRC32, MD5, and
SHA-1.

## Atomic report publication

The report lifecycle is:

1. Write a sibling `<report>.tmp` file.
2. Flush the C stream.
3. Synchronize the file descriptor.
4. Close the temporary file.
5. Atomically replace the final report path.

If writing or synchronization fails, the temporary file is removed and the
previous complete final report remains unchanged. If the final replacement
fails, the complete temporary report is retained and its path is printed.

## Local validation

- Linux CMake build: PASS
- Help/version output: PASS (`FriiDump 0.5.3.7`)
- Exact Sonic DAT match: PASS
- Partial-correlation candidate test: PASS
- No-hash-correlation test: PASS
- Schema-2 JSON parse: PASS
- SHA-256 retention: PASS
- Atomic replacement of an existing report: PASS
- Temporary file absent after successful replacement: PASS
- Report contents absent from the run-log stream: PASS

The existing Reed-Solomon warning in `libfriidump/rs.c` remains unchanged and is
outside this update's scope.
