From 51bc891a858195c16cbbafa53916e779f36454b8 Mon Sep 17 00:00:00 2001 From: Luke Curley Date: Sun, 1 Nov 2026 18:09:02 -0800 Subject: [PATCH 1/4] chore(quest): claim quest/m0/ci/dispatch-test-kvm.md Quest-Claim: 8cb80078a7c5e978 From 4d9e5f7417d178536a5055842ae6dfd8f8ce84f6 Mon Sep 17 00:00:00 2001 From: Luke Curley Date: Sun, 1 Nov 2026 18:12:40 -0800 Subject: [PATCH 2/4] fix(ci): isolate the dispatcher's KVM probe Co-Authored-By: GPT-6.1 Sol --- quest/m0/ci/README.md | 1 - quest/m0/ci/dispatch-test-kvm.md | 22 ---------------------- sh/dispatch-query.test.py | 28 +++++++++++++++++++++++++++- sh/dispatch.sh | 2 +- sh/kvm.sh | 3 +++ 5 files changed, 31 insertions(+), 25 deletions(-) delete mode 100644 quest/m0/ci/dispatch-test-kvm.md create mode 100644 sh/kvm.sh diff --git a/quest/m0/ci/README.md b/quest/m0/ci/README.md index 241019846d3..4c3cb465c0e 100644 --- a/quest/m0/ci/README.md +++ b/quest/m0/ci/README.md @@ -166,5 +166,4 @@ The historical samples locate candidates; they are not controlled benchmarks. - [The queue host keeps the queue's disk](/quest/m0/ci/queue-host-disk.md) - agent sessions can't starve the queue runner of disk, and a crashed runner restarts - [The next test-CPU cuts](/quest/m0/ci/test-cost-followups.md) - the slow-test leftovers from #6987, cut at their source - [Biome checks every file it can parse](/quest/m0/ci/biome-whole-repo.md) - Biome runs over the whole repository and main is clean under it -- [dispatch.sh's tests pass without KVM](/quest/m0/ci/dispatch-test-kvm.md) - `sh/dispatch-query.test.py` fakes the KVM probe instead of failing 20 tests on hosts without `/dev/kvm` - [mbx launches Cargo with any argument length](/quest/m0/ci/mbx-arg-max.md) - no "Argument list too long" in `sh/rs/select.test.py`'s recipe test diff --git a/quest/m0/ci/dispatch-test-kvm.md b/quest/m0/ci/dispatch-test-kvm.md deleted file mode 100644 index e80d80efb04..00000000000 --- a/quest/m0/ci/dispatch-test-kvm.md +++ /dev/null @@ -1,22 +0,0 @@ -# [XS] dispatch.sh's tests pass without KVM - -## Goal - -`sh/dispatch-query.test.py` passes on a Linux x86_64 host without -`/dev/kvm`, as it does on CI's KVM runners. dispatch.sh still refuses -`check flake` on a host without KVM, the refusal that -[moq-dev/moq#7281](https://github.com/moq-dev/moq/pull/7281) added. - -## Plan - -Decided by the maintainer on 2026-11-01: plan it in m0 ✅ / m1 / drop. - -- Today 20 of its 30 tests fail on such a host. Every run whose selection - includes `check flake` reaches the real `/dev/kvm` probe in - `sh/dispatch.sh`, so the mocked CI run exits 1. `just check` on main - fails locally there too. -- The test harness owns the fix: let it fake the probe's answer, for example - by pointing dispatch.sh at a probe path the test sets. Don't loosen the - refusal, and don't skip the tests when KVM is missing. -- Add a case for the refusal itself: with the probe reporting no KVM, a run - selecting `check flake` fails and names the missing `/dev/kvm`. diff --git a/sh/dispatch-query.test.py b/sh/dispatch-query.test.py index da809764f2c..57fcf06aa97 100644 --- a/sh/dispatch-query.test.py +++ b/sh/dispatch-query.test.py @@ -210,6 +210,7 @@ def test_platform_is_only_a_query(self): self.assertEqual(result.stdout, "") def stub_ci(self, just=""): + (self.repo / "sh/kvm.sh").write_text("#!/bin/sh\nexit 0\n") for tool in ( "bun", "python3", @@ -463,7 +464,32 @@ def test_local_flake_probe_errors_are_failures_without_cancelling_other_modules( self.assertNotIn("nix flake check --print-build-logs", calls) self.assertIn("gh test", calls) - def test_strict_ci_runs_the_full_flake_without_a_probe(self): + @unittest.skipUnless(sys.platform == "linux" and os.uname().machine == "x86_64", "Linux VM checks only") + def test_missing_kvm_refuses_flake_without_skipping_or_cancelling_other_modules(self): + for strict in (False, True): + with self.subTest(strict=strict): + self.stub_ci() + self.change("flake.nix") + (self.repo / "sh/kvm.sh").write_text("#!/bin/sh\nexit 1\n") + env = dict(self.env) + if not strict: + env.pop("CI_STRICT") + result = subprocess.run( + ["bash", "sh/dispatch.sh", "ci" if strict else "check", "origin/main"], + cwd=self.repo, + env=env, + text=True, + capture_output=True, + ) + self.assertEqual(result.returncode, 1, result.stderr) + self.assertIn("/dev/kvm is missing", result.stdout + result.stderr) + self.assertRegex(result.stderr, r"\d+ check flake \(failed\)") + self.assertNotIn("(skipped)", result.stderr) + calls = (self.root / "calls").read_text().splitlines() + self.assertNotIn("nix flake check --print-build-logs", calls) + self.assertIn("gh test", calls) + + def test_strict_ci_runs_the_full_flake_without_a_namespace_probe(self): self.change("flake.nix") calls = self.run_ci() self.assertIn("nix flake check --print-build-logs", calls) diff --git a/sh/dispatch.sh b/sh/dispatch.sh index 51b6c7231e7..83bfb76eb7f 100755 --- a/sh/dispatch.sh +++ b/sh/dispatch.sh @@ -344,7 +344,7 @@ step() { # Without KVM, QEMU falls back to emulation and the VM tests time # out long after. Refuse rather than skip, so a local gate never # reads as passing without them. - if [[ "$OSTYPE" == linux* && "$HOSTTYPE" == x86_64 && ! -e /dev/kvm ]]; then + if [[ "$OSTYPE" == linux* && "$HOSTTYPE" == x86_64 ]] && ! bash sh/kvm.sh; then echo "$action: flake's NixOS VM tests need KVM, but /dev/kvm is missing; run them on a KVM host, as CI does" >&2 return 1 fi diff --git a/sh/kvm.sh b/sh/kvm.sh new file mode 100644 index 00000000000..2d6dac79fad --- /dev/null +++ b/sh/kvm.sh @@ -0,0 +1,3 @@ +#!/usr/bin/env bash +# Keep the host probe separate so dispatcher fixtures can supply its result. +[[ -e /dev/kvm ]] From dc327788ea760120f2cc80d04baac2706b41c380 Mon Sep 17 00:00:00 2001 From: Luke Curley Date: Sun, 1 Nov 2026 18:22:54 -0800 Subject: [PATCH 3/4] fix(ci): select the full gate for KVM probe changes Co-Authored-By: GPT-6.1 Sol --- sh/dispatch-query.test.py | 7 +++++-- sh/dispatch.sh | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/sh/dispatch-query.test.py b/sh/dispatch-query.test.py index 57fcf06aa97..1621bdfe916 100644 --- a/sh/dispatch-query.test.py +++ b/sh/dispatch-query.test.py @@ -125,9 +125,12 @@ def test_selected_tests_do_not_depend_on_installed_tools(self): (self.repo / path).unlink() def test_orchestration_and_all_select_work(self): - self.expect(True, base="--all") + self.expect(True, base="--all", rust=True) self.change("justfile") - self.expect(True) + self.expect(True, rust=True) + (self.repo / "justfile").unlink() + self.change("sh/kvm.sh") + self.expect(True, rust=True) def test_working_tree_changes_and_deletions_count(self): self.change("rs/moq-net/src/lib.rs") diff --git a/sh/dispatch.sh b/sh/dispatch.sh index 83bfb76eb7f..27eb6898093 100755 --- a/sh/dispatch.sh +++ b/sh/dispatch.sh @@ -50,7 +50,7 @@ else # These files hold the map and the recipes that call it, and match no # module, so a change to them would otherwise validate none of it. - if grep -qE '^(justfile|sh/(dispatch|changed)\.sh|sh/local\.(sh|ts))$' "$changed"; then + if grep -qE '^(justfile|sh/(dispatch|changed|kvm)\.sh|sh/local\.(sh|ts))$' "$changed"; then echo "$action: root orchestration changed; running everything." >&2 all=1 fi From ee7a55e22ae4b7aee095840397c90d0102ccb8aa Mon Sep 17 00:00:00 2001 From: Luke Curley Date: Sun, 1 Nov 2026 18:23:44 -0800 Subject: [PATCH 4/4] test(ci): keep the KVM stub in the fixture base Co-Authored-By: GPT-6.1 Sol --- sh/dispatch-query.test.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sh/dispatch-query.test.py b/sh/dispatch-query.test.py index 1621bdfe916..bd2cfb51b80 100644 --- a/sh/dispatch-query.test.py +++ b/sh/dispatch-query.test.py @@ -25,6 +25,8 @@ def setUp(self): (self.repo / "sh").mkdir(parents=True) for script in ("dispatch.sh", "changed.sh", "local.sh"): shutil.copy(ROOT / "sh" / script, self.repo / "sh" / script) + # The stub belongs in the base so it does not widen every test's diff. + (self.repo / "sh/kvm.sh").write_text("#!/bin/sh\nexit 0\n") self.bin = self.root / "bin" self.bin.mkdir() for command in ("bash", "git", "sort", "mktemp", "rm", "grep"): @@ -213,7 +215,6 @@ def test_platform_is_only_a_query(self): self.assertEqual(result.stdout, "") def stub_ci(self, just=""): - (self.repo / "sh/kvm.sh").write_text("#!/bin/sh\nexit 0\n") for tool in ( "bun", "python3",