`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
92 lines
3.8 KiB
Rust
92 lines
3.8 KiB
Rust
//! Why do two "every pak, every timed record" scans disagree by 86 %?
|
|
//!
|
|
//! This port counts 1 781 timed nested records and reports `+0x08 == max t` at
|
|
//! 92.3 %. The Decoder counts 3 311 and reports 49.6 %. Both scans are described
|
|
//! the same way, so at least one of them is narrower than its own description --
|
|
//! and the exactness figure this port has quoted repeatedly is a property of
|
|
//! whichever subset it actually walks.
|
|
//!
|
|
//! Counts the survivors at each filter, so the gap is located rather than
|
|
//! guessed at.
|
|
use sylpheed_formats::{pak, ratc, ui_layout};
|
|
|
|
fn main() {
|
|
let root = std::env::var("SYLPHEED_DISC").unwrap_or_else(|_| "/disc".into());
|
|
let mut paks: Vec<_> = std::fs::read_dir(format!("{root}/dat"))
|
|
.expect("dat/")
|
|
.flatten()
|
|
.map(|e| e.path())
|
|
.filter(|p| p.extension().and_then(|s| s.to_str()) == Some("pak"))
|
|
.collect();
|
|
paks.sort();
|
|
let (mut records, mut in_bounds, mut magic, mut parsed, mut timed) = (0, 0, 0, 0, 0);
|
|
let (mut untimed, mut all_at_zero) = (0usize, 0usize);
|
|
for p in &paks {
|
|
let Ok(ar) = pak::PakArchive::open(p) else {
|
|
continue;
|
|
};
|
|
for e in ar.entries() {
|
|
let Ok(by) = ar.read(e) else { continue };
|
|
if !ratc::is_ratc(&by) {
|
|
continue;
|
|
}
|
|
let Some(b) = ui_layout::parse_build(&by) else {
|
|
continue;
|
|
};
|
|
for (_, &(o, s)) in &b.records {
|
|
records += 1;
|
|
if o + 12 > by.len() || o + s > by.len() {
|
|
continue;
|
|
}
|
|
in_bounds += 1;
|
|
if &by[o..o + 4] != b"RATC" {
|
|
continue;
|
|
}
|
|
magic += 1;
|
|
let Some(lb) = ui_layout::parse_build(&by[o..o + s]) else {
|
|
continue;
|
|
};
|
|
parsed += 1;
|
|
let maxt = lb
|
|
.elements
|
|
.iter()
|
|
.flat_map(|el| el.keyframes.iter().filter_map(|k| k.time))
|
|
.max()
|
|
.unwrap_or(0);
|
|
// 🔴 `maxt == 0` merges two different populations, and the
|
|
// Decoder's cause -- `.max()` returning `Some(0)` -- is only one
|
|
// of them. A record with NO timed keyframe has no largest
|
|
// keyframe time; a record whose keyframes all sit at t=0 has
|
|
// one, and it is 0. Only the first is a question without
|
|
// content. Both of us called all 1 530 "the question has no
|
|
// meaning"; that is true of one group and an assumption about
|
|
// the other.
|
|
let any_timed = lb
|
|
.elements
|
|
.iter()
|
|
.any(|el| el.keyframes.iter().any(|k| k.time.is_some()));
|
|
if maxt == 0 {
|
|
if any_timed {
|
|
all_at_zero += 1
|
|
} else {
|
|
untimed += 1
|
|
}
|
|
continue;
|
|
}
|
|
timed += 1;
|
|
}
|
|
}
|
|
}
|
|
println!(" records declared by parse_build : {records}");
|
|
println!(" within the entry's bounds : {in_bounds}");
|
|
println!(
|
|
" carrying the RATC magic : {magic} <- {} dropped here",
|
|
in_bounds - magic
|
|
);
|
|
println!(" parsing as a nested build : {parsed}");
|
|
println!(" with a largest keyframe time > 0: {timed}");
|
|
println!(" of the {} excluded:", untimed + all_at_zero);
|
|
println!(" NO timed keyframe at all : {untimed} <- the question has no content");
|
|
println!(" timed, but every pose at t=0 : {all_at_zero} <- a largest time EXISTS, and it is 0");
|
|
}
|