Repository navigation
test(ci): regression-test the Python complexity ratchet (#1639) - #1911
Merged
Merged
Conversation
#1639 rolled out the workspace lint inheritance and the C901/RUF100 Python ratchet, but `ci/check_python_complexity.py` had no test: the workflow ran the script and nobody would notice a loosened ceiling, a dropped rule, or a file-selection change that stopped covering the scripts unittest discovery skips. Split the script into its testable seams (`tracked_python_files`, `ruff_command`, `check`) with unchanged behaviour (same exit code, same ruff output stream) and add `ci/test_check_python_complexity.py`: - a module under the ceiling passes, an 11-decision function fails C901; - an unnecessary `# noqa: C901` fails RUF100 (the AC that obsolete suppressions must fail once they are no longer needed); - the policy itself is parsed from `pyproject.toml` and pinned to `select = ["C901", "RUF100"]` + `max-complexity = 10`; - tracked file selection still covers discovery-excluded scripts such as `ci/build_backend.py`, and an empty repository is an error; - `origin/main` satisfies its own ratchet. The module is registered in both entry points (`ci/local_suites.py` `DRIFT_UNITTEST_MODULES` and the `ci-workflow-drift.yml` step), so the parity guard in `ci.test_local_suites` keeps them agreeing. RED verified by loosening the policy in-place: ceiling 10 -> 20 makes the C901 test fail (0 == 0), dropping RUF100 makes the obsolete-noqa test fail. Restored, then 7/7 green; the full hosted self-test set is 103 tests OK.
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the
|
`origin/main` (8658292) does not satisfy `soldr fmt --check`: two `assert!` calls in `bench/fastled-examples/src/build_comparison_tests.rs` landed unformatted with the bench merges, so the `Formatting` job fails on every PR regardless of its own content (observed on #1911). Pure rustfmt output: no token or semantic change, 10 insertions / 4 deletions. `soldr fmt --check` is clean afterwards.
`origin/main` (8658292) is red on `dylint / Dylint Full` as well as `Formatting`: the bench merges left two raw `".fbuild"` literals, which `ban_raw_fbuild_path` denies, so the workspace-wide dylint passes on no PR at all: error: raw '.fbuild' path literal: use fbuild_paths (FBUILD_DIR_NAME, BUILD_DIR_NAME, get_project_fbuild_dir, ...) instead of spelling the directory layout by hand --> bench/fastled-examples/src/build_comparison.rs:1008:38 --> bench/fastled-examples/src/build_comparison_tests.rs:282:43 Use the sanctioned `fbuild_paths::get_project_fbuild_dir(&Path)` in both the production `cold_cleanup_steps` arm and its test expectation, so the two cannot drift apart either. Verified: `soldr cargo check --manifest-path bench/fastled-examples/ Cargo.toml --tests` rc 0; the two affected tests pass (2 passed, 0 failed); `soldr fmt --check` clean.
github-merge-queue
Bot
removed this pull request from the merge queue due to failed status checks
Nov 5, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
#1639rolled out the workspace lint inheritance (all 21 members) and the PythonC901/RUF100ratchet, butci/check_python_complexity.pyshipped with notest at all —
git grep check_python_complexityfound it only inci/README.mdandcheck-ubuntu.yml. Nothing would fail if someone raisedmax-complexity, droppedRUF100fromselect, or broke thegit ls-filesselection so the discovery-excluded scripts stopped being covered. Two of
#1639's acceptance criteria ("focused real linter regressions for a newoffender and obsolete suppression", "all tracked Python files are scanned,
including discovery-excluded scripts") were therefore unguarded assertions.
What
ci/check_python_complexity.py: split into its testable seams with unchangedbehaviour — same exit code, same ruff invocation, ruff output still streamed
uncaptured:
tracked_python_files(root)—git ls-files -z -- '*.py', raisesRatchetErroron a git failure or an empty list;ruff_command(paths)— the pinnedruff==0.12.12invocation;check(root)— the entry pointmain()now delegates to.New
ci/test_check_python_complexity.py(134 LOC, 7 tests):C901# noqa: C901fails, output namesRUF100pyproject.toml==["C901","RUF100"]@ 10ci/build_backend.pyRatchetErrorcheck(origin/main tree) == 0Registered in both entry points —
ci/local_suites.py(
DRIFT_UNITTEST_MODULES) and theci-workflow-drift.ymlunittest step — soci.test_local_suites' parity guard keeps hosted and local runs agreeing(the
#1855two-face failure class).Evidence
RED, by loosening the policy in place in the worktree and restoring it:
GREEN on the unchanged policy:
No Rust touched, no new workflow, no threshold raised, no
noqaadded; thesuite is 0.4 s (ruff runs from the uv cache) so it costs the drift job nothing.
Refs
#1639.Second commit: unblock
Formattingfor every PRorigin/main(86582926) does not satisfysoldr fmt --check:bench/fastled-examples/src/build_comparison_tests.rshas two unformattedassert!calls from the recent bench merges, so the
Formattingjob fails on every PRregardless of its own content (hit #1911 first).
002eb367is pure rustfmt output(10 insertions / 4 deletions, no token or semantic change);
soldr fmt --checkisclean afterwards. Flagging it here rather than in a separate PR because a separate PR
would be blocked by the same job.
Third commit: unblock
Dylint Fullfor every PRorigin/main(86582926) is red on two jobs, both from the bench merges:Formatting(fixed by002eb367) anddylint / Dylint Full, which fails thewhole workspace with
main's own runs confirm it (41980867753 failure Dylint,41980867621 failure Formatting), so no PR can be green until this lands.127fd3d7replaces bothliterals with the sanctioned
fbuild_paths::get_project_fbuild_dir(&Path)— whichalso makes the production cleanup step and its test expectation share one call
instead of two hand-spelled paths.
Verified:
soldr cargo check --manifest-path bench/fastled-examples/Cargo.toml --testsrc 0;cargo test --bin bench-build-comparison -- cold_removes remove_cache_entries→ 2 passed, 0 failed;soldr fmt --checkclean.