Skip to content

The agent that grows with you

fix(ci): declare the rust lane on the detect job, and test that wiring

Brooklyn Nicholsondd1e5b723da2
diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml
index 71756b3acba..e2660cc4a6b 100644
--- a/.github/workflows/ci.yaml
+++ b/.github/workflows/ci.yaml
@@ -49,6 +49,7 @@ jobs:
uv_lock: ${{ steps.classify.outputs.uv_lock }}
npm_lock: ${{ steps.classify.outputs.npm_lock }}
installer: ${{ steps.classify.outputs.installer }}
+ rust: ${{ steps.classify.outputs.rust }}
docker_meta: ${{ steps.classify.outputs.docker_meta }}
mcp_catalog: ${{ steps.classify.outputs.mcp_catalog }}
ci_review: ${{ steps.classify.outputs.ci_review }}
diff --git a/tests/ci/test_classify_changes.py b/tests/ci/test_classify_changes.py
index 29095ffff00..4902cbafc28 100644
--- a/tests/ci/test_classify_changes.py
+++ b/tests/ci/test_classify_changes.py
@@ -8,6 +8,7 @@ change could have broken.
from __future__ import annotations
import importlib.util
+import re
from pathlib import Path
import pytest
@@ -240,6 +241,55 @@ def test_classify(files, expected):
assert classify(files) == expected
+_REPO = Path(__file__).resolve().parents[2]
+
+
+def _yaml(rel: str) -> dict:
+ yaml = pytest.importorskip("yaml")
+ return yaml.safe_load((_REPO / rel).read_text(encoding="utf-8"))
+
+
+def test_every_lane_reaches_the_composite_action():
+ """The action is the one surface every consumer reads, so it must carry all
+ of them — ci.yaml, nix.yml and docker.yml each re-export a different subset.
+ """
+ lanes = set(classify(["run_agent.py"]))
+ action_outputs = set(_yaml(".github/actions/detect-changes/action.yml")["outputs"])
+ assert lanes - action_outputs == set(), "lane(s) missing from the composite action's outputs"
+
+
+def test_ci_jobs_only_gate_on_detect_outputs_that_detect_actually_declares():
+ """An ``if`` that reads an undeclared output resolves to the empty string.
+
+ The lane then reports "skipping" on every PR, forever, and nothing goes red
+ — there is no error for referencing an output a job never declared. That is
+ exactly how the ``rust`` lane shipped dead: the classifier emitted it and
+ the composite action re-exported it, but ci.yaml's ``detect`` job did not,
+ so ``needs.detect.outputs.rust`` was never anything but "".
+ """
+ ci = _yaml(".github/workflows/ci.yaml")
+ declared = set(ci["jobs"]["detect"]["outputs"])
+
+ referenced: set[str] = set()
+ for job in ci["jobs"].values():
+ for expr in _iter_if_expressions(job):
+ referenced.update(re.findall(r"needs\.detect\.outputs\.(\w+)", expr))
+
+ assert referenced, "found no detect-gated jobs — the walk is broken, not the wiring"
+ assert referenced - declared == set(), "job(s) gate on an output detect never declares"
+
+
+def _iter_if_expressions(job: object):
+ """Yield every ``if:`` string in a job, including inside its steps."""
+ if not isinstance(job, dict):
+ return
+ if isinstance(cond := job.get("if"), str):
+ yield cond
+ for step in job.get("steps", []) or []:
+ if isinstance(step, dict) and isinstance(cond := step.get("if"), str):
+ yield cond
+
+
def test_ci_review_files_returns_only_sensitive_paths_sorted_and_unique():
assert ci_review_files([
"apps/desktop/src/app.tsx",