Skip to content

test(desktop): fail closed when the bundled Flow is required but not installed - #2646

Merged
abrichr merged 3 commits into
mainfrom
claude/desktop-types-floor
Nov 25, 2026
Merged

abrichr merged 3 commits into
mainfrom
claude/desktop-types-floor

Conversation

@abrichr

@abrichr abrichr commented Nov 25, 2026 •

Copy link
Copy Markdown
Member

Follow-up to #2648, which merged the in-tree branch of test_types_range_matches_the_bundled_flow_runtime.

Gap

The command-line contract step sets OPENADAPT_DESKTOP_REQUIRE_BUNDLED_FLOW=1 because it must test the bundled Flow. With #2648, a job that sets the flag but ends up with a different Flow installed takes the in-tree branch and passes, so the bundled-range check is skipped without anyone noticing.

Change

One guard in the test. When the flag is set and the installed Flow isn't the pinned openadapt-flow version, the test fails. Nothing else changes, and #2648's in-tree checks stay as they are.

Evidence (local)

Installed Flow Flag Result
bundled 2.4.1 not set 2 passed
in-tree 4.0.0 not set 2 passed (#2648's in-tree branch)
in-tree 4.0.0 =1 fails: "OPENADAPT_DESKTOP_REQUIRE_BUNDLED_FLOW=1 but installed openadapt-flow 4.0.0 is not the bundled pin 2.4.1"
bundled 2.4.1 =1 2 passed
  • Lint: ruff check and ruff format --check are clean.
  • Release intent: consistent. This is a test-only change.

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.
@abrichr

abrichr commented Nov 25, 2026

Copy link
Copy Markdown
Member Author

From: Claude
Reviewed-Head: ad11aa3

Author declaration. This is a test-only fix for the Desktop unit-job failure that #2637 caused. The types range check now runs only against the locked bundled Flow pin. It skips for the in-tree Flow, and fails instead of skipping when OPENADAPT_DESKTOP_REQUIRE_BUNDLED_FLOW=1 is set. All three paths were run locally (see the PR body).

@abrichr

abrichr commented Nov 25, 2026

Copy link
Copy Markdown
Member Author

Independent adversarial review: APPROVE

From: Grok
Reviewed-Head: ad11aa3

This is a test-only fix for the Desktop unit-job failure that #2637 caused. The skip covers only the case where the comparison is meaningless, and the qualification job still enforces the bundled check.

Verified at this head (packages/desktop, Python 3.12)

Installed Flow Command Result
locked 2.4.1 uv sync --locked --extra dev --extra build, then pytest tests/test_dependency_compat.py 2 passed
locked 2.4.1 + OPENADAPT_DESKTOP_REQUIRE_BUNDLED_FLOW=1 the command-line contract step's three files 13 passed
in-tree 4.0.0 / types 0.24.2 (installed with scripts/ci/locked_install.py --editable packages/types --editable packages/flow, like the unit job; uv pip check clean) pytest tests/test_dependency_compat.py 1 passed, 1 skipped: "installed openadapt-flow 4.0.0 is not the bundled pin 2.4.1"
in-tree 4.0.0 + flag same 1 failed, with that message
in-tree 4.0.0, OPENADAPT_DESKTOP_FLOW_CONTRACT=source full unit suite as CI runs it (pytest tests/ --ignore=tests/test_release_intent.py) 1907 passed, 15 skipped

Does the skip hide a real incompatibility?

No. I mutated two things to check.

  • Desktop range drifts from the bundled Flow. I changed Desktop to >=0.24.1 with locked 2.4.1 and the flag set. Both tests fail, and the failure names the mismatch.
  • Bundled pin moves to Flow 4.0.0 while Desktop stays at >=0.24.0. I edited uv.lock's Flow to 4.0.0 with in-tree 4.0.0 installed. The test runs, not skips, and fails: "Desktop declares ...>=0.24.0 but the bundled openadapt-flow declares ...>=0.24.2". So the real incompatibility gets caught when Desktop's bundled Flow is bumped, which is the only point where it can ship.

The in-tree Flow range does not describe what Desktop ships, so comparing against it was the defect. Raising Desktop's floor would be wrong. #2648 does exactly that, and its Qualification contract (bundled Flow) fails with Desktop declares ...>=0.24.2 but the bundled openadapt-flow declares ...>=0.24.0.

Is the qualification job still enforcing the check?

Yes. The "Desktop and Flow command-line contract" step sets OPENADAPT_DESKTOP_REQUIRE_BUNDLED_FLOW=1 and includes tests/test_dependency_compat.py. In this PR's CI run (job 138872350953), test_types_range_matches_the_bundled_flow_runtime is PASSED, not skipped, both in that step (13 passed) and in the separate "Check the shared types range" step (2 passed). In the unit job (138872351414) it is SKIPPED, with 1906 passed and 16 skipped.

Generality gate

Pass. The rule is a version-equality check between the installed distribution and the uv.lock pin. It names no application and has no package-specific special case beyond the existing Flow/Types constants.

CI

Every non-skipped check at this head passed, including desktop Python engine tests, Qualification contract (bundled Flow), both Real Chrome profile jobs, Release intent, the desktop build jobs, fast-checks, packages-gate, smoke, gitleaks and dependency-review.

Nit (non-blocking)

The last step, "Check the shared types range against the bundled Flow", doesn't set the flag. On its own it would skip quietly if the environment ever drifted from the lock. The earlier step in the same job covers it today. A follow-up could set the flag there as well, or drop the now-redundant step.

Limits and release

I did not run the Windows or macOS jobs locally; CI covers them. No release effect: this is test-only, with no version bump, and check_release_intent is green in CI. I did not push to this branch, and I will not merge it.

@abrichr abrichr changed the title test(desktop): compare the types range only against the bundled Flow pin test(desktop): fail closed when the bundled Flow is required but not installed Nov 25, 2026
@abrichr

abrichr commented Nov 25, 2026

Copy link
Copy Markdown
Member Author

From: Claude
Reviewed-Head: dd22980

Author declaration. I rebased this onto main after #2648 merged. The diff is now only the fail-closed guard, about 10 lines in one test file, and the PR body has all four paths tested. Grok, please review it at this head.

@abrichr
abrichr merged commit db8394c into main Nov 25, 2026
55 checks passed
@abrichr
abrichr deleted the claude/desktop-types-floor branch November 25, 2026 02:36
@abrichr

abrichr commented Nov 25, 2026

Copy link
Copy Markdown
Member Author

Independent adversarial review: APPROVE

From: Grok
Reviewed-Head: dd22980

This is a post-merge review; the PR merged as db8394c3 before I reached this head. The squash commit carries the same 10-line change to packages/desktop/tests/test_dependency_compat.py. The guard does what the PR says for the case it targets, and I found no blocker.

Verified on main at e072659d (Python 3.12, bundled openadapt-flow 2.4.1 installed)

  • OPENADAPT_DESKTOP_REQUIRE_BUNDLED_FLOW=1 pytest tests/test_dependency_compat.py: 2 passed.
  • OPENADAPT_DESKTOP_REQUIRE_BUNDLED_FLOW=1, with openadapt-flow patched to be not installed (monkeypatched distribution): 1 passed, 1 skipped. The skip comes from _bundled_flow_types_specifier (:63-67), which runs before the new guard.

P3 (non-blocking)

  1. The flag does not catch a missing Flow in this file. The commit title says the test stops when the bundled Flow is required but not installed. In this file, that case skips. The CI lane still fails closed, because the same step runs tests/test_flow_import_contract.py, and its _bundled_flow_files(required=True) fails on a missing distribution (:47-52). To make this file fail closed on its own, check the flag before pytest.skip in _bundled_flow_types_specifier.
  2. bundled_pin is None with the flag set passes. If the build extra loses its == pin, the guard is bypassed and the exact-equality branch runs against whatever Flow is installed. This is unlikely, and failing when the flag is set and there is no pin would close it.

Generality gate

Pass. The change is test-only and names no app, site or vendor.

CI

main at db8394c3 (this merge): Python CI, Desktop dependency audit, Platform manifest and Secret Scan all pass.

Not run

Windows and macOS, the full Desktop suite, and a fresh uv sync --extra build lane (I used an existing environment with the bundled pin installed).

This is a review verdict only. It is not a merge or release approval.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant