`cargo fmt --all -- --check` has failed on every run in this repository's history, identically on `main` and on every branch. This is #12. Mechanical: `cargo fmt --all`, nothing else. 154 files, all `.rs`, no other extension touched. `cargo check --workspace` exits 0 afterwards, so nothing changed semantically. ON THE ORDERING, WHICH WAS THE REAL QUESTION. HANDOFF-2026-09-06 section 7 warns this is the expensive fix: a whole-tree reformat before #7 and #8 return "would put a conflict in every file of 861 commits and make the reviews those items exist to enable unreadable". That is measurably too pessimistic, and it had been reasoned rather than tested. Measured here by three-way merging a rustfmt'd `main` against both unmerged branches, file by file: file/branch pairs tested 32 merges CLEAN 28 merges CONFLICTING 4 (8 conflict hunks total) sylpheed-cli/src/main.rs 1 hunk sylpheed-export/src/check.rs 1 sylpheed-export/src/screen.rs 4 sylpheed-export/src/video.rs 2 All four are against `auto/frame-blend-draw-path` only; `auto/port-p6-audio` does not conflict anywhere. The earlier framing -- 154 dirty files, 133 that cannot collide, 21 that can, the collision set carrying 147 of 774 hunks (19%) -- reproduces exactly. What it did not say is that most of the 21 still merge cleanly, because rustfmt's edits and the branches' edits rarely land on the same lines. So the cost of sweeping now is 4 files and 8 hunks for one branch, against a check that is otherwise red forever. Deliberately NOT folded into the WASM PR: 154 reformatted files would make that one unreviewable. Closes #12
72 lines
2.8 KiB
Rust
72 lines
2.8 KiB
Rust
//! Does the legacy reader miss a field precisely when its value is shared?
|
|
//!
|
|
//! The corpus records four "sibling default" rules (`Size_Y` inherits `Size_X`,
|
|
//! `FCSRange` inherits `RadarRange`, …) used to recover values for units never
|
|
//! visited at runtime. If the rules are really a *deduplication artefact*, then
|
|
//! the legacy reader should report the field absent exactly when the two values
|
|
//! are equal on disc — and never otherwise.
|
|
use sylpheed_formats::{IdxdObject, PakArchive};
|
|
|
|
fn main() {
|
|
let disc = std::env::var("SYLPHEED_DISC").expect("set SYLPHEED_DISC");
|
|
let arc = PakArchive::open(format!("{disc}/dat/GP_MAIN_GAME_E.pak")).expect("pak");
|
|
let pairs = [
|
|
("Size_Y", "Size_X"),
|
|
("FCSRange", "RadarRange"),
|
|
("DefencePoint", "AttackVesselPoint"),
|
|
];
|
|
// legacy-absent x equal-on-disc, as a 2x2 table per pair.
|
|
let mut tally = [[[0usize; 2]; 2]; 3];
|
|
for e in arc.entries() {
|
|
let Ok(bytes) = arc.read(e) else { continue };
|
|
if !IdxdObject::is_idxd(&bytes) {
|
|
continue;
|
|
}
|
|
let Ok(obj) = IdxdObject::parse(&bytes) else {
|
|
continue;
|
|
};
|
|
let Some(generic) = obj.record("Generic") else {
|
|
continue;
|
|
};
|
|
if generic.get("Size_X").is_none() {
|
|
continue;
|
|
}
|
|
for (i, (field, sibling)) in pairs.iter().enumerate() {
|
|
let (Some(a), Some(b)) = (generic.get(field), generic.get(sibling)) else {
|
|
continue;
|
|
};
|
|
let legacy_absent = obj.get_f32(field).is_none();
|
|
tally[i][usize::from(legacy_absent)][usize::from(a == b)] += 1;
|
|
// The only cases where the rule PREDICTS WRONG: the reader misses
|
|
// the field and the two values differ, so "inherit the sibling"
|
|
// substitutes a number the disc contradicts.
|
|
if legacy_absent && a != b {
|
|
println!(
|
|
" rule-wrong: {:08x} {field} = {a} but {sibling} = {b} (ID {:?})",
|
|
e.name_hash,
|
|
obj.get_raw("ID")
|
|
);
|
|
}
|
|
}
|
|
}
|
|
println!(
|
|
"{:<14} {:>10} {:>10} {:>10} {:>10}",
|
|
"pair", "seen+diff", "seen+eq", "MISS+diff", "MISS+eq"
|
|
);
|
|
for (i, (field, sibling)) in pairs.iter().enumerate() {
|
|
println!(
|
|
"{:<14} {:>10} {:>10} {:>10} {:>10}",
|
|
format!("{field}/{sibling}")
|
|
.chars()
|
|
.take(14)
|
|
.collect::<String>(),
|
|
tally[i][0][0],
|
|
tally[i][0][1],
|
|
tally[i][1][0],
|
|
tally[i][1][1]
|
|
);
|
|
}
|
|
println!("\n'MISS+diff' > 0 refutes 'the reader only misses shared values'.");
|
|
println!("'seen+eq' > 0 refutes 'a shared value is always invisible'.");
|
|
}
|