From 371933e2633010404f8993c10ab8fb2f985ad649 Mon Sep 17 00:00:00 2001 From: repo-worker-tmp-code-b Date: Wed, 11 Nov 2026 06:30:51 -0600 Subject: [PATCH 1/2] fix(mcpx): affected-tests --run executes argv, never a shell (#5649) affected-tests.py collected Git-reported paths as text, split them on whitespace, interpolated .go paths and package directories into command strings, and ran the strings with shell=True: a crafted filename in an untrusted checkout executed arbitrary shell syntax during --run. Paths are now structured end to end: git ls-files/diff output is NUL-delimited, and every tier command carries an argv vector plus an explicit cwd. --run executes argv with no shell; the printed dry-run commands are unchanged, so existing selector tests and the mcpx-test-affected recipe see the same output. New regression suite test_affected_run_injection.py drives the real selector with --run in a scratch repo: command-substitution and semicolon filenames create no marker file, and a space in a filename stays a single path. All scripts tests pass (10 in the affected suites; full discover green). --- pkgs/mcpx/scripts/affected-tests.py | 71 +++++++++--- .../tests/test_affected_run_injection.py | 108 ++++++++++++++++++ 2 files changed, 164 insertions(+), 15 deletions(-) create mode 100644 pkgs/mcpx/scripts/tests/test_affected_run_injection.py diff --git a/pkgs/mcpx/scripts/affected-tests.py b/pkgs/mcpx/scripts/affected-tests.py index 95faa69b89..a4863c8464 100755 --- a/pkgs/mcpx/scripts/affected-tests.py +++ b/pkgs/mcpx/scripts/affected-tests.py @@ -366,14 +366,28 @@ def main(): if not os.path.isdir(mcpx): sys.exit("pkgs/mcpx not found — run from inside the code repo") - untracked = set( - run(["git", "ls-files", "--others", "--exclude-standard"], root).split() - ) - changed = set(run(["git", "diff", "--name-only", args.base], root).split()) + # NUL-delimited Git output (#5649): a path is a structured value, + # never text to split on whitespace or interpolate into a shell. + untracked = { + p + for p in run( + ["git", "ls-files", "-z", "--others", "--exclude-standard"], root + ).split("\0") + if p + } + changed = { + p + for p in run(["git", "diff", "--name-only", "-z", args.base], root).split( + "\0" + ) + if p + } changed |= untracked rel = sorted(p[len("pkgs/mcpx/") :] for p in changed if p.startswith("pkgs/mcpx/")) - commands = [] # (tier, command string runnable from repo root) + commands = [] # (tier, display string, argv, cwd): the display + # string is what dry-run prints; execution uses argv with no + # shell, so Git-reported paths are data, never shell syntax (#5649) notes = [] # A deleted file appears in the diff but cannot be formatted or read; @@ -402,9 +416,12 @@ def pkg_arg(p): # T0 — format + vet on touched packages. if go_files: files = " ".join(f"pkgs/mcpx/{p}" for p in go_files) - commands.append(("T0", f"gofmt -l {files}")) + argv = ["gofmt", "-l", *[f"pkgs/mcpx/{p}" for p in go_files]] + commands.append(("T0", f"gofmt -l {files}", argv, root)) for p in unit_pkgs: - commands.append(("T0", f"(cd pkgs/mcpx && go vet {pkg_arg(p)})")) + commands.append( + ("T0", f"(cd pkgs/mcpx && go vet {pkg_arg(p)})", ["go", "vet", pkg_arg(p)], mcpx) + ) if embed_owners: notes.append( @@ -414,7 +431,14 @@ def pkg_arg(p): # T1 — unit tests of edited packages. for p in unit_pkgs: - commands.append(("T1", f"(cd pkgs/mcpx && go test -count=1 {pkg_arg(p)})")) + commands.append( + ( + "T1", + f"(cd pkgs/mcpx && go test -count=1 {pkg_arg(p)})", + ["go", "test", "-count=1", pkg_arg(p)], + mcpx, + ) + ) # Diff text for T1b / registry analysis (registry + non-test sources). src = [p for p in all_go_files if not p.endswith("_test.go")] @@ -473,7 +497,14 @@ def pkg_arg(p): short = imp.replace("github.com/developing-today/code/pkgs/mcpx/", "") if short == "internal/e2e" or short in unit_pkgs: continue - commands.append(("T1b", f"(cd pkgs/mcpx && go test -count=1 ./{short}/)")) + commands.append( + ( + "T1b", + f"(cd pkgs/mcpx && go test -count=1 ./{short}/)", + ["go", "test", "-count=1", f"./{short}/"], + mcpx, + ) + ) if importers: notes.append( f"T1b: exported declarations changed ({', '.join(sorted(exported))}); " @@ -555,7 +586,12 @@ def pkg_arg(p): regex = "^(" + "|".join(e2e_selected) + ")$" est = E2E_SECONDS_PER_TEST * len(e2e_selected) commands.append( - ("T2", f"(cd pkgs/mcpx && go test -count=1 ./internal/e2e -run '{regex}')") + ( + "T2", + f"(cd pkgs/mcpx && go test -count=1 ./internal/e2e -run '{regex}')", + ["go", "test", "-count=1", "./internal/e2e", "-run", regex], + mcpx, + ) ) notes.append( f"T2: {len(e2e_selected)} e2e test(s) selected, estimated ~{est:g}s " @@ -578,12 +614,17 @@ def pkg_arg(p): continue seen_guard.add(key) commands.append( - ("T3", f"(cd pkgs/mcpx && go test -count=1 ./{pkg}/ -run '{regex}')") + ( + "T3", + f"(cd pkgs/mcpx && go test -count=1 ./{pkg}/ -run '{regex}')", + ["go", "test", "-count=1", f"./{pkg}/", "-run", regex], + mcpx, + ) ) # T4 — build only when packaging/module files changed. if any(os.path.basename(p) in ("go.mod", "go.sum", "package.nix") for p in rel): - commands.append(("T4", "nix build .#mcpx")) + commands.append(("T4", "nix build .#mcpx", ["nix", "build", ".#mcpx"], root)) print( f"# affected tests for pkgs/mcpx vs {args.base} " @@ -592,7 +633,7 @@ def pkg_arg(p): if not commands: print("# no tier commands selected (no code or registry changes)") last = None - for tier, cmd in commands: + for tier, cmd, _argv, _cwd in commands: if tier != last: print(f"\n## {tier}") last = tier @@ -606,9 +647,9 @@ def pkg_arg(p): ) if args.run: - for _, cmd in commands: + for _, cmd, argv, cmd_cwd in commands: print(f"\n$ {cmd}", flush=True) - p = subprocess.run(cmd, cwd=root, shell=True) + p = subprocess.run(argv, cwd=cmd_cwd) if p.returncode != 0: sys.exit(p.returncode) diff --git a/pkgs/mcpx/scripts/tests/test_affected_run_injection.py b/pkgs/mcpx/scripts/tests/test_affected_run_injection.py new file mode 100644 index 0000000000..ed9d02e189 --- /dev/null +++ b/pkgs/mcpx/scripts/tests/test_affected_run_injection.py @@ -0,0 +1,108 @@ +#!/usr/bin/env python3 +"""--run shell-injection regression tests for pkgs/mcpx/scripts/affected-tests.py. + +Issue #5649: the selector collected Git-reported paths as text, split +them on whitespace, interpolated them into command strings, and ran +the strings with shell=True — so a crafted filename in an untrusted +checkout executed arbitrary shell syntax during `affected-tests.py +--run`. The fix keeps paths structured end to end (NUL-delimited Git +output, argv vectors, cwd= instead of `cd` strings). + +Each test builds a scratch git repo with a pkgs/mcpx layout (mirroring +test_affected_untracked.py's fixture), adds an untracked .go file whose +name carries shell syntax, runs the real selector with --run, and +requires that no marker file appears. The metacharacter test also +requires a clean exit: the file is valid, formatted Go, so every tier +command succeeds once the name is passed as data. +""" + +import os +import shutil +import subprocess +import sys +import tempfile +import unittest + +GIT = shutil.which("git") +GO = shutil.which("go") +GOFMT = shutil.which("gofmt") + +TESTS_DIR = os.path.dirname(os.path.abspath(__file__)) +SELECTOR = os.path.normpath(os.path.join(TESTS_DIR, "..", "affected-tests.py")) +MODULE = "github.com/developing-today/code/pkgs/mcpx" + + +def _git(*args, cwd): + env = dict( + os.environ, + GIT_AUTHOR_NAME="fixture", + GIT_AUTHOR_EMAIL="fixture@example.com", + GIT_COMMITTER_NAME="fixture", + GIT_COMMITTER_EMAIL="fixture@example.com", + ) + return subprocess.run( + [GIT, *args], cwd=cwd, capture_output=True, text=True, check=True, env=env + ) + + +@unittest.skipUnless(GIT and GO and GOFMT, "git, go and gofmt are required") +class RunInjectionFixture(unittest.TestCase): + def setUp(self): + self.tmp = tempfile.mkdtemp(prefix="affected-run-injection-") + self.addCleanup(shutil.rmtree, self.tmp, True) + self.mcpx = os.path.join(self.tmp, "pkgs", "mcpx") + _git("init", "-q", "-b", "main", cwd=self.tmp) + full = os.path.join(self.mcpx, "go.mod") + os.makedirs(os.path.dirname(full), exist_ok=True) + with open(full, "w", encoding="utf-8") as f: + f.write("module %s\n\ngo 1.23\n" % MODULE) + _git("add", "-A", cwd=self.tmp) + _git("-c", "commit.gpgsign=false", "commit", "-qm", "base", cwd=self.tmp) + self.base = _git("rev-parse", "HEAD", cwd=self.tmp).stdout.strip() + + def write_untracked(self, name): + with open(os.path.join(self.mcpx, name), "w", encoding="utf-8") as f: + f.write("package mcpx\n") + + def run_selector(self): + env = dict(os.environ, GOPROXY="off", GOTOOLCHAIN="local") + proc = subprocess.run( + [sys.executable, SELECTOR, "--base", self.base, "--run"], + cwd=self.tmp, + capture_output=True, + text=True, + env=env, + ) + return proc + + +class TestRunDoesNotExecuteFilenames(RunInjectionFixture): + def test_command_substitution_in_filename_is_data(self): + # Under the old shell=True execution this name ran + # `touch pwned` from the gofmt command line. + self.write_untracked("evil$(touch${IFS}pwned).go") + proc = self.run_selector() + self.assertEqual(proc.returncode, 0, msg=proc.stdout + proc.stderr) + self.assertFalse( + os.path.exists(os.path.join(self.tmp, "pwned")), + "filename shell syntax executed during --run", + ) + + def test_semicolon_in_filename_is_data(self): + self.write_untracked("x;touch${IFS}pwned2;.go") + proc = self.run_selector() + self.assertFalse( + os.path.exists(os.path.join(self.tmp, "pwned2")), + "filename shell syntax executed during --run", + ) + + def test_space_in_filename_stays_one_path(self): + # Whitespace splitting used to break this into two bogus + # paths; NUL-delimited collection keeps it a single file. + self.write_untracked("with space.go") + proc = self.run_selector() + self.assertEqual(proc.returncode, 0, msg=proc.stdout + proc.stderr) + + +if __name__ == "__main__": + unittest.main() From 0f2a00d62283d39b1324a410e2a7bdd95a1250e3 Mon Sep 17 00:00:00 2001 From: repo-worker-tmp-code-b Date: Wed, 11 Nov 2026 06:40:18 -0600 Subject: [PATCH 2/2] fix(mcpx): wire run-injection suite into CI; surrogateescape git output; stronger space test (#5649 review) --- .github/test-suite-registry.json | 370 ++++++++++++++---- .github/workflows/mcpx-test.yml | 2 + pkgs/mcpx/scripts/affected-tests.py | 4 +- .../tests/test_affected_run_injection.py | 5 + 4 files changed, 300 insertions(+), 81 deletions(-) diff --git a/.github/test-suite-registry.json b/.github/test-suite-registry.json index 2980e8708a..5cc7e915f7 100644 --- a/.github/test-suite-registry.json +++ b/.github/test-suite-registry.json @@ -68,15 +68,41 @@ "uncovered-in-fact": "The suite currently has no evidenced successful run under the five-rule contract, even if a workflow is enabled." }, "filed_family_issues": [ - 5935, 5942, 5946, 5952, 5992, 5993, 6065, 6082, 6084, 6085, 6091, 6092, - 6093, 6099, 5582, 5937, 5945, 5951, 6034, 6081, 6090, 6094, 6095, 6178, 6179 + 5935, + 5942, + 5946, + 5952, + 5992, + 5993, + 6065, + 6082, + 6084, + 6085, + 6091, + 6092, + 6093, + 6099, + 5582, + 5937, + 5945, + 5951, + 6034, + 6081, + 6090, + 6094, + 6095, + 6178, + 6179 ], "uncovered_count": 46, "uncovered_count_definition": "Number of suite rows whose status is uncovered or uncovered-in-fact; mapped rows do not assert the five-rule contract is fully proven.", "suites": [ { "id": "id.rust.unit", - "paths": ["pkgs/id/src/**", "pkgs/id/crates/id-core/src/**"], + "paths": [ + "pkgs/id/src/**", + "pkgs/id/crates/id-core/src/**" + ], "invocation": "cd pkgs/id && cargo test --all-features --lib", "venue": { "workflow": ".github/workflows/id-check.yml", @@ -88,7 +114,9 @@ }, { "id": "id.rust.integration", - "paths": ["pkgs/id/tests/*.rs"], + "paths": [ + "pkgs/id/tests/*.rs" + ], "invocation": "bash scripts/test-shard-sandbox.sh 4 (four partitions)", "venue": { "workflow": ".github/workflows/id-check.yml", @@ -101,7 +129,9 @@ }, { "id": "id.rust.crash-gate", - "paths": ["pkgs/id/tests/crash/**"], + "paths": [ + "pkgs/id/tests/crash/**" + ], "invocation": "cargo test --release --features web --test crash with sampled, sweep, control, and ingest filters", "venue": { "workflow": ".github/workflows/id-check.yml", @@ -113,7 +143,9 @@ }, { "id": "id.web.unit", - "paths": ["pkgs/id/web/src/*.test.ts"], + "paths": [ + "pkgs/id/web/src/*.test.ts" + ], "invocation": "cd pkgs/id/web && bun run test (vitest run)", "venue": { "workflow": ".github/workflows/id-check.yml", @@ -137,12 +169,24 @@ "dispatchable": true }, "status": "mapped", - "related_issues": [5957], + "related_issues": [ + 5957 + ], "notes": "Includes roc-cap-demo-test.sh through scripts/roc-test.sh; fails closed if the pinned Roc compiler is missing (#813)." }, { "id": "id.roc.examples", - "paths": ["pkgs/id/examples/lounge/**", "pkgs/id/examples/roc-chat/**", "pkgs/id/examples/roc-counter/**", "pkgs/id/examples/roc-grid/**", "pkgs/id/examples/roc-screen/**", "pkgs/id/examples/roc-text-counter/**", "pkgs/id/examples/territory/**", "pkgs/id/apps/tic-tac-toe/program/**", "pkgs/id/scripts/rebuild-roc-examples.sh"], + "paths": [ + "pkgs/id/examples/lounge/**", + "pkgs/id/examples/roc-chat/**", + "pkgs/id/examples/roc-counter/**", + "pkgs/id/examples/roc-grid/**", + "pkgs/id/examples/roc-screen/**", + "pkgs/id/examples/roc-text-counter/**", + "pkgs/id/examples/territory/**", + "pkgs/id/apps/tic-tac-toe/program/**", + "pkgs/id/scripts/rebuild-roc-examples.sh" + ], "invocation": "roc-examples flake check: rebuild examples, run sandbox/world tests, cargo test --test toolchain_pin", "venue": { "workflow": ".github/workflows/id-check.yml", @@ -154,7 +198,9 @@ }, { "id": "id.examples.plaza-sdk", - "paths": ["pkgs/id/examples/rust-world/src/**"], + "paths": [ + "pkgs/id/examples/rust-world/src/**" + ], "invocation": "cargo test --manifest-path examples/rust-world/Cargo.toml (test-rust-examples flake check)", "venue": { "workflow": ".github/workflows/id-check.yml", @@ -163,12 +209,16 @@ "dispatchable": true }, "status": "mapped", - "related_issues": [7904], + "related_issues": [ + 7904 + ], "notes": "plaza-sdk is a standalone crate outside the pkgs/id workspace (own [workspace] table), so workspace test venues never ran its 9 unit tests before #7904." }, { "id": "id.examples.rust-counter", - "paths": ["pkgs/id/examples/rust-counter/src/**"], + "paths": [ + "pkgs/id/examples/rust-counter/src/**" + ], "invocation": "cargo test --manifest-path examples/rust-counter/Cargo.toml (test-rust-examples flake check); counter.wasm rebuilt from source and sandbox-tested in the rust-counter-wasm flake check", "venue": { "workflow": ".github/workflows/id-check.yml", @@ -177,12 +227,16 @@ "dispatchable": true }, "status": "mapped", - "related_issues": [7904], + "related_issues": [ + 7904 + ], "notes": "Standalone crate (path dependency on plaza-sdk); its checked-in counter.wasm is loaded by the sandbox conformance tests (src/sandbox.rs), and the rust-counter-wasm check rebuilds the module from source (roc-examples pattern) and runs those tests against the rebuild -- wasm bytes are not reproducible across rustc builds, so no byte gate." }, { "id": "id.web.playwright", - "paths": ["pkgs/id/e2e/tests/*.spec.ts"], + "paths": [ + "pkgs/id/e2e/tests/*.spec.ts" + ], "invocation": "node node_modules/@playwright/test/cli.js test (one invocation per spec)", "venue": { "workflow": ".github/workflows/id-e2e-nightly.yml", @@ -213,7 +267,9 @@ }, { "id": "id.world-snapshot-arm64", - "paths": ["pkgs/id/src/world_fixture.rs"], + "paths": [ + "pkgs/id/src/world_fixture.rs" + ], "invocation": "cargo test -p id --lib world_fixture::tests::replay_tests::checked_in_session_snapshot_hashes_are_stable -- --exact", "venue": { "workflow": ".github/workflows/id-check.yml", @@ -225,7 +281,9 @@ }, { "id": "id.hosted-worker.routing", - "paths": ["pkgs/id/hosted-worker/test/routing.test.ts"], + "paths": [ + "pkgs/id/hosted-worker/test/routing.test.ts" + ], "invocation": "cd pkgs/id/hosted-worker && npm test (node --test test/routing.test.ts)", "venue": { "workflow": ".github/workflows/id-hosted-worker-tests.yml", @@ -234,11 +292,15 @@ "dispatchable": true }, "status": "mapped", - "related_issues": [6095] + "related_issues": [ + 6095 + ] }, { "id": "id.native-shell.transcript", - "paths": ["pkgs/id/crates/id-native-shell/tests/transcript.rs"], + "paths": [ + "pkgs/id/crates/id-native-shell/tests/transcript.rs" + ], "invocation": "cargo test -p id-native-shell (manual invocation; no workflow invocation found)", "venue": null, "status": "uncovered", @@ -247,7 +309,9 @@ }, { "id": "id.bench.compare-script", - "paths": [".github/scripts/id-bench-compare.test.sh"], + "paths": [ + ".github/scripts/id-bench-compare.test.sh" + ], "invocation": "bash .github/scripts/id-bench-compare.test.sh", "venue": { "workflow": ".github/workflows/id-bench.yml", @@ -257,12 +321,16 @@ }, "status": "uncovered-in-fact", "phase3_issue": 6187, - "related_issues": [1619], + "related_issues": [ + 1619 + ], "reason": "The registered id-bench workflow is disabled_manually." }, { "id": "id.just-recipes.drift-guard", - "paths": ["pkgs/id/scripts/just-recipes-check-test.sh"], + "paths": [ + "pkgs/id/scripts/just-recipes-check-test.sh" + ], "invocation": "just-recipes-drift flake check: just-recipes-check && bash scripts/just-recipes-check-test.sh (pkgs/id/flake.nix, via .github/scripts/id-pr-checks.txt)", "venue": { "workflow": ".github/workflows/id-check.yml", @@ -271,13 +339,19 @@ "dispatchable": true }, "status": "mapped", - "related_issues": [6186], + "related_issues": [ + 6186 + ], "notes": "Regression suite for the just-recipes drift guard: asserts failures for changed parameter flags, dependency arguments, alias targets, and malformed JSON. Registered per the Codex review finding on PR #6360 (2026-11-08); the other suites named in the earlier Codex round (mcpx gotest-report, mcpx affected-untracked, production-line-limit, id-bench compare) were already registered." }, { "id": "mcpx.go.unit", - "paths": ["pkgs/mcpx/**/*.go"], - "path_excludes": ["pkgs/mcpx/internal/e2e/**"], + "paths": [ + "pkgs/mcpx/**/*.go" + ], + "path_excludes": [ + "pkgs/mcpx/internal/e2e/**" + ], "invocation": "go test $pkgs -count=1; package.nix also computes Go test packages", "venue": { "workflow": ".github/workflows/mcpx-test.yml", @@ -291,7 +365,9 @@ }, { "id": "mcpx.go.e2e", - "paths": ["pkgs/mcpx/internal/e2e/**"], + "paths": [ + "pkgs/mcpx/internal/e2e/**" + ], "invocation": "go test ./internal/e2e -run ^($RUN_PATTERN)$ -count=1 -json", "venue": { "workflow": ".github/workflows/mcpx-test.yml", @@ -305,7 +381,9 @@ }, { "id": "mcpx.go.stress", - "paths": ["pkgs/mcpx/**/*.go"], + "paths": [ + "pkgs/mcpx/**/*.go" + ], "invocation": "PR changed packages: go test -race -shuffle= -count=10; nightly: go test ./... -race -shuffle= -count=3", "venue": { "workflow": ".github/workflows/mcpx.yml", @@ -319,7 +397,9 @@ }, { "id": "mcpx.scripts.gotest-report", - "paths": ["pkgs/mcpx/scripts/test_gotest_report.py"], + "paths": [ + "pkgs/mcpx/scripts/test_gotest_report.py" + ], "invocation": "cd pkgs/mcpx && python3 scripts/test_gotest_report.py", "venue": { "workflow": ".github/workflows/mcpx.yml", @@ -333,7 +413,9 @@ }, { "id": "mcpx.scripts.affected-untracked", - "paths": ["pkgs/mcpx/scripts/tests/test_affected_untracked.py"], + "paths": [ + "pkgs/mcpx/scripts/tests/test_affected_untracked.py" + ], "invocation": "python3 -m unittest discover -s pkgs/mcpx/scripts/tests -p 'test_affected_untracked.py' -v", "venue": { "workflow": ".github/workflows/mcpx-test.yml", @@ -343,12 +425,35 @@ }, "status": "uncovered-in-fact", "phase3_issue": 6187, - "related_issues": [3320], + "related_issues": [ + 3320 + ], + "reason": "The registered mcpx-test workflow is disabled_manually." + }, + { + "id": "mcpx.scripts.affected-run-injection", + "paths": [ + "pkgs/mcpx/scripts/tests/test_affected_run_injection.py" + ], + "invocation": "python3 -m unittest discover -s pkgs/mcpx/scripts/tests -p test_affected_run_injection.py -v", + "venue": { + "workflow": ".github/workflows/mcpx-test.yml", + "job_step": "Affected run-injection regressions (#5649)", + "state": "disabled_manually", + "dispatchable": true + }, + "status": "uncovered-in-fact", + "phase3_issue": 6187, + "related_issues": [ + 5649 + ], "reason": "The registered mcpx-test workflow is disabled_manually." }, { "id": "mcpx.scripts.affected-embeds", - "paths": ["pkgs/mcpx/scripts/tests/test_affected_embeds.py"], + "paths": [ + "pkgs/mcpx/scripts/tests/test_affected_embeds.py" + ], "invocation": "python3 -m unittest discover -s pkgs/mcpx/scripts/tests -p 'test_affected_embeds.py' -v", "venue": { "workflow": ".github/workflows/scripts-test.yml", @@ -357,12 +462,16 @@ "dispatchable": true }, "status": "mapped", - "related_issues": [6866], + "related_issues": [ + 6866 + ], "reason": "The active scripts-test PR workflow explicitly checks for this file before running the selector regressions; mcpx-test includes a separate dispatch-only step too." }, { "id": "mcpx.plugin.v1", - "paths": ["pkgs/mcpx/plugin/opencode/mcpx/*.test.ts"], + "paths": [ + "pkgs/mcpx/plugin/opencode/mcpx/*.test.ts" + ], "invocation": "bun test plugin/opencode/mcpx/", "venue": { "workflow": ".github/workflows/mcpx.yml", @@ -410,7 +519,9 @@ }, { "id": "mcpx.realsoftware", - "paths": ["pkgs/mcpx/internal/e2e/real_*_test.go"], + "paths": [ + "pkgs/mcpx/internal/e2e/real_*_test.go" + ], "invocation": "go test -tags realsoftware -run ^TestReal ./internal/e2e -count=1 -v -timeout 30m", "venue": { "workflow": ".github/workflows/mcpx-realsoftware-nightly.yml", @@ -441,7 +552,10 @@ }, { "id": "mcpx.package.artifact", - "paths": ["pkgs/mcpx/package.nix", "pkgs/mcpx/packaging-test.sh"], + "paths": [ + "pkgs/mcpx/package.nix", + "pkgs/mcpx/packaging-test.sh" + ], "invocation": "checks.mcpx-packaging (artifact version, wrapper/PATH, man page, completions, stdio handshake)", "venue": { "workflow": ".github/workflows/mcpx-nixbuild.yml", @@ -451,12 +565,16 @@ }, "status": "uncovered-in-fact", "phase3_issue": 6187, - "related_issues": [1981], + "related_issues": [ + 1981 + ], "reason": "The registered packaging-check workflow is disabled_manually." }, { "id": "scripts.program-tending", - "paths": ["scripts/tests/test_program_tending.py"], + "paths": [ + "scripts/tests/test_program_tending.py" + ], "invocation": "python3 scripts/tests/test_program_tending.py (candidate; exact command not established)", "venue": null, "status": "uncovered", @@ -465,7 +583,9 @@ }, { "id": "infra.fleet-paperwork", - "paths": ["infra/fleet-paperwork/tests/test_fleet_paperwork.py"], + "paths": [ + "infra/fleet-paperwork/tests/test_fleet_paperwork.py" + ], "invocation": "Python test; exact command not established", "venue": null, "status": "uncovered", @@ -474,7 +594,9 @@ }, { "id": "infra.worktree-reaper", - "paths": ["infra/worktree-reaper/tests/test_worktree_reaper.py"], + "paths": [ + "infra/worktree-reaper/tests/test_worktree_reaper.py" + ], "invocation": "Python test; exact command not established", "venue": null, "status": "uncovered", @@ -499,7 +621,9 @@ }, { "id": "t3code.seed-providers", - "paths": ["pkgs/t3code-seed-providers/test_seed.py"], + "paths": [ + "pkgs/t3code-seed-providers/test_seed.py" + ], "invocation": "Python test; exact command not established", "venue": null, "status": "uncovered", @@ -508,7 +632,9 @@ }, { "id": "pm-stack.pm-git-sync", - "paths": ["pm-stack/scripts/pm-git-sync.test.sh"], + "paths": [ + "pm-stack/scripts/pm-git-sync.test.sh" + ], "invocation": "bash pm-stack/scripts/pm-git-sync.test.sh", "venue": null, "status": "uncovered", @@ -517,7 +643,9 @@ }, { "id": "pm-stack.tailnet-bindings", - "paths": ["pm-stack/scripts/tailnet-bindings.test.sh"], + "paths": [ + "pm-stack/scripts/tailnet-bindings.test.sh" + ], "invocation": "bash pm-stack/scripts/tailnet-bindings.test.sh", "venue": null, "status": "uncovered", @@ -526,7 +654,9 @@ }, { "id": "opencode-config-normalize", - "paths": ["pkgs/opencode-config-normalize/normalize_test.sh"], + "paths": [ + "pkgs/opencode-config-normalize/normalize_test.sh" + ], "invocation": "bash pkgs/opencode-config-normalize/normalize_test.sh", "venue": null, "status": "uncovered", @@ -535,7 +665,9 @@ }, { "id": "id-mail.deploy", - "paths": ["nixos/services/id-mail/worker/deploy.test.mjs"], + "paths": [ + "nixos/services/id-mail/worker/deploy.test.mjs" + ], "invocation": "cd nixos/services/id-mail/worker && npm test", "venue": null, "status": "uncovered", @@ -544,7 +676,9 @@ }, { "id": "id-mail.runtime", - "paths": ["nixos/services/id-mail/worker/runtime.test.mjs"], + "paths": [ + "nixos/services/id-mail/worker/runtime.test.mjs" + ], "invocation": "npm test (scope not confirmed)", "venue": null, "status": "uncovered", @@ -566,7 +700,9 @@ }, { "id": "github-backup.worker", - "paths": ["infra/github-backup/worker/test/index.test.mjs"], + "paths": [ + "infra/github-backup/worker/test/index.test.mjs" + ], "invocation": "node --test worker/test/index.test.mjs (candidate; no workflow invocation found)", "venue": null, "status": "uncovered", @@ -575,7 +711,9 @@ }, { "id": "opencode-claimant.install", - "paths": ["pm-stack/opencode-claimant/test/install.test.mjs"], + "paths": [ + "pm-stack/opencode-claimant/test/install.test.mjs" + ], "invocation": "cd pm-stack/opencode-claimant && bun test test/install.test.mjs", "venue": null, "status": "uncovered", @@ -598,7 +736,9 @@ }, { "id": "chat.go", - "paths": ["pkgs/chat/main_test.go"], + "paths": [ + "pkgs/chat/main_test.go" + ], "invocation": "cd pkgs/chat && go test ./...", "venue": null, "status": "uncovered", @@ -649,7 +789,9 @@ }, { "id": "pm-stack.projector", - "paths": ["pm-stack/projector/test/*.test.ts"], + "paths": [ + "pm-stack/projector/test/*.test.ts" + ], "invocation": "cd pm-stack/projector && bun test", "venue": { "workflow": ".github/workflows/pm-aggregator-tests.yml", @@ -661,7 +803,9 @@ }, { "id": "pm-stack.dispatch", - "paths": ["pm-stack/dispatch/test/*.test.ts"], + "paths": [ + "pm-stack/dispatch/test/*.test.ts" + ], "invocation": "cd pm-stack/dispatch && bun test", "venue": { "workflow": ".github/workflows/pm-stack-tests.yml", @@ -670,11 +814,15 @@ "dispatchable": true }, "status": "mapped", - "related_issues": [6090] + "related_issues": [ + 6090 + ] }, { "id": "pm-stack.claimant.poll", - "paths": ["pm-stack/opencode-claimant/test_poll.py"], + "paths": [ + "pm-stack/opencode-claimant/test_poll.py" + ], "invocation": "python3 -m unittest pm-stack/opencode-claimant/test_poll.py", "venue": { "workflow": ".github/workflows/pm-stack-tests.yml", @@ -684,12 +832,16 @@ }, "status": "uncovered-in-fact", "phase3_issue": 6187, - "related_issues": [5951], + "related_issues": [ + 5951 + ], "reason": "PR #5953 added the step, but no successful post-change run is evidenced. Latest API run is still queued on a non-main branch; prior main runs were cancelled or failed." }, { "id": "pm-stack.grist.choice-options", - "paths": ["pm-stack/grist/test_update_choice_options.py"], + "paths": [ + "pm-stack/grist/test_update_choice_options.py" + ], "invocation": "python3 -m unittest discover -s pm-stack/grist -p 'test_*.py'", "venue": { "workflow": ".github/workflows/pm-stack-tests.yml", @@ -699,12 +851,16 @@ }, "status": "uncovered-in-fact", "phase3_issue": 6187, - "related_issues": [5951], + "related_issues": [ + 5951 + ], "reason": "PR #5953 added the step, but no successful post-change run is evidenced. Latest API run is still queued on a non-main branch; prior main runs were cancelled or failed." }, { "id": "pm-stack.seed-smoke", - "paths": ["pm-stack/scripts/seed-smoke.test.sh"], + "paths": [ + "pm-stack/scripts/seed-smoke.test.sh" + ], "invocation": "bash pm-stack/scripts/seed-smoke.test.sh", "venue": { "workflow": ".github/workflows/pm-stack-tests.yml", @@ -716,7 +872,9 @@ }, { "id": "pm-stack.deploy-install-smoke", - "paths": ["pm-stack/scripts/deploy-install-smoke.test.sh"], + "paths": [ + "pm-stack/scripts/deploy-install-smoke.test.sh" + ], "invocation": "bash pm-stack/scripts/deploy-install-smoke.test.sh", "venue": { "workflow": ".github/workflows/pm-stack-tests.yml", @@ -728,7 +886,9 @@ }, { "id": "pm-stack.external-comms.quarantine", - "paths": ["pm-stack/external-comms/test_push_quarantine.py"], + "paths": [ + "pm-stack/external-comms/test_push_quarantine.py" + ], "invocation": "cd pm-stack/external-comms && python3 -m unittest test_push_quarantine.py", "venue": { "workflow": ".github/workflows/pm-stack-tests.yml", @@ -737,12 +897,16 @@ "dispatchable": true }, "status": "mapped", - "related_issues": [6217], + "related_issues": [ + 6217 + ], "notes": "Current workflow YAML has workflow_dispatch plus push/pull_request path filters for external-comms; the registry records configuration, not an automatic coverage claim." }, { "id": "pm-stack.meta-exporter", - "paths": ["pm-stack/meta-exporter/meta-quota-export.test.mjs"], + "paths": [ + "pm-stack/meta-exporter/meta-quota-export.test.mjs" + ], "invocation": "node --test pm-stack/meta-exporter/meta-quota-export.test.mjs", "venue": { "workflow": ".github/workflows/pm-stack-tests.yml", @@ -751,12 +915,16 @@ "dispatchable": true }, "status": "mapped", - "related_issues": [6344], + "related_issues": [ + 6344 + ], "notes": "Wired by #6344: pm-stack-tests.yml gains pm-stack/meta-exporter/** in both push and pull_request path filters and a guarded step running the explicit test file under Node 24; the registry records configuration, not an automatic coverage claim." }, { "id": "github-backup.python", - "paths": ["infra/github-backup/tests/test_*.py"], + "paths": [ + "infra/github-backup/tests/test_*.py" + ], "invocation": "Run each matched Python file; fail if the glob is empty", "venue": { "workflow": ".github/workflows/github-backup-tests.yml", @@ -765,7 +933,10 @@ "dispatchable": true }, "status": "mapped", - "related_issues": [5937, 7777] + "related_issues": [ + 5937, + 7777 + ] }, { "id": "repo-universe.python", @@ -781,11 +952,15 @@ "dispatchable": true }, "status": "mapped", - "related_issues": [5945] + "related_issues": [ + 5945 + ] }, { "id": "agent-backup.shell", - "paths": ["pkgs/agent-backup/test-backup.sh"], + "paths": [ + "pkgs/agent-backup/test-backup.sh" + ], "invocation": "bash pkgs/agent-backup/test-backup.sh", "venue": { "workflow": ".github/workflows/agent-backup-tests.yml", @@ -794,7 +969,9 @@ "dispatchable": true }, "status": "mapped", - "related_issues": [6178], + "related_issues": [ + 6178 + ], "notes": "Workflow YAML also has a push-to-main path filter; no trigger changes are part of Phase 1." }, { @@ -810,7 +987,9 @@ "dispatchable": true }, "status": "mapped", - "related_issues": [6094], + "related_issues": [ + 6094 + ], "notes": "Workflow YAML also has a push-to-main path filter; no trigger changes are part of Phase 1." }, { @@ -887,7 +1066,9 @@ }, { "id": "ci.production-line-limit", - "paths": [".github/scripts/check-production-line-limit.test.sh"], + "paths": [ + ".github/scripts/check-production-line-limit.test.sh" + ], "invocation": "bash .github/scripts/check-production-line-limit.test.sh", "venue": { "workflow": ".github/workflows/production-line-guard.yml", @@ -896,11 +1077,15 @@ "dispatchable": true }, "status": "mapped", - "related_issues": [1411] + "related_issues": [ + 1411 + ] }, { "id": "bin.node-tests", - "paths": ["bin/*.test.mjs"], + "paths": [ + "bin/*.test.mjs" + ], "invocation": "node --test bin/*.test.mjs", "venue": { "workflow": ".github/workflows/bin-tests.yml", @@ -909,7 +1094,9 @@ "dispatchable": true }, "status": "mapped", - "related_issues": [6081] + "related_issues": [ + 6081 + ] }, { "id": "scripts.direct-python", @@ -970,7 +1157,9 @@ }, { "id": "scripts.auto-format-workflow", - "paths": ["scripts/tests/test_auto_format_workflow.py"], + "paths": [ + "scripts/tests/test_auto_format_workflow.py" + ], "invocation": "python3 scripts/tests/test_auto_format_workflow.py", "venue": null, "status": "uncovered", @@ -997,7 +1186,9 @@ }, "status": "uncovered-in-fact", "phase3_issue": 6187, - "related_issues": [6034], + "related_issues": [ + 6034 + ], "reason": "Root flake check is not invoked by active nix-ci.yml, which evaluates outputs with nix eval." }, { @@ -1021,7 +1212,9 @@ }, { "id": "fleet.rust", - "paths": ["pkgs/fleet/crates/**/src/**"], + "paths": [ + "pkgs/fleet/crates/**/src/**" + ], "invocation": "cd pkgs/fleet && cargo test --workspace", "venue": null, "status": "uncovered", @@ -1030,7 +1223,9 @@ }, { "id": "web-gen-api.e2e", - "paths": ["pkgs/web-gen-api/end2end/tests/example.spec.ts"], + "paths": [ + "pkgs/web-gen-api/end2end/tests/example.spec.ts" + ], "invocation": "End-to-end package runner not confirmed", "venue": null, "status": "uncovered", @@ -1039,7 +1234,9 @@ }, { "id": "web-gen-api-axum.e2e", - "paths": ["pkgs/web-gen-api-axum/end2end/tests/example.spec.ts"], + "paths": [ + "pkgs/web-gen-api-axum/end2end/tests/example.spec.ts" + ], "invocation": "End-to-end package runner not confirmed", "venue": null, "status": "uncovered", @@ -1048,7 +1245,9 @@ }, { "id": "roc.cli-template", - "paths": ["pkgs/roc/platforms/rust-basic-cli-template/ci/all_tests.sh"], + "paths": [ + "pkgs/roc/platforms/rust-basic-cli-template/ci/all_tests.sh" + ], "invocation": "bash pkgs/roc/platforms/rust-basic-cli-template/ci/all_tests.sh", "venue": null, "status": "uncovered", @@ -1057,7 +1256,9 @@ }, { "id": "hello.nix-prelude", - "paths": ["pkgs/hello/nix-prelude/hello-nix-hello/main.rs"], + "paths": [ + "pkgs/hello/nix-prelude/hello-nix-hello/main.rs" + ], "invocation": "Rust test module; package invocation not confirmed", "venue": null, "status": "uncovered", @@ -1066,7 +1267,9 @@ }, { "id": "mcpx-fix-test-guard.shell", - "paths": [".github/scripts/check-mcpx-fix-test.test.sh"], + "paths": [ + ".github/scripts/check-mcpx-fix-test.test.sh" + ], "invocation": "bash .github/scripts/check-mcpx-fix-test.test.sh", "venue": { "workflow": ".github/workflows/mcpx-fix-test-guard.yml", @@ -1078,7 +1281,9 @@ }, { "id": "android-connectivity.manual-probe", - "paths": ["test-android-connectivity.sh"], + "paths": [ + "test-android-connectivity.sh" + ], "invocation": "bash test-android-connectivity.sh (manual device probe)", "venue": null, "status": "uncovered", @@ -1087,7 +1292,10 @@ }, { "id": "deploy.flake-checks", - "paths": ["pkgs/deploy/**", "lib/default.nix"], + "paths": [ + "pkgs/deploy/**", + "lib/default.nix" + ], "invocation": "nix build .#checks.x86_64-linux.deploy-list .#checks.x86_64-linux.deploy-list-malformed", "venue": { "workflow": ".github/workflows/deploy-flake-checks.yml", @@ -1096,7 +1304,9 @@ "dispatchable": true }, "status": "mapped", - "related_issues": [7322], + "related_issues": [ + 7322 + ], "notes": "Basic-tier PR gate for the deploy registry checks (#7322); before this workflow the two checks ran only in the full flake check on main / the nix-ci schedule." } ], diff --git a/.github/workflows/mcpx-test.yml b/.github/workflows/mcpx-test.yml index a3c43e947b..1335096f39 100644 --- a/.github/workflows/mcpx-test.yml +++ b/.github/workflows/mcpx-test.yml @@ -106,6 +106,8 @@ jobs: test -f pkgs/mcpx/scripts/tests/test_affected_embeds.py command -v git >/dev/null python3 -m unittest discover -s pkgs/mcpx/scripts/tests -p 'test_affected_embeds.py' -v + - name: Affected run-injection regressions (#5649) + run: python3 -m unittest discover -s pkgs/mcpx/scripts/tests -p test_affected_run_injection.py -v - name: Run-seed wrapper regressions (#1949) run: python3 -m unittest discover -s pkgs/mcpx/scripts/tests -p 'test_mcpx_test_seed.py' -v - name: Shard-packer discovery regressions (#6906) diff --git a/pkgs/mcpx/scripts/affected-tests.py b/pkgs/mcpx/scripts/affected-tests.py index a4863c8464..0cc23592b1 100755 --- a/pkgs/mcpx/scripts/affected-tests.py +++ b/pkgs/mcpx/scripts/affected-tests.py @@ -92,7 +92,9 @@ def run(cmd, cwd, check=True): - p = subprocess.run(cmd, cwd=cwd, capture_output=True, text=True) + p = subprocess.run( + cmd, cwd=cwd, capture_output=True, text=True, errors="surrogateescape" + ) if check and p.returncode != 0: sys.exit(f"command failed: {' '.join(cmd)}\n{p.stderr}") return p.stdout diff --git a/pkgs/mcpx/scripts/tests/test_affected_run_injection.py b/pkgs/mcpx/scripts/tests/test_affected_run_injection.py index ed9d02e189..2b3045fb72 100644 --- a/pkgs/mcpx/scripts/tests/test_affected_run_injection.py +++ b/pkgs/mcpx/scripts/tests/test_affected_run_injection.py @@ -102,6 +102,11 @@ def test_space_in_filename_stays_one_path(self): self.write_untracked("with space.go") proc = self.run_selector() self.assertEqual(proc.returncode, 0, msg=proc.stdout + proc.stderr) + # The whole path must appear in the executed commands: under + # whitespace splitting it fragmented, nothing was selected, + # and the old selector also exited zero. + self.assertIn("gofmt -l pkgs/mcpx/with space.go", proc.stdout) + self.assertIn("(cd pkgs/mcpx && go test -count=1 .)", proc.stdout) if __name__ == "__main__":