Full-crate mutation hardening + cargo-fuzz harness - #44
Merged
Conversation
cargo mutants -p pksave over the whole crate (issue #33): 1555 mutants, 89 missed against the previous suite. Every killable survivor now has a dedicated test: - box/party layout arithmetic pinned against the raw byte image at slot indexes >= 2, so symmetric read/write paths cannot self-cancel (box edits, remove-shift, swap, withdraw-append, swap_party_box); - is_empty polarity through every view AND mut wrapper (boxes, HoF, item lists), ItemListMut::get, DaycareMut name getters; - boundary semantics: counts exactly at capacity are legal, level 100 still gets the exp-coherence check, set_bytes at the buffer end and the first tail byte, dex bit 151 filtered from counts; - exact diagnostic spans (box sentinel, unknown item id), item-list region extents as literals, changed_ranges tail merging; - the SaveGame trait impl driven through a trait object; - MonView::moves slot order, flag getters both polarities, map block coords and last_map. The 16 provably-equivalent survivors are recorded in .cargo/mutants.toml: eleven |->^ mutants on disjoint-bit packs are excluded per function with rationale; five +0-constant mutants in validate.rs stay visible on purpose (a function-scoped exclude would mask real span regressions). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01BSxh62iGqh4bffn8hRcTME
Add cargo-fuzz scaffolding for issue #34: a save_walk target that parses arbitrary bytes and drives pksave::fuzz_support::exercise — a walk of every public view, accessor and diagnostic, the untouched byte-identity round-trip, fix_checksums + reload, and the mutating paths that consume file-derived values (deposit/withdraw per box, recalculate_stats). Keeping the walk inside the crate as a #[doc(hidden)] module means it compiles against every API change even though the fuzz crate itself is nightly-only and excluded from the stable workspace. Seeds: the e2e fixture saves plus all-0x00/all-0xFF hostile bases. Run with: cargo +nightly fuzz run save_walk -- -max_len=33000 (inputs shorter than 32 KiB are rejected by from_bytes, so max_len must exceed SRAM_SIZE for the fuzzer to reach the interesting space). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01BSxh62iGqh4bffn8hRcTME
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Two commits, rebase-merge — the test halves of #33 and #34 (verification runs still in flight; issues get their evidence comments when those finish).
cargo mutants -p pksaveover the whole crate: 1555 mutants in 53 min, 89 missed against the previous suite. Every killable survivor now has a dedicated test (layout arithmetic pinned against raw bytes at slot indexes ≥ 2, is_empty polarity through every view/mut wrapper, capacity/level/tail boundaries, exact diagnostic spans,SaveGamevia trait object, and more — see the commit message). The 16 provably-equivalent survivors are recorded in.cargo/mutants.toml: the eleven|→^disjoint-bit packs are excluded per function with rationale; the five+0-constant mutants in validate.rs stay visible on purpose.crates/pksave/fuzz(nightly-only, its own workspace, excluded from the stable root workspace so CI is untouched) with asave_walktarget drivingpksave::fuzz_support::exercise: parse arbitrary bytes, walk every view/accessor/diagnostic, assert the untouched byte-identity round-trip, then exercise fix_checksums+reload and per-box deposit/withdraw. Seeded with the e2e fixtures and hostile all-0x00/0xFF bases.Verified:
cargo test --workspace(22 suites green incl. 497 new test lines), clippy native + wasm32-D warnings,cargo fmt --all --check; a targeted cargo-mutants re-run of the affected functions is running (0 missed so far) and a 40-min libFuzzer run is finishing with no crashes.🤖 Generated with Claude Code
https://claude.ai/code/session_01BSxh62iGqh4bffn8hRcTME
Generated by Claude Code