mirror of
https://github.com/storytold/photocraft.git
synced 2026-12-02 06:20:48 +01:00
fix(xtask): derive scorecard corpus counts from pinned manifests
This commit is contained in:
1 parent
6d807ba34c
commit
52f438c864
3 files changed
+40
-5
No files matched your search
@@ -385,6 +385,8 @@ cargo xtask perf --update-baseline # also write perf/baseline.json from this r
|
||||
`cargo xtask perf --update-baseline`, with the machine (CPU, RAM, GPU adapter, OS), its machine
|
||||
class, commit, date and load average.
|
||||
- `crates/io/tests/corpus.rs`: the corpus floors (every `Source { .. }` constant).
|
||||
- `xtask/*-corpus.sha256`: file counts for pinned corpora, so stale counts in doc comments cannot
|
||||
change the reported denominators. No downloaded corpus is needed to generate the scorecard.
|
||||
- The prefs audit: `Preferences` fields that no code reads (target 0, #204), plus counts taken
|
||||
from the tree (never-crash attribute coverage, `docs/parity-checklist.md`).
|
||||
|
||||
|
||||
+3
-3
@@ -1,13 +1,13 @@
|
||||
# PhotoCraft scorecard
|
||||
|
||||
Generated by `cargo xtask scorecard` from `perf/budgets.toml`, `perf/baseline.json`, `crates/io/tests/corpus.rs`, `scorecard/*.toml` and the source tree. Do not edit by hand: change the sources and regenerate (CI runs `cargo xtask scorecard --check`). Checklist statuses are verified against the code; numbers here supersede estimates elsewhere.
|
||||
Generated by `cargo xtask scorecard` from `perf/budgets.toml`, `perf/baseline.json`, `crates/io/tests/corpus.rs`, `xtask/*-corpus.sha256`, `scorecard/*.toml` and the source tree. Do not edit by hand: change the sources and regenerate (CI runs `cargo xtask scorecard --check`). Checklist statuses are verified against the code; numbers here supersede estimates elsewhere.
|
||||
|
||||
## Summary
|
||||
|
||||
| Area | Done | Partial | Missing | Key numbers |
|
||||
|---|---:|---:|---:|---|
|
||||
| [Performance](#performance) | 3 | 22 | 26 | 60 scenarios: 3 within budget, 22 over budget or failing, 9 tracked only, 22 not run, 4 not measurable yet (baseline 2026-10-05) |
|
||||
| [File compatibility](#file-compatibility) | 9 | 13 | 5 | io corpus: oracle ≥ 148/170, round trip ≥ 169/170; psd-tools corpus: oracle ≥ 249/309, round trip ≥ 308/309; photoshop oracles: oracle ≥ 190/256, round trip ≥ 258/256 |
|
||||
| [File compatibility](#file-compatibility) | 9 | 13 | 5 | io corpus: oracle ≥ 148/170, round trip ≥ 169/170; psd-tools corpus: oracle ≥ 249/309, round trip ≥ 308/309; photoshop oracles: oracle ≥ 190/258, round trip ≥ 258/258 |
|
||||
| [Tools](#tools) | 36 | 8 | 0 | |
|
||||
| [Workspace and UI](#workspace-and-ui) | 14 | 6 | 3 | settings that do nothing: 21 of 176 (target 0) |
|
||||
| [Type](#type) | 5 | 4 | 0 | |
|
||||
@@ -98,7 +98,7 @@ Corpus floors (`crates/io/tests/corpus.rs`): the enforced minimums; the corpus t
|
||||
|---|---|---:|---:|---:|
|
||||
| io corpus | `corpus/psd` | 170 | 148 | 169 |
|
||||
| psd-tools corpus | `corpus/psd-tools` | 309 | 249 | 308 |
|
||||
| photoshop oracles | `corpus/photoshop` | 256 | 190 | 258 |
|
||||
| photoshop oracles | `corpus/photoshop` | 258 | 190 | 258 |
|
||||
|
||||
| Id | Target | Status | Issue | Note |
|
||||
|---|---|---|---|---|
|
||||
|
||||
+35
-2
@@ -5,6 +5,7 @@
|
||||
//! numbers against the budgets). A fresh `cargo xtask perf` result in `target/` is not used:
|
||||
//! publish it with `cargo xtask perf --update-baseline`.
|
||||
//! - `crates/io/tests/corpus.rs`: the corpus floors (`Source { .. }` constants).
|
||||
//! - `xtask/*-corpus.sha256`: file counts for the pinned corpora.
|
||||
//! - `scorecard/*.toml`: per-area checklists (id, target, status, issue, note).
|
||||
//! - the prefs audit: `Preferences` fields that no code outside `prefs.rs` / `prefs_ui.rs` reads.
|
||||
//! - counted from the tree: never-crash attribute coverage, `docs/parity-checklist.md`'s live count.
|
||||
@@ -474,7 +475,15 @@ pub fn gather(root: &Path) -> Result<Inputs, String> {
|
||||
Ok(t) => Some(serde_json::from_str(&t).map_err(|e| format!("{}: {e}", perf::BASELINE))?),
|
||||
Err(_) => None,
|
||||
};
|
||||
let corpora = parse_corpus(&std::fs::read_to_string(root.join(CORPUS_RS)).map_err(|e| format!("read {CORPUS_RS}: {e}"))?);
|
||||
let mut corpora = parse_corpus(&std::fs::read_to_string(root.join(CORPUS_RS)).map_err(|e| format!("read {CORPUS_RS}: {e}"))?);
|
||||
for corpus in &mut corpora {
|
||||
let Some(pinned) = crate::corpus_pins::ALL.iter().find(|p| corpus.dir == format!("corpus/{}", p.dest)) else { continue };
|
||||
let manifest = std::fs::read_to_string(root.join(pinned.manifest)).map_err(|e| format!("read {}: {e}", pinned.manifest))?;
|
||||
corpus.files = Some(
|
||||
u32::try_from(manifest.lines().filter(|line| !line.trim().is_empty()).count())
|
||||
.map_err(|_| format!("{}: corpus file count exceeds u32", pinned.manifest))?,
|
||||
);
|
||||
}
|
||||
Ok(Inputs {
|
||||
budgets,
|
||||
baseline,
|
||||
@@ -522,7 +531,7 @@ pub fn render(inp: &Inputs) -> String {
|
||||
|
||||
let mut s = String::from(
|
||||
"# PhotoCraft scorecard\n\nGenerated by `cargo xtask scorecard` from `perf/budgets.toml`, `perf/baseline.json`, \
|
||||
`crates/io/tests/corpus.rs`, `scorecard/*.toml` and the source tree. Do not edit by hand: change the sources and \
|
||||
`crates/io/tests/corpus.rs`, `xtask/*-corpus.sha256`, `scorecard/*.toml` and the source tree. Do not edit by hand: change the sources and \
|
||||
regenerate (CI runs `cargo xtask scorecard --check`). Checklist statuses are verified against the code; numbers \
|
||||
here supersede estimates elsewhere.\n\n## Summary\n\n| Area | Done | Partial | Missing | Key numbers |\n|---|---:|---:|---:|---|\n",
|
||||
);
|
||||
@@ -791,6 +800,30 @@ const PHOTOSHOP: Source = Source { label: "photoshop oracles", dir: "corpus/phot
|
||||
assert!(parse_corpus("const X: u32 = 1;").is_empty());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn scorecard_uses_pinned_corpus_file_counts() {
|
||||
let root = crate::root();
|
||||
let inp = gather(&root).unwrap();
|
||||
let rendered = render(&inp);
|
||||
for corpus in &inp.corpora {
|
||||
let pinned = crate::corpus_pins::ALL.iter().find(|p| corpus.dir == format!("corpus/{}", p.dest)).unwrap();
|
||||
let manifest = std::fs::read_to_string(root.join(pinned.manifest)).unwrap();
|
||||
let files = manifest.lines().filter(|line| !line.trim().is_empty()).count();
|
||||
assert!(
|
||||
rendered.contains(&format!(
|
||||
"{}: oracle ≥ {}/{files}, round trip ≥ {}/{files}",
|
||||
corpus.label,
|
||||
corpus.pass_floor.unwrap(),
|
||||
corpus.roundtrip_floor.unwrap()
|
||||
)),
|
||||
"{} must use the {files} files in {} instead of a count from a doc comment",
|
||||
corpus.label,
|
||||
pinned.manifest
|
||||
);
|
||||
assert!(rendered.contains(&format!("| {} | `{}` | {files} |", corpus.label, corpus.dir)));
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn checklists_validate() {
|
||||
let ok = "area = \"tools\"\ntitle = \"Tools\"\norder = 3\n[[item]]\nid = \"T-1\"\ntarget = \"Pencil\"\nstatus = \"partial\"\nissue = 213\n";
|
||||
|
||||
Reference in new issue
Block a user