You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
chore(ci): adopt inherited function complexity ratchets (RUST-018/PY-004) #1639
The complexity-ratchet follow-up from forge-ci/ci.yml#229 lists fbuild as unfinished. Verified current main971efdf2bc83bde4ea13dc9114169827ee344d4f with ci-lint complexity: workspace cognitive_complexity/too_many_lines are unset, all21 members lack workspace lint inheritance, and Python has no Ruff configuration. Existing check-ubuntu.yml runs full workspace/all-target Clippy with -D warnings; no new Rust lint pass is necessary. Python CI scripts currently have no complexity ratchet.
Proposal
Enable RUST-018 inherited workspace lints at default25/100 ceilings and PY-004 C901=10/RUF100 across every tracked Python CI/packaging/hook file. Measure existing offenders and record only per-function #[expect(..., reason=...)] or line-level noqa. Baseline suppressions must fail when no longer needed. Preserve current warnings and complete PR/local workflow commands; add Python checking to an existing workflow, never a new workflow file.
Acceptance criteria
RED→GREEN current static findings, plus focused real linter regressions for a new offender and obsolete suppression.
Inheritance reaches all21 declared workspace members; validate actual applicable cfg/platform offenders without selecting unrelated extra native PR coverage.
All tracked Python files are scanned, including discovery-excluded scripts; no whole-file/per-file waivers or raised thresholds. Record before/after debt counts.
Same primary code review, source-bound declared local gate via Bosn→pinned act2, unchanged required remote jobs and full release coverage. Verify command/run evidence, not configuration alone.
Preserve Cargo/toolchain/dependency/profile/board coverage; retain Fbuild module/crate policy and use soldr/uv.
Decisions
Implement one fleet rollout PR here; hotspot paydown stays separate one-function PRs. This is confirmed configuration debt, not a claim about PR performance or missing tests. No new workflow or crate.
Verified origin/main (86582926) against the acceptance criteria — the rollout itself is landed, and the one unguarded cell is now covered by PR #1911.
Landed on main (code evidence):
RUST-018 inheritance reaches every member: [workspace.lints.clippy] pins cognitive_complexity/too_many_lines (= "warn" at clippy's defaults 25/100), and all 21 declared members carry [lints] workspace = true (git ls-tree -r --name-only origin/main | grep Cargo.toml → 21 crates + root).
Baseline debt recorded as #[expect(..., reason = "baseline, zackees/ci.yml#229")] — 145 hits; #[expect] (not #[allow]) means an obsolete suppression becomes unfulfilled_lint_expectations, and CI's -D warnings makes it fatal.
PY-004: pyproject.toml[tool.ruff.lint] select = ["C901","RUF100"], [tool.ruff.lint.mccabe] max-complexity = 10; ci/check_python_complexity.py enumerates git ls-files -z -- '*.py' (100 tracked files, so discovery-excluded scripts such as ci/build_backend.py are scanned); wired into the existing check-ubuntu.yml step (Check Python complexity ratchet) — no new workflow.
Gap that was open:ci/check_python_complexity.py had no test — git grep found it only in ci/README.md and check-ubuntu.yml, so "focused real linter regressions for a new offender and obsolete suppression" and the file-selection criterion were unguarded assertions. Raising max-complexity, dropping RUF100, or breaking the ls-files selection would have changed policy silently.
Now covered by PR #1911 (agent/1639-python-complexity-ratchet-tests, unmerged): the script is split into tracked_python_files / ruff_command / check with unchanged behaviour, and ci/test_check_python_complexity.py (7 tests) asserts: clean module passes; an 11-decision function fails C901; an unnecessary # noqa: C901 fails RUF100; the policy parses to exactly ["C901","RUF100"] @ 10; the tracked list still contains ci/build_backend.py; an empty repo raises RatchetError; main satisfies its own ratchet. Registered in both entry points (ci/local_suites.py + ci-workflow-drift.yml), so ci.test_local_suites' parity guard holds.
RED proof: max-complexity 10→20 → C901 must reject complexity 12 FAILED; select ["C901","RUF100"]→["C901"] → an unnecessary noqa must fail the ratchet FAILED. Restored → 7/7 OK, hosted self-test set 103 tests OK, 100-file ratchet All checks passed!.
Still open (not mine to close here): the "source-bound declared local gate via Bosn→pinned act2" cell is #1635/#1793 territory (the lint lane is still opt-in in ci/local_gate.py pending the RUST-033 warm-run measurement), and hotspot paydown stays separate. Leaving this issue open until #1911 merges.
Final cell of this issue closed: PR #1911 merged (678e4ad5), and the follow-on hook fix #1912 (e25dd466) removed the last unguarded copy of the same policy — ci/hooks/crate_guard.py now denies/authors only what Cargo.toml declares, asserted by ci/test_crate_guard_parity.py.
The one acceptance criterion still not satisfied by code is "source-bound declared local gate via Bosn -> pinned act2", which is tracked by #1793 / #1643 (owner-driven lint lane warm-run measurement), not by this issue. Keeping this open only for that cross-reference.
Verified complete on main @ 6e5be796 (2026-11-08) — no code change needed
Audited every acceptance criterion against origin/main. All are satisfied by the ratchet PR #1640 plus the guard PR #1931; the debits are at zero today.
RUST-018 — inherited workspace lints
Cargo.toml[workspace.lints.clippy] declares cognitive_complexity = "warn" and too_many_lines = "warn" at the default 25/100 ceilings (thresholds not raised), alongside the await-holding / large_futures denies.
Every one of the 21 declared workspace members declares [lints] workspace = true — parsed all 21 member manifests, 0 missing.
Guard in an already-invoked script (no new workflow, no new job): ci/check_workspace_crates.py fails if a member stops inheriting, or if a ratchet lint is dropped or loosened.
uv run --no-project python ci/check_workspace_crates.py -> OK: 21 approved workspace members, no new crates, all inherit the workspace lints. (rc 0)
uv run --no-project python -m unittest ci.test_crate_guard_parity -> Ran 14 tests ... OK
Baseline suppressions: 104 function-level #[expect(clippy::…, reason = "…")] (34 cognitive_complexity + 70 too_many_lines), 0 without a reason. The gating linux / Check runs clippy with -D warnings, so unfulfilled_lint_expectations turns a stale suppression into a failure — the "obsolete suppression must fail" direction is real, not a note.
PY-004 — Python complexity ratchet
pyproject.toml: [tool.ruff.lint] select = ["C901", "RUF100"] (exactly those two), [tool.ruff.lint.mccabe] max-complexity = 10. No per-file-ignores, no whole-file # ruff: noqa.
Coverage is git ls-files '*.py' — this includes scripts normal discovery skips (ci/build_backend.py, hooks), pinned to ruff==0.12.12.
Added to an existing workflow: .github/workflows/check-ubuntu.yml:112 runs uv run --no-project python ci/check_python_complexity.py. No new workflow file.
Current debt: ruff check over every tracked Python path -> All checks passed!; ci/check_python_complexity.py rc 0.
Guard: ci/test_check_python_complexity.py (7 tests, Ran 7 tests ... OK) asserts the selected rule set is exactly C901+RUF100 (a loosened threshold or dropped rule is a test failure) and that an unnecessarynoqa fails the ratchet via RUF100.
Unchanged by this work: required remote jobs, board matrix coverage, release coverage, crate/module policy, soldr/uv entry points.
Closing as complete. Re-open conditions if this is judged insufficient: a workspace member stops inheriting lints (guard fires first), or a new tracked Python file ships an offence (ratchet fires first) — both fail CI before they can land.
Activity
zackees commentedon Nov 5, 2026
Verified
origin/main(86582926) against the acceptance criteria — the rollout itself is landed, and the one unguarded cell is now covered by PR #1911.Landed on main (code evidence):
[workspace.lints.clippy]pinscognitive_complexity/too_many_lines(= "warn"at clippy's defaults 25/100), and all 21 declared members carry[lints] workspace = true(git ls-tree -r --name-only origin/main | grep Cargo.toml→ 21 crates + root).#[expect(..., reason = "baseline, zackees/ci.yml#229")]— 145 hits;#[expect](not#[allow]) means an obsolete suppression becomesunfulfilled_lint_expectations, and CI's-D warningsmakes it fatal.pyproject.toml[tool.ruff.lint] select = ["C901","RUF100"],[tool.ruff.lint.mccabe] max-complexity = 10;ci/check_python_complexity.pyenumeratesgit ls-files -z -- '*.py'(100 tracked files, so discovery-excluded scripts such asci/build_backend.pyare scanned); wired into the existingcheck-ubuntu.ymlstep (Check Python complexity ratchet) — no new workflow.Gap that was open:
ci/check_python_complexity.pyhad no test —git grepfound it only inci/README.mdandcheck-ubuntu.yml, so "focused real linter regressions for a new offender and obsolete suppression" and the file-selection criterion were unguarded assertions. Raisingmax-complexity, droppingRUF100, or breaking thels-filesselection would have changed policy silently.Now covered by PR #1911 (
agent/1639-python-complexity-ratchet-tests, unmerged): the script is split intotracked_python_files/ruff_command/checkwith unchanged behaviour, andci/test_check_python_complexity.py(7 tests) asserts: clean module passes; an 11-decision function fails C901; an unnecessary# noqa: C901fails RUF100; the policy parses to exactly["C901","RUF100"]@ 10; the tracked list still containsci/build_backend.py; an empty repo raisesRatchetError; main satisfies its own ratchet. Registered in both entry points (ci/local_suites.py+ci-workflow-drift.yml), soci.test_local_suites' parity guard holds.RED proof:
max-complexity 10→20→C901 must reject complexity 12FAILED;select ["C901","RUF100"]→["C901"]→an unnecessary noqa must fail the ratchetFAILED. Restored → 7/7 OK, hosted self-test set 103 tests OK, 100-file ratchetAll checks passed!.Still open (not mine to close here): the "source-bound declared local gate via Bosn→pinned act2" cell is #1635/#1793 territory (the
lintlane is still opt-in inci/local_gate.pypending the RUST-033 warm-run measurement), and hotspot paydown stays separate. Leaving this issue open until #1911 merges.zackees commentedon Nov 5, 2026
Final cell of this issue closed: PR #1911 merged (
678e4ad5), and the follow-on hook fix #1912 (e25dd466) removed the last unguarded copy of the same policy —ci/hooks/crate_guard.pynow denies/authors only whatCargo.tomldeclares, asserted byci/test_crate_guard_parity.py.The one acceptance criterion still not satisfied by code is "source-bound declared local gate via Bosn -> pinned act2", which is tracked by #1793 / #1643 (owner-driven
lintlane warm-run measurement), not by this issue. Keeping this open only for that cross-reference.zackees commentedon Nov 8, 2026
Verified complete on
main@6e5be796(2026-11-08) — no code change neededAudited every acceptance criterion against
origin/main. All are satisfied by the ratchet PR #1640 plus the guard PR #1931; the debits are at zero today.RUST-018 — inherited workspace lints
Cargo.toml[workspace.lints.clippy]declarescognitive_complexity = "warn"andtoo_many_lines = "warn"at the default 25/100 ceilings (thresholds not raised), alongside the await-holding /large_futuresdenies.[lints] workspace = true— parsed all 21 member manifests, 0 missing.ci/check_workspace_crates.pyfails if a member stops inheriting, or if a ratchet lint is dropped or loosened.uv run --no-project python ci/check_workspace_crates.py->OK: 21 approved workspace members, no new crates, all inherit the workspace lints.(rc 0)uv run --no-project python -m unittest ci.test_crate_guard_parity->Ran 14 tests ... OK#[expect(clippy::…, reason = "…")](34cognitive_complexity+ 70too_many_lines), 0 without a reason. The gatinglinux / Checkruns clippy with-D warnings, sounfulfilled_lint_expectationsturns a stale suppression into a failure — the "obsolete suppression must fail" direction is real, not a note.PY-004 — Python complexity ratchet
pyproject.toml:[tool.ruff.lint] select = ["C901", "RUF100"](exactly those two),[tool.ruff.lint.mccabe] max-complexity = 10. Noper-file-ignores, no whole-file# ruff: noqa.git ls-files '*.py'— this includes scripts normal discovery skips (ci/build_backend.py, hooks), pinned toruff==0.12.12..github/workflows/check-ubuntu.yml:112runsuv run --no-project python ci/check_python_complexity.py. No new workflow file.ruff checkover every tracked Python path ->All checks passed!;ci/check_python_complexity.pyrc 0.ci/test_check_python_complexity.py(7 tests,Ran 7 tests ... OK) asserts the selected rule set is exactlyC901+RUF100(a loosened threshold or dropped rule is a test failure) and that an unnecessarynoqafails the ratchet viaRUF100.Unchanged by this work: required remote jobs, board matrix coverage, release coverage, crate/module policy,
soldr/uventry points.Closing as complete. Re-open conditions if this is judged insufficient: a workspace member stops inheriting lints (guard fires first), or a new tracked Python file ships an offence (ratchet fires first) — both fail CI before they can land.