Diagnose and fix binary capture UTF-8 decode failure
User's successful-exit capture fails summary/loading with bincode Utf8 valid_up_to=8. Reproduce using latest /tmp/captures/trace_new2.wrtrace, locate failing committed chunk, distinguish encoding/decoding schema mismatch from storage/compression corruption, fix based on evidence and add a red-green regression. Preserve original captures. Validate current binary capture/readback/snapshots, workspace checks/tests and real Vulkan behavior as relevant. Do not discard corruption or pretend missing data is valid. No commits. User explicitly prohibits any game launches; continue only with saved captures and synthetic tests. Do not launch PRK or any other game, including offline modes. Verified file evidence: /tmp/captures/trace_new2.wrtrace reproduces in serial and parallel readers. Of 3054 committed records, only record 1607 fails: offset 77188564, codec LZ4, 185367 stored / 3393981 decoded bytes. Chunk checksum passes. System liblz4 and Rust LZ4 produce identical decoded bytes. Failure is in scope 48 (reflection opaque pass), draw index 625 of 794, inline GraphicsState.front_face at raw offset 712838; an unexpected Some(String) of length 25 contains invalid UTF-8. All successfully decoded recorded draws have empty inline state, consistent with state interning. An in-memory probe replacing just that redundant field with None decodes the entire event, consumes all bytes and round-trips exactly; this is NOT a verified repair and original capture remains unchanged. 300 synthetic clone/native encode/decode/LZ4 round trips of that probe passed without reproducing corruption. Temporary probes/evidence are under target/decode-investigation; remove temporary hardcoded diagnostic source before finishing. An offline game reproduction was attempted before the user's prohibition; first two aborted on missing data assets, and a third completed a 20-second offline capture without reproducing. That process exited via SIGTERM; no game is running from this work. Do not repeat. Root cause remains unproven; no workaround/discarding malformed data may be presented as a fix. User ran multiple long real-executable tests with WAYRENDER_STORAGE_DIAGNOSTICS=/tmp/wayrender-storage-check and could not reproduce. This is not evidence of a causal fix: verification changes timing, allocations and I/O and may mask an intermittent trigger. Do not ask for more repetitive long game runs. The original saved capture remains a deterministic read-failure repro, but the writer-side cause is unresolved. Continue only file-based/static/synthetic investigation; normal profiling should disable the expensive diagnostic flag. User supplied their exact original command (PRK_VULKAN_DEBUG_UTILS=1, PRK_DATAROOT=/mnt/games/PRK-NEW/client, release Wayrender, --frames 10000, dotnet run and existing environment-based auto-login arguments). Assistant will NOT run it; user will execute the same command with only diagnostic env and a fresh output filename. Implemented diagnostic-only verification: source-state summary before native encoding; native decode/validation immediately after encoding; encoded buffer stability and exact LZ4 round-trip comparison; flush/positioned reread and comparison immediately after file writing. Failures stop the writer and save private binary artifacts/report with stage, retry encoding result and source inline-state anomalies. No repair/skipping corrupt records and no archive format change. Added file-offset/codec/size error context. Removed temporary hardcoded probe source; original capture remains untouched. 81 workspace tests, diagnostics-enabled trace tests, strict workspace Clippy, formatting/diff checks and debug/release CLI/layer builds pass. Synthetic tests cover before-compression corruption and checksum-recomputed post-encoding corruption. Release binaries are ready for the user's test. Diagnostic mode adds substantial CPU/memory/I/O and should not be used for overhead measurements. Static parallel review found no verified ownership/codec cause; external captures and codec implementation sources were outside its coverage, so no clean review/approval is claimed.
Checklist
0 of 2 complete- Identify the exact failing chunk and root cause from the original capture; reproduce with a regression before fixing.
- Verify the fix against affected captures, workspace validation and real Vulkan capture/reading; preserve data and disclose recovery limitations.
- Area
- Personal tooling
- Project
- Wayrender
- Kind
- Bug
- Task ID
tsk_npmzxnd3w9- Updated