From 9ab30724033f4a49d69ab7ae2b320b3e00d8907a Mon Sep 17 00:00:00 2001 From: Stefan Maron Date: Tue, 17 Nov 2026 18:11:07 +0100 Subject: [PATCH] Make the run target follow the build the Microsoft apps come from --bc-version 29 on a 29.1 build kept minor 0, so Feature Key served the rows measured on 29.0 while --bc-version 29.1 and the full build number refused them. BcVersion::resolved_to now sets the minor from the resolved build (same major only) and both CLIs call it. Fixes #8209. --- crates/al-test-cli/src/main.rs | 2 +- crates/al-version/src/lib.rs | 37 ++++++++++++++++++++++++++++++++++ crates/alrunner-cli/src/run.rs | 8 +++----- docs/codemap.md | 2 +- 4 files changed, 42 insertions(+), 7 deletions(-) diff --git a/crates/al-test-cli/src/main.rs b/crates/al-test-cli/src/main.rs index 4f24aac46..ebf1e8bb1 100644 --- a/crates/al-test-cli/src/main.rs +++ b/crates/al-test-cli/src/main.rs @@ -1107,7 +1107,7 @@ fn run_version_inner( match &deps.build { Some(u) => { println!("bc build: {} ({})", u.build, origin_word(u.origin)); - chosen.target.bc.build = Some(u.build.to_string()); + chosen.target.bc.resolved_to(&u.build.to_string()); bc_build = Some(u.build.to_string()); let fetch = al_deps::artifact::Fetch { cache_root: al_deps::cache::cache_root_from_env(args.cache_dir.as_deref()), diff --git a/crates/al-version/src/lib.rs b/crates/al-version/src/lib.rs index edd2f378a..14e79cfeb 100644 --- a/crates/al-version/src/lib.rs +++ b/crates/al-version/src/lib.rs @@ -87,6 +87,18 @@ impl BcVersion { }) } + /// The run's version once the Microsoft apps were found: `build` is that build (`29.1.57326.58275`). The minor follows + /// it, so a major-only `--bc-version 29` on a 29.1 build is the target `29.1` names (al-runner issue 8209). A build of + /// another major leaves the minor as it was. + pub fn resolved_to(&mut self, build: &str) { + if let Ok(b) = BcVersion::parse(build) + && b.major == self.major + { + self.minor = b.minor; + } + self.build = Some(build.to_string()); + } + /// True when `prefix` (`27`, `27.5`) is a whole-segment prefix of this /// version: `27.5` matches `27.5.46862.1` but not `27.50`. pub fn matches_prefix(&self, prefix: &str) -> bool { @@ -263,6 +275,31 @@ mod tests { BcVersion::parse(s).unwrap() } + // al-runner issue 8209: `--bc-version 29`, `29.1` and the full build pick the same 29.1 build, so the target is that + // build however it was named, and the Feature Key rows measured on 29.0 only are refused on it in all three. + #[test] + fn the_target_follows_the_build_the_microsoft_apps_come_from() { + let build = "29.1.57326.58275"; + for asked in ["29", "29.1", build] { + let mut t = Target::for_bc(bc(asked)); + t.bc.resolved_to(build); + assert_eq!( + (t.bc.major, t.bc.minor, t.bc.to_string()), + (29, 1, build.to_string()), + "{asked}" + ); + assert_eq!(feature_key_rows(Some(&t)), None, "{asked}"); + } + // Neighbor: a 29.0 build keeps main's 29.0 rows. + let mut t = Target::for_bc(bc("29")); + t.bc.resolved_to("29.0.54011.56262"); + assert_eq!(feature_key_rows(Some(&t)), Some(FeatureKeyRows::Bc29)); + // A build of another major leaves the minor as main did; the build string is still recorded. + let mut t = Target::for_bc(bc("29")); + t.bc.resolved_to("28.5.54151.58194"); + assert_eq!((t.bc.major, t.bc.minor), (29, 0)); + } + #[test] fn runtime_is_bc_major_minus_eleven() { assert_eq!(Runtime::for_bc(27), Runtime { major: 16, minor: 0 }); diff --git a/crates/alrunner-cli/src/run.rs b/crates/alrunner-cli/src/run.rs index 2bffcacb2..f5f40d7e6 100644 --- a/crates/alrunner-cli/src/run.rs +++ b/crates/alrunner-cli/src/run.rs @@ -1375,18 +1375,16 @@ fn test_inner( } let mut bc_build = None; if let Some(u) = &dependencies.build { - chosen.target.bc.build = Some(u.build.to_string()); + // The target is the build the Microsoft apps come from (`BcVersion::resolved_to`). + chosen.target.bc.resolved_to(&u.build.to_string()); bc_build = Some(u.build.to_string()); if from_packages && Some(&u.build) != preferred_build.as_ref() { // The build the packages come from is neither cached nor published: the usual rules chose - // another one of the same major, and the target follows what the apps really are. + // another one of the same major. build_rule.push_str(&format!( "; that build is not cached, on disk or published, so BC {} was used", u.build )); - if u.build.major() == u32::from(chosen.target.bc.major) { - chosen.target.bc.minor = u.build.minor() as u16; - } } } // ADR-060 decision 2: `--license FILE`, else the license of the BC artifacts of the build, else none. A file that diff --git a/docs/codemap.md b/docs/codemap.md index 77b743184..4a436296b 100644 --- a/docs/codemap.md +++ b/docs/codemap.md @@ -390,7 +390,7 @@ al-testkit dev only: compile AL from a string and run a routine al-testf - `awaited.rs`: Behavior that differs between BC versions in an open corpus probe, before a bump pins its guard (not a `Gate`; `tests/gate_completeness.rs` fails at the bump until it becomes one). Entry: `journal_temp_part_reads_after_refresh`. - `choose.rs` (238): How the target of a run is chosen (ADR-015 3.2, 3.8). Entry: `AppVersions` 10, `TargetError` 58, `Chosen` 84, `choose_target` 98. - `gates.rs` (115): Behaviour that differs between BC versions, as named facts in one table (ADR-015 3.4). Entry: `Evidence` 12, `Gate` 18, `has` 69. -- `lib.rs` (291): BC versions and the run target (ADR-015). Entry: `VersionError` 21, `BcVersion` 42, `Runtime` 50, `Target` 56. +- `lib.rs` (~330): BC versions and the run target (ADR-015). `BcVersion::resolved_to` makes the target the build the Microsoft apps came from (minor and build string; both CLIs call it, al-runner issue 8209). Entry: `VersionError` 21, `BcVersion` 42, `Runtime` 50, `Target` 56. ### al-vm