Repository navigation
Description
Decision (owner, 2026-10-22)
This section replaces any text below that conflicts with it. It folds in the item "ci(lint): new swallowed failures, over-cap functions and suppressions fail per changed line, replacing the C901 ceiling and the swallowed-failures baseline".
Gate
- A
diff-qualityrow indevops cifails any changed line that adds a violation ofC901,BLE001,S110,S112,E402,F401,SIM115,UP036orN803. The row uses--ignore-noqa. A new site fails even when it carries a reason. The row needs no baseline file. - The 488 existing sites (414
BLE001, 57S110, 17S112) need no edit. - The baseline
tests/fixtures/swallowed_failures_ceilings.json,tests/test_swallowed_failures_ratchet.pyand the seven Ruffnoqaceilings are deleted. - The 29 unread
check=Falsesites becomecheck=Truewith handling ofCalledProcessError. An ast-grep rule banscheck=False.
Plan for the BLE rules
- The gate lands. A new blind handler fails the pull request.
- Each pull request that touches a file with a site fixes the site. The fix narrows the exception tuple, or handles the error. Best-effort cleanup narrows to the exceptions it can meet, for example
OSError. Cluster pull requests burn down the rest, one package at a time. - When the count is 0, add
BLE001,S110andS112toselectinpyproject.toml. Remove them from the--selectlist of the diff row. - The CLI boundary of the exception item (
refactor(exceptions): validators and library calls raise their own exceptions, the CLI boundary maps them and DevOpsCLIError bounds details once) is the one handler that stays broad.
Changes to the criteria below
- Criterion 1 (triage of the 501 sites) continues in the burn-down pull requests. It does not block the gate.
- Criterion 3 (a
# noqa: BLE001with a reason on each retained handler) no longer applies. A blind handler on a changed line fails the gate. - Criterion 5 (BLE001 as a hard rule) happens at step 3 of the plan.
- Criterion 6 (updated ceilings) no longer applies. The baseline is deleted.
Tests
- A
tmp_pathgit repository with a base commit and a branch. A newexcept Exception:fails, and so does a new# noqa: C901function. A compliant branch passes. - An ast-grep rule test for
check=False.
Dependencies
- refactor(ci): Ruff's own flags protect the complexity cap, and the configuration-escape tests and key allowlists are deleted
Acceptance criteria for this decision
- A new
except Exception:on a changed line failsdevops ci, even with# noqa: BLE001. - The baseline file and the swallowed-failures test are gone. The 488 existing sites are unchanged.
- No
check=Falseremains insrc/. The ast-grep rule reports 0 findings. - The pull request reports a replay of the gate over the last 20 merged pull requests.
-
uv run devops cipasses.
Context & Rationale
501 BLE001 sites exist across src/, of which 77 are except Exception: pass. Some are legitimate best-effort cleanup; the problem is that nothing distinguishes those from the ones swallowing a defect, and a handler that has never been entered is indistinguishable from one that works. A handler in the workbench of the companion vibes repository referenced an undefined name and could only ever raise NameError; it survived precisely because no test forced the branch.
Scope & Deliverables
- Context & Rationale*: 501
BLE001sites exist acrosssrc/, of which 77 areexcept Exception: pass. Some are legitimate best-effort cleanup; the problem is that nothing distinguishes those from the ones swallowing a defect, and a handler that has never been entered is indistinguishable from one that works. A handler in the workbench of the companionvibesrepository referenced an undefined name and could only ever raiseNameError; it survived precisely because no test forced the branch. - Deliverable*: Enable
BLE001, triage the surface, and require every retained blind handler to carry an explicit# noqa: BLE001with a justification and to narrow its exception tuple where the failure modes are known. Every handler written to degrade gracefully needs a test that forces it. - Constraint*: Triage before enforcement. Turning the rule on against 501 sites without a policy produces one large suppression commit, which is the same silence with more ceremony.
Strategic Alignment
Proposed design
Problem statement
The codebase contains 501 BLE001 (blind exception handling) sites. Some are legitimate best-effort cleanup, but nothing distinguishes them from handlers that silently swallow real defects. A handler that has never been entered is indistinguishable from one that works.
Acceptance criteria
- Criterion 1: A new
except Exception:on a changed line failsdevops ci, even with# noqa: BLE001.
Verification: Runuv run devops ciand introduce a newexcept Exception: passin a changed line; the CI should fail. - Criterion 2: The baseline file and the swallowed-failures test are gone. The 488 existing sites are unchanged.
Verification: Verify thattests/fixtures/swallowed_failures_ceilings.json,tests/test_swallowed_failures_ratchet.pyand the seven Ruffnoqaceilings are deleted, and the 488 existing sites remain unchanged. - Criterion 3: No
check=Falseremains insrc/. The ast-grep rule reports 0 findings.
Verification: Run an ast-grep rule test forcheck=Falseand verify it reports 0 findings. Also confirm that nocheck=Falseexists insrc/. - Criterion 4: The pull request reports a replay of the gate over the last 20 merged pull requests.
Verification: Check that the pull request includes a replay of the gate over the last 20 merged pull requests as part of its CI checks. - Criterion 5:
uv run devops cipasses.
Verification: Runuv run devops ciand confirm it passes without any failures.
Key questions
- Is BLE001 already counted by the existing swallowed-failures ratchet test?: Yes. Issue test(cli): swallowed failures may not grow: blind excepts, except-pass, except-continue and unread check=False are held at their ceilings #1347 (Done in v0.2.33) established tests/test_swallowed_failures_ratchet.py, which counts Ruff's BLE001, S110, and S112 findings per file against ceilings in tests/fixtures/swallowed_failures_ceilings.json. A file not listed has a ceiling of 0. [sources: CHANGELOG.md:19]
- Is BLE001 already present in the review's advisory rule set?: Yes. Issue feat(review): ruff and mypy run as review evidence with the project's settings, advisory rules report only on changed lines, and changed functions show complexity before and after #873 (Done in v0.2.33) added BLE001 to .devops/review.toml's [advisory] rules, so reviews already surface it as an advisory finding on changed lines. [sources: CHANGELOG.md:17]
- What is the triage policy for categorizing the 501 BLE001 sites?: Each site is categorized as one of: (a) legitimate best-effort cleanup where a broad catch is the correct design (suppress with justification), (b) a defect where the handler swallows a real error (fix by narrowing the tuple or adding proper handling), or (c) a handler whose exception tuple is broader than the failure modes it actually handles (narrow the tuple). The constraint is that triage must precede enforcement to avoid one large suppression commit. (proposed)
- What format should the noqa suppression and its justification take?: Each retained site carries
# noqa: BLE001on the except line, followed by a comment that names the specific reason the broad catch is necessary (e.g., best-effort temp-file cleanup, optional dependency probe). The justification must be specific enough that a reviewer can judge whether the broad catch is warranted without reading the surrounding code. (proposed) - What test pattern is required for a handler written to degrade gracefully?: A test that raises the specific exception the handler catches (via a mock, fixture, or direct call) and asserts the handler's observable behavior: that it logs, returns a default value, continues execution, or otherwise degrades as designed. The test must force the except branch to execute; a test that only exercises the happy path does not satisfy the requirement. (proposed)
Open questions
- Does this work depend on any other open issue? (missing verified source)
Fit
Needs splitting into 3 items:
- Triage: categorize all 501 BLE001 sites as legitimate, defect, or needs-narrowing, and record the policy decision for each
- Fix and test: narrow exception tuples at defect sites, add proper error handling where the handler was swallowing a real error, and write tests that force every graceful-degradation except branch to execute
- Suppress and enable: add
# noqa: BLE001with a justification comment at every legitimate site, update the ratchet ceilings in tests/fixtures/swallowed_failures_ceilings.json, and enable BLE001 as a hard rule in the project's Ruff configuration
Suspected block
None.
Dependencies
None.
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsDone
Activity
dan-petty commentedon Sep 30, 2026
Moved from v0.2.25 to the backlog. v0.2.25 is capped at 12 items (#740), and only the next two planned releases keep a milestone (#739), so P2 items wait in the backlog until reprioritization pulls them in.
dan-petty commentedon Oct 2, 2026
More evidence for this issue from the devsecops review session
20261001-224227(2026-10-02). Each finding below was triaged againstrelease/v0.2.25(c279c18), judged real and covered by this issue, and then upheld by a second agent that tried to refute it.src/devops_cli/ai/spend/prometheus.py:146, re-rated LOW): The handler isexcept Exception: return ""aroundactive_ledger.get_lifetime_report(...)(139-147), with no log. A SQLite error, a pricing-registry failure or a plain bug makesdevops ai cost prometheus(ai_cost.py:558-563) print nothing and exit 0. The/metricsroute (server/routes/telemetry.py:87-89) silently drops every devops_cli_ai_* series. That is a real hidden failure but minor, not 'catastrophic'. Issue feat(cli): blind exception handling policy #423 (blind exception handling policy) covers exactly theseexcept Exceptionswallow sites: narrow the tuple, justify, and test the degrade path. BLE001 is not enabled yet.src/devops_cli/ai/test_gen.py:74, re-rated LOW):try: tree = ast.parse(...) ... except Exception: pass(58-75) swallows a SyntaxError in the target. The function then falls through to the 'default_behavior' import test (77-83), and the CLI prints '✓ Synthesized 1 unit test(s)' (commands/ai.py:1933) for a file it could not parse. This is a real hidden failure with low impact (the status is already UNEXECUTED). It is one of theexcept Exception: passsites that feat(cli): blind exception handling policy #423 (blind exception handling policy) triages. The generator itself is being reworked to scaffolds under fix(ai):devops ai test-genstops reporting presence-only tests as synthesized unit tests #856.dan-petty commentedon Oct 8, 2026
Linked: #1347 holds BLE001, S110 and S112 at per-file ceilings until this item lowers them, and #849 counts the
# noqa: BLE001markers this item adds. Found by the 2026-10-08 backlog review.5 remaining items
dan-petty commentedon Oct 22, 2026
Proposal needs splitting into 3 items at ae8c2d9 (see proposed design in issue body).
dan-petty commentedon Oct 23, 2026
Proposal needs splitting into 3 items at 4bb052c (see proposed design in issue body).
feat(ci): blind exception handling policy (#423)
feat(ci): blind exception handling policy (#423)
feat(ci): blind exception handling policy (#423)
feat(ci): blind exception handling policy (#423)
dan-petty commentedon Oct 24, 2026
Cancelled: policy is brittle with excessive maintenance friction across shallow checkouts and concurrent rebases.