`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
3.0 KiB
Rust
72 lines
3.0 KiB
Rust
//! Which mission should the next unit harvest fly?
|
|
//!
|
|
//! Unit definitions are instantiated per stage, so coverage grows by visiting
|
|
//! missions — but only if the mission fields units we have not read yet. This
|
|
//! ranks every stage by how many of its roster units are missing from the
|
|
//! harvested CSV.
|
|
//!
|
|
//! Usage: roster_target <disc-root> <unit-runtime-fields.csv>
|
|
use std::collections::{BTreeMap, BTreeSet};
|
|
use sylpheed_formats::hash::name_hash;
|
|
use sylpheed_formats::idxd::IdxdObject;
|
|
use sylpheed_formats::pak::PakArchive;
|
|
|
|
fn main() {
|
|
let a: Vec<String> = std::env::args().collect();
|
|
let pak = PakArchive::open(format!("{}/dat/GP_MAIN_GAME_E.pak", a[1])).expect("pak");
|
|
let have: BTreeSet<String> = std::fs::read_to_string(&a[2])
|
|
.expect("csv")
|
|
.lines()
|
|
.skip(1)
|
|
.filter_map(|l| l.split(',').next().map(str::to_string))
|
|
.collect();
|
|
// Label each roster by STAGE: the TOC stores a hash of the original path, and
|
|
// the table names are known (`EnumUnit_SNN.tbl`), so hashing the candidates
|
|
// maps entries back to stages. Most rosters carry no `UN_S<NN>_` prop id, which
|
|
// is all `UnitRoster::stage` can infer from.
|
|
let mut by_hash: BTreeMap<u32, String> = BTreeMap::new();
|
|
// The TOC hashes a PATH, and these tables live under a directory — try the
|
|
// known schemes (see hash::TOC_NAME_SCHEMES) rather than the bare name.
|
|
for i in 1..=29 {
|
|
let stage = format!("S{i:02}");
|
|
for pre in ["", "unit\\", "battle\\", "stage\\", "enemy\\"] {
|
|
for suf in [".tbl", ""] {
|
|
by_hash.insert(
|
|
name_hash(&format!("{pre}EnumUnit_{stage}{suf}")),
|
|
stage.clone(),
|
|
);
|
|
}
|
|
}
|
|
}
|
|
let mut rows: Vec<(usize, String, Vec<String>)> = Vec::new();
|
|
for e in pak.entries() {
|
|
let Some(stage) = by_hash.get(&e.name_hash).cloned() else {
|
|
continue;
|
|
};
|
|
let Ok(b) = pak.read(e) else { continue };
|
|
let Ok(o) = IdxdObject::parse(&b) else {
|
|
continue;
|
|
};
|
|
let mut units: Vec<String> = Vec::new();
|
|
for id in o.tokens().iter().filter(|s| s.starts_with("UN_")) {
|
|
let prop = id.contains("Asteroid") || id.contains("cmesh") || id.contains("_Box");
|
|
if !prop && !units.iter().any(|u| u == id) {
|
|
units.push(id.clone());
|
|
}
|
|
}
|
|
let missing: Vec<String> = units
|
|
.iter()
|
|
.filter(|u| !have.contains(*u))
|
|
.cloned()
|
|
.collect();
|
|
rows.push((missing.len(), stage, missing));
|
|
}
|
|
rows.sort_by_key(|(n, _, _)| std::cmp::Reverse(*n));
|
|
println!("units already harvested: {}\n", have.len());
|
|
println!("stage missing roster units not yet read");
|
|
for (n, stage, missing) in rows.iter().take(12) {
|
|
let s: Vec<&str> = missing.iter().take(6).map(|s| s.as_str()).collect();
|
|
println!("{stage:<8} {n:>5} {}", s.join(", "));
|
|
}
|
|
}
|