Skip to content

Enable ruff BLE001/S110/S112: no silent except - #729

Open
napetrov wants to merge 15 commits into
intel:mainfrom
napetrov:napetrov/blind-except-gate
Open

napetrov wants to merge 15 commits into
intel:mainfrom
napetrov:napetrov/blind-except-gate

Conversation

@napetrov

@napetrov napetrov commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

Enable ruff BLE001, S110 and S112, so a new except Exception that neither re-raises nor logs its traceback fails lint, as does an except whose body is only pass/continue.

Changes

  • Narrowed: llm_json.py (4 sites) now catches (ValueError, RecursionError), the errors json.loads raises, instead of Exception: pass. novelty/measure.py catches ValueError from parse_json_object. A bug in these helpers is no longer read as "no JSON here".
  • Now logged:
    • eval/arms_run.py: an unresolved library id logs a warning with its traceback before the arm falls back to the product name.
    • mcp/mcp_protocol.py: a failed tool listing is logged with logger.exception.
    • personas/analyzer.py: a failed issue fetch per label is logged.
  • Kept catch-alls (~47): each one gets # noqa: BLE001 - <what happens to the failure>. Examples: logged and skipped, stored on the row, re-asked, a connection check answers False.
  • tests/test_noqa_reasons.py: ruff accepts a bare # noqa: BLE001, so this test fails a noqa for those three codes that has no reason of at least two words.
  • AGENTS.md: the rule. Changelog fragment added.

Notes

  • The deferred-rules comment in pyproject.toml no longer lists BLE001: the block is two lines now (AGENTS.md), and BLE001 is out of lint.external.
  • Follow-up: a codeless # noqa still silences everything, and neither ruff nor this test catches it. Enabling PGH004 would close that. It may flag other lines, so it is not done here.

Testing

  • ruff check is clean over the tree, and tests/test_noqa_reasons.py passes (6 tests).
  • I ran the full pytest on Windows, on main and on this branch:
    • main: 562 failures (symlink, Docker and path tests);
    • this branch: 583 failures.
    • Every failure only on this branch passed on rerun except one. That one is test_catalog_discovered_task_runs_through_tasks_cli_dry_run, which hit WinError 206 (path too long) because the worktree path is longer; it passes on main.
  • mypy shows 14 errors that occur only on Windows (resource, os.getgid, SIGKILL), all in files this PR does not touch. Linux CI is the authority for both.
  • The local review covered a fresh-context self-review of the diff: the narrowed handlers, the logger names, the noqa reasons against their handler bodies, and the test's regex edge cases. It found no blocking issues, and its two nits are fixed.

🤖 Generated with Claude Code

Narrow the JSON-parse handlers to the errors json.loads raises, log the
fallbacks in arms_run, mcp_protocol and the persona analyzer, and give every
remaining catch-all a noqa reason; tests/test_noqa_reasons.py fails a bare one.

Signed-off-by: Petrov, Nikolay A <nikolay.a.petrov@intel.com>
…ators

Signed-off-by: Petrov, Nikolay A <nikolay.a.petrov@intel.com>
@napetrov
napetrov requested a review from a team as a code owner November 13, 2026 21:27
Copilot AI balanced review requested due to automatic review settings November 13, 2026 21:27
@exai-bot

exai-bot commented Nov 13, 2026 •

Copy link
Copy Markdown

✅ OpenCodeReview: Review complete: 0 finding(s) across 4 selected item(s).

CI at 48dfc28: 33 passing, 4 skipped.

Review limit reached. This PR has had 6 reviews, so it will only be reviewed again when you ask.
To ask: re-request review from exai-bot in the Reviewers list.

Review details
  • Commit reviewed: 48dfc28 against merge base 2a6b122
  • Coverage: 4 files in 1 groups
  • Engine: OpenCodeReview v1.13.5-exai.4.8f73eada, us.openai.gpt-6.1-sol
  • Usage: 47k tokens (27k from cache), 19s
  • Tool calls: 6 (6 file_read)
  • MCP clients and fuzz target tests: 4 files

Comment thread dokimi/tests/test_noqa_reasons.py Resolved

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The gate can fail on ignored or generated files while allowing reasonless file-level Ruff and Flake8 suppressions to bypass its explanation requirement.

2 open issues
What changed in this PR

2 new must-fix findings.

This PR tightens exception handling across dokimi’s evaluation framework and supporting tools, making intentional catch-all behavior explicit.

Changes:

  • Enables Ruff BLE001, S110, and S112, adds a suppression-reason test, and documents the policy.
  • Narrows JSON parsing handlers to expected parse failures.
  • Adds logging at previously silent fallback sites and explains retained catch-all handlers.
File Description
dokimi/​tests/​test_noqa_reasons.py Adds suppression-reason checks and regression tests.
dokimi/​scripts/​ci_local.py Documents the reachability-probe suppression.
dokimi/​pyproject.toml Enables the three exception-handling rules.
dokimi/​dokimi/​treatments/​arms.py Adds a reranker-fallback suppression reason.
dokimi/​dokimi/​tool_preference.py Documents recorded-error handling.
dokimi/​dokimi/​repos/​l0/​workflows.py Explains suppression for invalid YAML workflows.
dokimi/​dokimi/​repos/​l0/​versions.py Explains suppression for YAML parsing failures.
dokimi/​dokimi/​repos/​l0/​branches.py Explains suppression for YAML loading failures.
dokimi/​dokimi/​repos/​hits_judge.py Documents the unjudged-pair fallback.
dokimi/​dokimi/​questions/​validator.py Documents the unscored-question fallback.
dokimi/​dokimi/​questions/​refiner.py Documents gap-fill failure handling.
dokimi/​dokimi/​questions/​ragas_seed.py Documents document-fetch and extraction fallbacks.
dokimi/​dokimi/​questions/​quality_analyzer.py Documents the default-classification fallback.
dokimi/​dokimi/​questions/​panel_reviewer.py Documents error-bearing reviewer votes.
dokimi/​dokimi/​questions/​llm_gen.py Documents isolation of generation failures.
dokimi/​dokimi/​questions/​chunk_gen.py Documents URL and chunk failure handling.
dokimi/​dokimi/​personas/​analyzer.py Logs per-label issue-fetch failures and explains suppressions.
dokimi/​dokimi/​novelty/​retention.py Documents the failed-adjudication fallback.
dokimi/​dokimi/​novelty/​probes.py Documents rewording failure handling.
dokimi/​dokimi/​novelty/​needs.py Documents preservation of partial graphs.
dokimi/​dokimi/​novelty/​measure.py Narrows reply parsing catches and explains error fallbacks.
dokimi/​dokimi/​novelty/​client.py Documents parse-rejection handling.
dokimi/​dokimi/​novelty/​batching.py Documents retry and recorded-error behavior.
dokimi/​dokimi/​novelty/​atoms.py Documents parsing, batching, and verification fallbacks.
dokimi/​dokimi/​metrics/​example_runner.py Explains the execution-error suppression.
dokimi/​dokimi/​mcp/​url_client.py Documents failed connection checks.
dokimi/​dokimi/​mcp/​okf_client.py Documents skipping unreadable files.
dokimi/​dokimi/​mcp/​mcp_protocol.py Logs tool-listing failures and explains probe suppression.
dokimi/​dokimi/​mcp/​local_markdown.py Documents skipping unreadable Markdown files.
dokimi/​dokimi/​mcp/​context7.py Documents failed connection checks.
dokimi/​dokimi/​llm.py Explains model, pricing, caching, and parsing suppressions.
dokimi/​dokimi/​llm_pricing.py Documents unknown-price handling.
dokimi/​dokimi/​llm_json.py Narrows four JSON parsing handlers.
dokimi/​dokimi/​judged.py Documents cache rejection after parsing failures.
dokimi/​dokimi/​harnesses/​egress_proxy.py Documents tunnel-failure isolation.
dokimi/​dokimi/​eval/​validity_scoring.py Explains per-pair failure suppressions.
dokimi/​dokimi/​eval/​reranker.py Explains the optional dependency import suppression.
dokimi/​dokimi/​eval/​ragas_eval.py Documents optional RAGAS failure handling.
dokimi/​dokimi/​eval/​panel.py Documents failed judge-vote handling.
dokimi/​dokimi/​eval/​pairwise.py Documents per-question failure isolation.
dokimi/​dokimi/​eval/​cross_judge.py Documents exclusion of unscored answers.
dokimi/​dokimi/​eval/​arms_run.py Adds traceback logging before library-ID fallback.
dokimi/​dokimi/​eval/​answerer.py Documents reranker fallback and recorded answer failures.
dokimi/​dokimi/​dashboard/​aggregator.py Documents skipping unreadable snapshots.
dokimi/​dokimi/​commands/​subjects.py Documents per-descriptor error reporting.
dokimi/​dokimi/​commands/​orchestrate.py Documents traceback reporting and failure exit.
dokimi/​dokimi/​commands/​evaluate.py Documents optional RAGAS error reporting.
dokimi/​dokimi/​commands/​benchmark.py Explains validation and batch-failure suppressions.
dokimi/​changelog.d/​20261112_230000_napetrov_blind-except-gate.md Describes logging and JSON parsing changes.
AGENTS.md Documents the exception-handling and suppression policy.

Review effort: Balanced

Comment thread dokimi/tests/test_noqa_reasons.py Resolved
Comment thread dokimi/tests/test_noqa_reasons.py Resolved

@vchamarthi vchamarthi left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed head b4f2479. 2 nits to fix before merge, 3 earlier findings still fail. Details are in the line comments. The gate and the narrowed JSON handlers hold on the head. Two gaps from the open threads still reproduce, and one comment in dokimi/pyproject.toml is out of date.

Verified

  • Gate on the head: The six cases in tests/test_noqa_reasons.py pass on the head.
  • Gate on main: On main the gate fails on dokimi/metrics/example_runner.py:240, a bare # noqa: BLE001; the head gives that line a reason.
  • Json refusals: extract_json_object('[' * 100000) and parse_json_object('[]') both raise ValueError on the head.
  • Extractor dict check: Removing the isinstance(result, dict) check in extract_json_object fails 7 cases in tests/test_fuzz_targets.py.

Fix before merge:

  1. dokimi/pyproject.toml:200: Deferred-rules comment in dokimi/pyproject.toml still lists BLE001 as not enabled, though the head selects it.

    Line 200 lists BLE001 (blind except) 64 among the deferred rules with sites to look at, and line 191 says BLE001 is not selected. Line 211 selects it on the head, and the kept sites now carry reasons. Expected: both notes drop BLE001. AGENTS.md says a block of three or more # lines is shortened when a line in it is edited, so the fix has to shorten the block.

    Also at: dokimi/pyproject.toml:191.

    Suggestion: Drop BLE001 from both notes and shorten the block to two lines, as AGENTS.md asks when a block of three or more # lines is edited.

    Patch, run on b4f2479: the quoted text is gone; tests are no worse.

    Patch
    --- a/dokimi/pyproject.toml
    +++ b/dokimi/pyproject.toml
    @@ -172,34 +172,8 @@
     # The built-in review graders run on the task image's python3 too, 3.8 or newer (contract §4.5).
     "dokimi/repos/graders/*.py" = "py38"
     
    -# A correctness gate: rules that flag code that misbehaves (a swallowed
    -# KeyboardInterrupt, a naive datetime, a file handle never closed, an assert
    -# that never runs), not style. A family is taken whole where its rules are of
    -# that kind and its few style rules are cheap or ignored below; elsewhere the
    -# rules are listed one by one, so a ruff upgrade cannot add style rules to it.
    -# A whole family does gain rules with ruff releases (0.16.0 stabilized LOG004
    -# and PLE0304, preview-only in 0.12), so ruff is pinned to one version here, in
    -# requirements-ci.txt (the tools lock CI installs) and in .pre-commit-config.yaml,
    -# and Renovate bumps all three in one PR that runs the new rules.
    -#
    -# Not enabled yet, with their violation counts at ruff 0.17.0. These three are
    -# autofixes across most files: they land in a PR of their own while few PRs
    -# are open, and per-file-target-version keeps UP from rewriting the py310
    -# files above for 3.11:
    -#   UP (pyupgrade) 1399, of which PEP 585/604 annotations 1185, imports 162
    -#   I (isort) 156
    -#   RUF100 (unused noqa) 22: most name rules not selected (BLE001, E402), so
    -#   select those or list them in lint.external first
    -# Hand fixes deferred because an open PR rewrites the same lines (#29, one
    -# process runner for the spawn sites):
    -#   PLW1509 (preexec_fn with threads) 1, PLW1510 (subprocess.run without
    -#   check=) 15
    -# Bug-prone, each site needs a look:
    -#   PLW2901 (loop variable reassigned) 20, RUF043 (pytest.raises match= with
    -#   unescaped regex characters) 24, ISC004 (implicit concatenation in a
    -#   collection, i.e. a missing comma) 67, BLE001 (blind except) 64,
    -#   PT011 (pytest.raises too broad) 53, RUF012 (mutable class attribute) 8:
    -#   constants and test stubs, but Tool.parameters is also set per instance
    +# Correctness rules only (a swallowed KeyboardInterrupt, a naive datetime, an unclosed file), so a ruff release cannot add style: a family is taken whole where it is all correctness, else rule by rule. Ruff is pinned in three files, bumped by Renovate in one PR.
    +# Not enabled, counts at ruff 0.17.0: UP 1399 and I 156 are autofixes for a PR of their own (per-file-target-version keeps py310 files); RUF100 22 (E402 not selected: select it or list it in lint.external first); PLW1509 1 and PLW1510 15 wait on open PR #29; bug-prone, each site needs a look: PLW2901 20, RUF043 24, ISC004 67, PT011 53, RUF012 8 (Tool.parameters is per instance).
     [tool.ruff.lint]
     select = [
       "F",      # pyflakes

Earlier findings:

  • still fails: #729 (comment): # ruff: noqa: BLE001 above a handler that silently passes now gives unexplained() == [], expected [1].
  • still fails: #729 (comment): # ruff: noqa: BLE001 above a handler that silently passes now gives unexplained() == [], expected [1].
  • still fails: #729 (comment): dokimi/.tox/x/scratch.py with a bare # noqa: BLE001 now gives a gate failure; expected a pass, since ruff check skips .tox/.

Comment thread dokimi/dokimi/llm_json.py Resolved
napetrov and others added 3 commits November 13, 2026 14:55
…-gate

Signed-off-by: Petrov, Nikolay A <nikolay.a.petrov@intel.com>

# Conflicts:
#	dokimi/dokimi/novelty/needs.py
ruff reads `# noqa: E722 BLE001 S110` as three codes, but the reason gate split
codes on commas only, so a gated code after a space-separated one was never
checked and a bare except passed without a reason. Split the code list on
commas and whitespace, as ruff does.

Signed-off-by: Alexander Rybkin <alexander.rybkin@intel.com>
`# ruff: noqa: BLE001, S110` silences the rules for the whole file, and the
reason gate only matched a line-level `# noqa:`, so a file-level directive
let every blind except in the file through without a reason.

Signed-off-by: Alexander Rybkin <alexander.rybkin@intel.com>
@xaleryb

xaleryb commented Nov 14, 2026

Copy link
Copy Markdown
Contributor
  • Ran: head merged with main c1d7f5a, plus the two commits below, full suite on Python 3.13: 19939 passed, 39 skipped. ruff, mypy and bandit are clean, docs check --strict returns 0, and the comment-block and growth checks pass.
  • except: # noqa: E722 BLE001 S110 with no reason -> ruff clean and test_noqa_reasons passes -> expected a failure. ruff reads codes separated by spaces, but the gate splits on commas only.
  • # ruff: noqa: BLE001, S110 / # flake8: noqa: BLE001 (r4568894106, r4568903215) -> the gate passes -> expected a failure.
  • Pushed (6c2f4b2..391f575): 3616f06ed splits the code list on commas and whitespace; 391f5755b also matches file-level ruff:/flake8: noqa directives. Each comes with a test that fails without it.
  • Left for the author: .tox/ and other trees ruff skips are still scanned (r4568903263). Proposal: list files with git ls-files --cached --others --exclude-standard -- '*.py', matching ruff's gitignore handling. When merging main, drop BLE001 from lint.external, or RUF100 will never report a stale BLE001 noqa.

@codecov-commenter

codecov-commenter commented Nov 14, 2026 •

Copy link
Copy Markdown

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

❌ Patch coverage is 86.95652% with 9 lines in your changes missing coverage. Please review.
✅ Project coverage is 95.74%. Comparing base (f12057b) to head (48dfc28).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
dokimi/dokimi/commands/benchmark.py 75.00% 1 Missing ⚠️
dokimi/dokimi/commands/subjects.py 0.00% 1 Missing ⚠️
dokimi/dokimi/eval/answerer.py 50.00% 1 Missing ⚠️
dokimi/dokimi/eval/validity_scoring.py 66.66% 1 Missing ⚠️
dokimi/dokimi/mcp/local_markdown.py 0.00% 1 Missing ⚠️
dokimi/dokimi/mcp/okf_client.py 0.00% 1 Missing ⚠️
dokimi/dokimi/metrics/example_runner.py 0.00% 1 Missing ⚠️
dokimi/dokimi/personas/analyzer.py 80.00% 1 Missing ⚠️
dokimi/dokimi/questions/llm_gen.py 0.00% 1 Missing ⚠️
❗ Your organization needs to install the Codecov GitHub app to enable full functionality.
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #729      +/-   ##
==========================================
+ Coverage   95.71%   95.74%   +0.02%     
==========================================
  Files         415      415              
  Lines       55346    55368      +22     
  Branches     9514     9516       +2     
==========================================
+ Hits        52977    53013      +36     
+ Misses       1466     1453      -13     
+ Partials      903      902       -1     
Files with missing lines Coverage Δ
dokimi/dokimi/commands/eval_graph.py 90.62% <100.00%> (ø)
dokimi/dokimi/commands/evaluate.py 93.82% <100.00%> (ø)
dokimi/dokimi/commands/orchestrate.py 90.00% <100.00%> (ø)
dokimi/dokimi/dashboard/aggregator.py 98.00% <100.00%> (ø)
dokimi/dokimi/eval/arms_run.py 97.41% <100.00%> (+0.77%) ⬆️
dokimi/dokimi/eval/cross_judge.py 99.57% <100.00%> (ø)
dokimi/dokimi/eval/pairwise.py 100.00% <100.00%> (ø)
dokimi/dokimi/eval/panel.py 97.71% <100.00%> (ø)
dokimi/dokimi/eval/ragas_eval.py 90.97% <100.00%> (ø)
dokimi/dokimi/eval/reranker.py 57.89% <100.00%> (ø)
... and 35 more

... and 2 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@xaleryb xaleryb left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re-checked at 391f575 merged with main: a gated code in a space-separated noqa list and a file-level ruff:/flake8: noqa now need a reason (both passed before); the full suite, ruff, mypy, bandit, docs check --strict and the growth check pass, and CI is green. Left as recommendations, not blocking: list files with git ls-files so trees ruff skips (.tox/) are not scanned, and drop BLE001 from lint.external when merging main.

@antonwolfy antonwolfy left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review at 391f575. The gate and the narrowed JSON handlers hold up, and the noqa reasons I sampled match their handler bodies. One reason rewrite changes coverage behaviour; the other inline comments are nits.

What I ran, on a Linux review host at 391f575:

  • make ci-local: 35 passed, 2 failed, 14 skipped. Changed-line coverage passes. The suite ran 19758 passed, 19 skipped, 2 errors. Both errors are 60 s timeouts in test_audit_test_quality.py, a file the PR does not touch, and it passes alone (172 passed in 6 s). The pre-commit failure is check-added-large-files on dokimi/docs/reference/cli-interface.json (501 KB over the 500 KB limit), which the PR does not touch.
  • Reproductions with the LLM transport mocked, and mutation runs on the narrowed handlers: with RecursionError dropped from the four llm_json.py clauses, or _reply_verdict catching KeyError instead of ValueError, or the three new log lines deleted, the related tests (238 and 90 cases) still pass.
  • Commits: all four non-merge commits carry a Signed-off-by.

I agree with @vchamarthi's points on the RecursionError clauses in llm_json.py (no test fails without them) and on the stale deferred-rules comment in pyproject.toml, which still lists BLE001 as not enabled. New evidence: the same mutation on _reply_verdict, except KeyError:, also passes 90 related tests.

@xaleryb's point that trees ruff skips (.tox/) are still scanned waits for the author.

Checked, no issues

  • Narrowed handlers: for str input json.loads raises only ValueError or RecursionError, so (ValueError, RecursionError) loses nothing; the base code behaves the same for a bad {...} block.
  • noqa reasons: about 40 reasons compared with their handler bodies across cli, eval, mcp, novelty, questions, repos and treatments; the only mismatch is the pragma below.
  • Gate: test_noqa_reasons.py runs in about 3 s offline and covers comma and space-separated code lists, NOQA in upper case, and ruff:/flake8: file-level forms.
Bot points I checked that no longer apply at this head (2)
  • Copilot's point on file-level # ruff: noqa and # flake8: noqa directives does not apply at this head: 391f5755 matches both prefixes and the new test pins bare and explained forms.
  • exai-bot's point on the file-level # ruff: noqa: BLE001, S110, S112 directive does not apply at this head: the gate now flags it without a reason.

Comment thread dokimi/dokimi/treatments/arms.py Resolved
Comment thread dokimi/dokimi/eval/arms_run.py Resolved
Comment thread dokimi/tests/test_noqa_reasons.py Resolved
…blind-except-gate

Signed-off-by: Nikolay Petrov <nikolay.a.petrov@intel.com>

# Conflicts:
#	dokimi/dokimi/llm.py
#	dokimi/dokimi/llm_pricing.py
A reply with no prose before its nesting reaches the direct json.loads parse.
Dropping RecursionError from that clause left all 58 fuzz cases green.

Thread: PRRT_kwDOVBg7g863UN0k
Signed-off-by: Nikolay Petrov <nikolay.a.petrov@intel.com>
Each new logger call (arms resolver, MCP tool listing, persona label fetch)
gets a caplog test; deleting the call fails the test.

Thread: PRRT_kwDOVBg7g863fUNI
Signed-off-by: Nikolay Petrov <nikolay.a.petrov@intel.com>
The reason on the reranker handler swallowed "pragma: no cover", so the line
left coverage's exclusion. The pragma now comes first, the noqa reason after.

The noqa gate lists the files git tracks or does not ignore, as ruff does, so
mutants/, .tox/ and dist/ copies no longer fail it.

Thread: PRRT_kwDOVBg7g863fUND
Thread: PRRT_kwDOVBg7g863S32b
Thread: PRRT_kwDOVBg7g863fUNL
Thread: IC_kwDOVBg7g88AAAABmcksyQ
Signed-off-by: Nikolay Petrov <nikolay.a.petrov@intel.com>
The deferred-rules comment still listed BLE001 as not enabled, and
lint.external hid stale BLE001 noqa comments from RUF100.

Thread: PRR_kwDOVBg7g88AAAABX5yHKQ#1
Thread: IC_kwDOVBg7g88AAAABmcksyQ
Signed-off-by: Nikolay Petrov <nikolay.a.petrov@intel.com>
Thread: PRRT_kwDOVBg7g863S2fa: already fixed in 391f575
Thread: PRRT_kwDOVBg7g863S319: already fixed in 391f575
Signed-off-by: Nikolay Petrov <nikolay.a.petrov@intel.com>
… tree

git ls-files --cached lists a file staged and then deleted on disk, and
reading it raised FileNotFoundError in a local run.

Thread: PRRT_kwDOVBg7g863fUNL
Thread: PRRT_kwDOVBg7g863S32b
Signed-off-by: Nikolay Petrov <nikolay.a.petrov@intel.com>
@napetrov

Copy link
Copy Markdown
Contributor Author

Re: review by vchamarthi

The deferred-rules note still lists BLE001 as not enabled
Fixed in c2cc374: BLE001 is out of the note; the block is two lines.

@napetrov

Copy link
Copy Markdown
Contributor Author

Re: review by antonwolfy

Review at 391f575: the other inline comments are nits
No change for this review itself. Its pragma, log-test and file-list points are answered in their threads.

@napetrov

Copy link
Copy Markdown
Contributor Author

Re: comment by xaleryb

Left for the author: .tox/ and other trees ruff skips are still scanned
Done in this round: git's file list, and BLE001 is out of lint.external.

Comment thread dokimi/tests/test_noqa_reasons.py Resolved
Thread: PRRT_kwDOVBg7g863iWL2
Signed-off-by: Nikolay Petrov <nikolay.a.petrov@intel.com>

@antonwolfy antonwolfy left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Review at 2a6b122. The gate now lists files the way ruff does, the pragma ordering on the reranker handler is fixed, the new log calls and the direct-parse RecursionError clause are pinned by tests, and the stale BLE001 notes are gone. Two nits inline.

What I ran, on a Linux review host at 2a6b122:

  • make ci-local: 38 passed, 0 failed, 14 skipped. Changed-line coverage passes. The skips are the other Python legs, micromamba, fuzz and semgrep.
  • ruff check over dokimi/dokimi, dokimi/tests and dokimi/scripts with the project config: clean.
  • Mutation runs on the narrowed handlers and the new log calls, 1942 related tests per mutant: the direct-parse RecursionError clauses, _reply_verdict catching KeyError, each deleted log call and each dropped exc_info are all caught now. Both markdown-fence clauses in llm_json.py survive (inline).
  • Mutation runs on the gate (13 mutants): dropping the pragma strip, .tox/, is_file(), --others, --exclude-standard or the word-count threshold fails a test.
  • Commits: every non-merge commit carries a Signed-off-by.

Checked, no issues

  • Pragma order: # pragma: no cover # noqa: BLE001 - env dependent at treatments/arms.py:70 is accepted by ruff and still matches coverage.py's default exclusion pattern. No other touched line carries a displaced type: ignore, nosec or pragma.
  • Gate file list: in a fresh git init, an ignored mutants/, a .tox/ copy and a file staged then deleted on disk are all skipped, and tracked files are listed.
  • Narrowed handlers: for str input json.loads raises only ValueError or RecursionError, and parse_json_object raises only ValueError, so nothing the base code swallowed escapes now.
  • Config: BLE001 is out of external, and the comment block is two lines, as AGENTS.md asks.

Comment thread dokimi/tests/test_fuzz_targets.py Resolved
Comment thread dokimi/dokimi/mcp/okf_client.py Resolved
Signed-off-by: Anton Volkov <antonwolfy@gmail.com>
Signed-off-by: Anton Volkov <antonwolfy@gmail.com>

@antonwolfy antonwolfy left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. I pushed a commit per nit, up to 48dfc28, which fix the two nits from my review:

  • dbcb55a: dokimi/tests/test_fuzz_targets.py:77: the test is parametrized over a bare and a fenced deep reply, and narrowing either fence clause in llm_json.py to except ValueError now fails it.
  • 48dfc28: dokimi/dokimi/mcp/okf_client.py:146: the noqa reason says "logged at debug", and so do mcp/local_markdown.py:91 and mcp/url_client.py:128.

make ci-local at 48dfc28: 38 passed, 0 failed, 14 skipped.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants