From ad11aa3dc5629f31301e4a832db274fd934f7248 Mon Sep 17 00:00:00 2001 From: abrichr Date: Tue, 24 Nov 2026 19:03:12 -0500 Subject: [PATCH 1/2] test(desktop): compare the types range only against the bundled Flow pin The unit job installs in-tree Flow, which since #2637 requires openadapt-types>=0.24.2, while Desktop's bundled Flow 2.4.1 requires >=0.24.0. Skip the range check unless the installed Flow is the locked pin; fail instead when OPENADAPT_DESKTOP_REQUIRE_BUNDLED_FLOW=1. --- packages/desktop/tests/test_dependency_compat.py | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/packages/desktop/tests/test_dependency_compat.py b/packages/desktop/tests/test_dependency_compat.py index 0c63f8ec63..6e14ee1186 100644 --- a/packages/desktop/tests/test_dependency_compat.py +++ b/packages/desktop/tests/test_dependency_compat.py @@ -9,6 +9,7 @@ from __future__ import annotations +import os import tomllib from importlib.metadata import PackageNotFoundError, distribution from pathlib import Path @@ -47,12 +48,24 @@ def _locked_version(name: str) -> Version: def _bundled_flow_types_specifier() -> SpecifierSet: try: - requires = distribution(FLOW).requires or [] + installed = distribution(FLOW) except PackageNotFoundError: pytest.skip( "the bundled openadapt-flow runtime is not installed; the " "qualification-contract job runs this file with --extra build" ) + bundled = _locked_version(FLOW) + if Version(installed.version) != bundled: + # The unit job installs the in-tree Flow on purpose. Its range is not + # the one Desktop ships with, so only the bundled pin is comparable. + message = ( + f"installed {FLOW} {installed.version} is not the bundled pin " + f"{bundled}; the qualification-contract job checks the bundled range" + ) + if os.environ.get("OPENADAPT_DESKTOP_REQUIRE_BUNDLED_FLOW") == "1": + pytest.fail(message) + pytest.skip(message) + requires = installed.requires or [] for raw in requires: requirement = Requirement(raw) if _canonical(requirement.name) == TYPES and requirement.marker is None: From dd2298023ef7b100b4c5411a4ea59130425b4a1f Mon Sep 17 00:00:00 2001 From: abrichr Date: Tue, 24 Nov 2026 20:54:44 -0500 Subject: [PATCH 2/2] test(desktop): fail the types range check when the bundled Flow is required but absent --- .../desktop/tests/test_dependency_compat.py | 21 ++++++++----------- 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/packages/desktop/tests/test_dependency_compat.py b/packages/desktop/tests/test_dependency_compat.py index 5d260d506d..0e57c46689 100644 --- a/packages/desktop/tests/test_dependency_compat.py +++ b/packages/desktop/tests/test_dependency_compat.py @@ -66,18 +66,6 @@ def _bundled_flow_types_specifier() -> tuple[Version, SpecifierSet]: "the bundled openadapt-flow runtime is not installed; the " "qualification-contract job runs this file with --extra build" ) - bundled = _locked_version(FLOW) - if Version(installed.version) != bundled: - # The unit job installs the in-tree Flow on purpose. Its range is not - # the one Desktop ships with, so only the bundled pin is comparable. - message = ( - f"installed {FLOW} {installed.version} is not the bundled pin " - f"{bundled}; the qualification-contract job checks the bundled range" - ) - if os.environ.get("OPENADAPT_DESKTOP_REQUIRE_BUNDLED_FLOW") == "1": - pytest.fail(message) - pytest.skip(message) - requires = installed.requires or [] for raw in requires: requirement = Requirement(raw) if _canonical(requirement.name) == TYPES and requirement.marker is None: @@ -110,6 +98,15 @@ def test_types_range_matches_the_bundled_flow_runtime() -> None: desktop = _desktop_types_requirement().specifier installed_flow_version, flow = _bundled_flow_types_specifier() bundled_pin = _bundled_flow_pin() + if ( + os.environ.get("OPENADAPT_DESKTOP_REQUIRE_BUNDLED_FLOW") == "1" + and bundled_pin is not None + and installed_flow_version != bundled_pin + ): + pytest.fail( + f"OPENADAPT_DESKTOP_REQUIRE_BUNDLED_FLOW=1 but installed {FLOW} " + f"{installed_flow_version} is not the bundled pin {bundled_pin}" + ) if bundled_pin is None or installed_flow_version == bundled_pin: assert desktop == flow, ( f"Desktop declares {TYPES}{desktop} but the bundled {FLOW} declares "