From 1fba8d090f1a2fc6cafc30b4a4296580656c9e2f Mon Sep 17 00:00:00 2001 From: Mex <44814932+MMexicann@users.noreply.github.com> Date: Thu, 19 Nov 2026 23:06:47 +0100 Subject: [PATCH 1/4] fix(xtask): run corpus tests for changes to the current ATN module Point the changed-path trigger at the current engine command module and share the predicate with regression tests. --- xtask/src/corpus.rs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/xtask/src/corpus.rs b/xtask/src/corpus.rs index 0be1f83625..871a9e1c2c 100644 --- a/xtask/src/corpus.rs +++ b/xtask/src/corpus.rs @@ -24,7 +24,12 @@ const HEIF_CRATES: &[&str] = &["photocraft-io"]; /// Paths whose changes make `test-corpus --changed` run (the file-format and rendering crates, /// and the engine's `.atn` import and export). -const CRITICAL: &[&str] = &["crates/io/", "crates/compose/", "crates/gpu/", "crates/text/", "crates/format/", "crates/raw/", "crates/engine/src/atn_cmds"]; +const CRITICAL: &[&str] = &["crates/io/", "crates/compose/", "crates/gpu/", "crates/text/", "crates/format/", "crates/raw/", "crates/engine/src/cmd/atn_cmds"]; + +fn is_critical(path: &str) -> bool { + CRITICAL.iter().any(|prefix| path.starts_with(prefix)) +} + /// `cargo xtask corpus [--all | --pngsuite | --download | --psd | --psd-tools | --heif | --exr | --pixls | --affinity | --atn | --photoshop [--local] | --gimp [--local]] [--update-manifest]` pub fn cmd(args: &[&str]) -> Result<(), String> { let update = args.contains(&"--update-manifest"); @@ -417,7 +422,7 @@ pub fn test_cmd(args: &[&str]) -> Result<(), String> { let mut raw_changed = false; if ours.contains(&"--changed") { let changed = changed_files()?; - let hits: Vec<&String> = changed.iter().filter(|f| CRITICAL.iter().any(|c| f.starts_with(c))).collect(); + let hits: Vec<&String> = changed.iter().filter(|f| is_critical(f)).collect(); if hits.is_empty() { println!("test-corpus --changed: nothing under {} changed since origin/main; skipping", CRITICAL.join(", ")); return Ok(()); From 3c1043a87b1a56e5571e596431ca80247a194a93 Mon Sep 17 00:00:00 2001 From: Mex <44814932+MMexicann@users.noreply.github.com> Date: Thu, 19 Nov 2026 23:07:29 +0100 Subject: [PATCH 2/4] test(xtask): cover ATN corpus trigger paths Exercise the ATN root and nested modules, all existing corpus prefixes, and unrelated engine paths. --- xtask/src/corpus/tests.rs | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/xtask/src/corpus/tests.rs b/xtask/src/corpus/tests.rs index b1c7b515a9..0b187445e2 100644 --- a/xtask/src/corpus/tests.rs +++ b/xtask/src/corpus/tests.rs @@ -1,5 +1,38 @@ use super::*; +#[test] +fn changed_atn_root_triggers_corpus_tests() { + assert!(is_critical("crates/engine/src/cmd/atn_cmds.rs")); +} + +#[test] +fn changed_atn_modules_trigger_corpus_tests() { + for path in ["crates/engine/src/cmd/atn_cmds/steps_render.rs", "crates/engine/src/cmd/atn_cmds/tests.rs"] { + assert!(is_critical(path), "{path}"); + } +} + +#[test] +fn existing_critical_sources_still_trigger_corpus_tests() { + for path in [ + "crates/io/src/ora.rs", + "crates/compose/src/lib.rs", + "crates/gpu/src/lib.rs", + "crates/text/src/lib.rs", + "crates/format/src/lib.rs", + "crates/raw/src/lib.rs", + ] { + assert!(is_critical(path), "{path}"); + } +} + +#[test] +fn unrelated_sources_do_not_trigger_corpus_tests() { + for path in ["crates/engine/src/jobs.rs", "crates/engine/src/cmd/layer_cmds.rs", "docs/actions.md", "apps/photocraft-web/src/main.rs"] { + assert!(!is_critical(path), "{path}"); + } +} + /// The flags each pinned corpus is fetched with by `fetch_all(local, update)`. fn calls(local: bool, update: bool) -> Vec<(&'static str, bool)> { let mut seen = Vec::new(); From 2a3fae44ef62bd7c7b833a1acf0d3ea940781b39 Mon Sep 17 00:00:00 2001 From: Mex <44814932+MMexicann@users.noreply.github.com> Date: Fri, 20 Nov 2026 15:45:42 +0100 Subject: [PATCH 3/4] fix(xtask): limit ATN corpus trigger to real module paths Updated the CRITICAL paths to include a trailing slash for consistency and modified the is_critical function to check for a specific path. --- xtask/src/corpus.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/xtask/src/corpus.rs b/xtask/src/corpus.rs index 871a9e1c2c..3d217c9f78 100644 --- a/xtask/src/corpus.rs +++ b/xtask/src/corpus.rs @@ -24,10 +24,10 @@ const HEIF_CRATES: &[&str] = &["photocraft-io"]; /// Paths whose changes make `test-corpus --changed` run (the file-format and rendering crates, /// and the engine's `.atn` import and export). -const CRITICAL: &[&str] = &["crates/io/", "crates/compose/", "crates/gpu/", "crates/text/", "crates/format/", "crates/raw/", "crates/engine/src/cmd/atn_cmds"]; +const CRITICAL: &[&str] = &["crates/io/", "crates/compose/", "crates/gpu/", "crates/text/", "crates/format/", "crates/raw/", "crates/engine/src/cmd/atn_cmds/"]; fn is_critical(path: &str) -> bool { - CRITICAL.iter().any(|prefix| path.starts_with(prefix)) + path == "crates/engine/src/cmd/atn_cmds.rs" || CRITICAL.iter().any(|prefix| path.starts_with(prefix)) } /// `cargo xtask corpus [--all | --pngsuite | --download | --psd | --psd-tools | --heif | --exr | --pixls | --affinity | --atn | --photoshop [--local] | --gimp [--local]] [--update-manifest]` From 9de261912872a901ab0005ecd185156accc0ac8f Mon Sep 17 00:00:00 2001 From: Mex <44814932+MMexicann@users.noreply.github.com> Date: Fri, 20 Nov 2026 15:46:09 +0100 Subject: [PATCH 4/4] test(xtask): exclude similarly named ATN sibling paths --- xtask/src/corpus/tests.rs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/xtask/src/corpus/tests.rs b/xtask/src/corpus/tests.rs index 0b187445e2..921bdc24e9 100644 --- a/xtask/src/corpus/tests.rs +++ b/xtask/src/corpus/tests.rs @@ -12,6 +12,18 @@ fn changed_atn_modules_trigger_corpus_tests() { } } +#[test] +fn similarly_named_atn_siblings_do_not_trigger_corpus_tests() { + for path in [ + "crates/engine/src/cmd/atn_cmds_extra.rs", + "crates/engine/src/cmd/atn_cmds_old/tests.rs", + "crates/engine/src/cmd/atn_cmds.rs.bak", + "crates/engine/src/cmd/atn_cmds", + ] { + assert!(!is_critical(path), "{path}"); + } +} + #[test] fn existing_critical_sources_still_trigger_corpus_tests() { for path in [