Skip to content

The agent that grows with you

fix(code-health): scripts/check also runs CI's case-collision, lazy-deps and profile-archive guards

Tekniumf98585d5cce0
diff --git a/scripts/check b/scripts/check
index 5538b7aba4b..934d600abbd 100755
--- a/scripts/check
+++ b/scripts/check
@@ -1,5 +1,7 @@
#!/usr/bin/env python3
-"""Run every blocking lint check CI runs, locally, with the same pinned tools.
+"""Run every blocking lint check CI runs, locally, with the same pinned tools: the lint
+workflow's guards, ruff and the code-health ratchet, plus the case-collision, lazy-deps and
+profile-archive guards that CI runs in workflows of their own.
python scripts/check # everything, against the merge-base with origin/main
python scripts/check --only health # just the code-health ratchet
@@ -55,13 +57,18 @@ exit $status
""",
}
-# name -> argv (relative to the repo root); mirrors the blocking steps in lint.yml.
+# name -> argv (relative to the repo root); mirrors the blocking steps in lint.yml, plus the
+# unconditional guards CI runs in their own workflows (case-collision-check.yml,
+# lazy-deps-guard.yml, profile-artifact-check.yml).
_GUARDS = {
"footguns": ["scripts/check-windows-footguns.py", "--all"],
"shebangs": ["scripts/check_bash_shebangs.py"],
"no-tmp": ["scripts/check_no_tmp_literals.py"],
"config-writers": ["scripts/check_config_yaml_writers.py"],
"os-marker-fakes": ["scripts/ci/check_os_marker_fakes.py"],
+ "case-collisions": ["scripts/check-case-collisions.py"],
+ "lazy-deps": ["scripts/ci/check_lazy_deps_imports.py"],
+ "profile-archives": ["scripts/ci/check_profile_archive_boundary.py"],
}
_CHECKS = (*_GUARDS, "ruff", "health")
diff --git a/tests/scripts/test_code_health_cli.py b/tests/scripts/test_code_health_cli.py
index 3454cb01613..3f2d4b85577 100644
--- a/tests/scripts/test_code_health_cli.py
+++ b/tests/scripts/test_code_health_cli.py
@@ -203,6 +203,24 @@ def test_a_branch_cannot_relax_its_own_switch(tmp_path, monkeypatch, capsys):
assert cli.main([]) == 1, capsys.readouterr().out
+# --- m4: the CI guards that ran outside the lint workflow --------------------------------------
+
+
[email protected]("job, files", [
+ ("case-collisions", {"pkg/Notes.md": "a\n", "pkg/NOTES.md": "b\n"}),
+ ("lazy-deps", {"pkg/uses.py": "import tools.lazy_deps\n"}),
+ ("profile-archives", {"pkg/export.tar.gz": "not really\n"}),
+])
+def test_ci_only_guards_run_in_scripts_check(tmp_path, job, files):
+ repo = _engine_repo(tmp_path)
+ clean = _check(repo, "--staged", "--only", job, "--base", "HEAD")
+ assert clean.returncode == 0 and "1 checks, ok" in clean.stdout, clean.stdout + clean.stderr
+ _write(repo, files)
+ _git(repo, "add", "--", *files)
+ proc = _check(repo, "--staged", "--only", job, "--base", "HEAD")
+ assert proc.returncode == 1 and f"FAILED: {job}" in proc.stdout, proc.stdout + proc.stderr
+
+
# --- F21: profile regex rules see executable code, not prose -----------------------------------