# Native compatibility reports

FriiDump 0.5.3.16-pf1 creates one native evidence report by default for each
normal dump invocation accepted by the FriiDump Compatibility Database v1.2.0.

## Default behavior

No report option is required:

```text
friidump -d <drive> -8 -s -i game.iso
```

FriiDump writes the report beside the final FriiDump log and derives its
name from that log filename:

```text
game.iso.log
game.iso.friidump.json
```

The report is written atomically. A derived report name never overwrites prior
evidence; a collision receives the run UUID as a suffix.

For partial or cancelled dumps, FriiDump's console summary distinguishes the
expected disc size from completed output and computes observed throughput only
from the completed bytes represented by the report. Resumed runs do not claim
throughput because their output size includes data from an earlier invocation.

## Path overrides

Override the complete report pathname:

```text
friidump -d <drive> -8 -s -i game.iso \
  --report-json custom-evidence.json
```

Override only the destination directory while retaining the derived filename:

```text
friidump -d <drive> -8 -s -i game.iso \
  --report-dir reports
```

The options may be combined. In that form, `--report-json` supplies the
filename and `--report-dir` replaces its directory:

```text
friidump -d <drive> -8 -s -i game.iso \
  --report-json ignored/path/custom-evidence.json \
  --report-dir reports
```

The final path is `reports/custom-evidence.json`.

## Modified firmware

Firmware is assumed to be stock when `--firmware-modified` is omitted.
Modified or cross-flashed firmware must be declared explicitly with a non-empty
explanation:

```text
friidump -d <drive> -8 -s -i game.iso \
  --firmware-modified "patched to allow 0xe7 mem dumps"
```

The flag does not require either report-path option because reporting is enabled
by default. FriiDump does not infer modified firmware from a selected profile.

## Recorded evidence

Each report uses `friidump-test-result.v1` and records:

- one UUID for the invocation;
- authoritative UTC start, completion, and generation times;
- FriiDump version and optional full build commit;
- exact live INQUIRY vendor, product, and firmware revision;
- platform, title, region, and disc ID when known;
- for unforced Nintendo runs, GameCube/Wii platform identity from the
  unscrambled sector-0 platform magic rather than capacity probing alone;
- seed-stage and dump-stage outcomes;
- actual output sectors, bytes, and elapsed dump time;
- failure stage and sector for partial or failed runs;
- CRC32, MD5, SHA-1, and SHA-256 when hashing was enabled;
- Redump verification independently of compatibility status;
- selected HLDS support tier, CDB offset, and firmware gate evidence;
- an explicit measurement-scope note.

FriiDump reports observed facts. It does not publish or change a compatibility
assessment. An administrator must accept and link the report in the database.

## Measurement scopes

FriiDump emits one of these controlled notes for attempted dumps:

```text
Measurement scope: full_optical_payload.
Measurement scope: assembled_output.
Measurement scope: partial_progress.
Measurement scope: unknown.
```

`full_optical_payload` is used for successful GameCube, Wii, and ordinary DVD
optical reads. Xbox ISO/XISO output uses `assembled_output` because logical or
synthetic output regions make its rate non-comparable to an optical-only read.
A failed run with actual completed bytes uses `partial_progress`.

A resumed output uses `unknown`: the file size includes bytes from an earlier
invocation, so FriiDump suppresses throughput inference from the current run's
elapsed time.

## Cancellation

When native reporting is enabled, Ctrl+C requests a controlled cancellation.
The active dumper stops at the next cancellation boundary, closes the partial
output, and writes an honest report:

```text
run.test_type = partial_dump
run.result = partial
dump.result = partial
dump.failure_stage = user_cancelled
Measurement scope: partial_progress.
```

When no output bytes were completed, cancellation is recorded as a failed
`other` run rather than fabricated partial progress. Some low-level drive
commands are synchronous; cancellation is observed after the active command
returns.

## Report restrictions

Native reporting currently requires one normal device dump invocation and
exactly one primary dump output. Combined raw and ISO output is rejected so the
reported output path, bytes, hashes, and `dump_output` artifact remain
unambiguous. It cannot be combined with:

- raw-file conversion;
- `--allmethods`;
- stop-only operation;
- HLDS research scans or sweeps;
- XGD1 layout or raw-ID research probes.

Broad INQUIRY, VPD, GET CONFIGURATION, and MODE SENSE discovery belongs in the
separate optical-drive research utility, not FriiDump.

## Build identity

CMake builds may embed the exact source commit:

```bash
cmake -S . -B build \
  -DFRIIDUMP_BUILD_COMMIT=<full-40-character-commit>
```

The Windows helper uses `FRIIDUMP_BUILD_COMMIT` when supplied, or derives the
current Git `HEAD` when the source tree contains `.git`:

```powershell
$env:FRIIDUMP_BUILD_COMMIT = "<full-40-character-commit>"
.\build_msvc32.cmd
```

When no trustworthy commit is supplied, the JSON field is `null` rather than a
guess.

## Tests

Linux/CMake fixture build:

```bash
cmake -S . -B build-native-report-tests \
  -DBUILD_NATIVE_REPORT_TESTS=ON \
  -DBUILD_STATIC_BINARY=ON
cmake --build build-native-report-tests
mkdir -p build-native-report-tests/report-fixtures
./build-native-report-tests/src/friidump-report-fixtures \
  build-native-report-tests/report-fixtures
python3 tests/validate_native_reports.py \
  --fixtures build-native-report-tests/report-fixtures
```

Validate one or more live reports without requiring the built-in fixture names:

```text
python3 tests/validate_native_reports.py \
  --fixtures <report-directory> \
  --allow-arbitrary
```

Windows/MSVC fixture build:

```powershell
.\build_msvc32_native_report_tests.cmd
```

Strict validation requires Python's `jsonschema` package. Database semantic
validation can also be run by passing the v1.2.0 `bin/validate-report.php` path
to `tests/validate_native_reports.py`.

The complete field and acceptance requirements are in
`docs/FRIIDUMP_NATIVE_REPORT_REQUIREMENTS.md`.
