Skip to content

Full-crate mutation hardening + cargo-fuzz harness - #44

Merged
kasbuunk merged 2 commits into
mainfrom
claude/pokemon-open-issues-3x5qlx
Jul 17, 2026
Merged

Full-crate mutation hardening + cargo-fuzz harness#44
kasbuunk merged 2 commits into
mainfrom
claude/pokemon-open-issues-3x5qlx

Conversation

@kasbuunk

Copy link
Copy Markdown
Owner

Two commits, rebase-merge — the test halves of #33 and #34 (verification runs still in flight; issues get their evidence comments when those finish).

  1. test(pksave): kill the full-crate mutation-run survivorscargo mutants -p pksave over 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, SaveGame via 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.
  2. fuzz: coverage-guided libFuzzer targetcrates/pksave/fuzz (nightly-only, its own workspace, excluded from the stable root workspace so CI is untouched) with a save_walk target driving pksave::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

claude added 2 commits July 17, 2026 19:57
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants