chore: vulture whitelist for verified false-positive ensure_ascii (#1136)#1281
Open
axisrow wants to merge 1 commit into
Open
chore: vulture whitelist for verified false-positive ensure_ascii (#1136)#1281axisrow wants to merge 1 commit into
axisrow wants to merge 1 commit into
Conversation
) Adds [tool.vulture] to pyproject.toml (ignore_names=["ensure_ascii"]) and a regression test locking the parameter in place. safe_json_dumps(ensure_ascii=...) is an intentional call-site-compat no-op after the orjson migration (#956) — orjson always emits UTF-8, live call sites pass it today (e.g. generation_runs repository, src/models.py:666). Removing it would break them. Classified as a false-positive in #1136; the goal of that issue is 0 high-confidence findings via whitelist, NOT deletion. vulture >=2.1 auto-reads [tool.vulture], so the whitelist applies to both bare `python -m vulture src/` and scripts/code_health.py without touching either. Before: 1 finding (src/utils/json.py:23, 100%). After: 0. Part of #1136 / #1130. Co-Authored-By: Claude <noreply@anthropic.com>
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.
Part of #1136 (vulture axis of epic #1130).
Summary
[tool.vulture]topyproject.toml(ignore_names=["ensure_ascii"]), bringing the high-confidence dead-code report to 0 findings — via whitelist, NOT deletion, as tech-debt: мёртвый код (vulture, verify+обсудить с владельцем) #1136 requires.tests/test_utils_json.py::test_ensure_ascii_accepted_for_call_site_compat) locking the parameter in place.Why whitelist, not deletion
safe_json_dumps(ensure_ascii=...)is an intentional call-site-compatibility parameter after the orjson migration (#956): orjson always emits UTF-8, so the flag is a documented no-op. Live call sites pass it today — verified by grep:src/database/repositories/generation_runs.py— 5 calls withensure_ascii=Falsesrc/models.py:666—ensure_ascii=FalseRemoving it would break those call sites. This matches #1136, which already classifies the finding as a false-positive and asks for a whitelist rather than deletion.
Whitelist format (requesting owner sign-off)
vulture ≥2.1 auto-reads
[tool.vulture]frompyproject.toml, so the whitelist applies both to barepython -m vulture src/and toscripts/code_health.pywithout changing either invocation.Trade-off:
ignore_namesmatches by name repo-wide, so any future unusedensure_asciisymbol would also be skipped. Accepted for this specific name; the section header comment requires each entry to carry a justification. Alternative considered and rejected: a separate whitelist.pyfile would require changing thecode_health.pycall and wouldn't cover bare vulture runs.Verification
ensure_asciiconfirms live production call sites (above) → must not delete.python -m vulture src/ --min-confidence 80→ 1 finding (src/utils/json.py:23, 100%).scripts/code_health.pyprints «Находок (high-confidence): 0».ruff check src/ tests/ conftest.pyclean.pytest tests/test_utils_json.py— 14 passed.tests/test_quality_scoring_service.py,tests/routes/test_debug_routes.py::test_debug_timing_page) are pre-existing — reproduced on cleanorigin/main(quality_scoring fails on clean main; debug_timing is xdist-flaky, passes in isolation). Unrelated to this whitelist.Note: nothing else deleted in this PR
The wider 60%-confidence vulture sweep surfaces many more names, but per #1136 every candidate must be verified across all five surfaces (FastAPI/Web/CLI/agent/TUI) before deletion and most are framework false-positives (Typer commands, FastAPI routes/DI, Textual hooks, pydantic fields, dispatcher
_handle_*viagetattr). Those go in separate PRs; doubtful candidates are left untouched. This PR only resolves the single high-confidence verified false-positive that #1136 explicitly targets.Part of #1136 / #1130.