Skip to content

fix(tests): stop vulture failing on the fake transports' send signature - #220

Merged
ajslater merged 1 commit into
developfrom
claude/fix-vulture-adapter-params
Sep 21, 2026
Merged

ajslater merged 1 commit into
developfrom
claude/fix-vulture-adapter-params

Conversation

@ajslater

Copy link
Copy Markdown
Owner

make lint exits 2 on develop right now, and has since
#218. bin/lint-python.sh runs
vulture . after make typecheck, and vulture flags eight
interface-mandated parameters on the two fake BaseAdapter.send
overrides I added:

tests/unit/test_rate_gate_concurrency.py:81: unused variable 'stream'
tests/unit/test_rate_gate_concurrency.py:83: unused variable 'verify'
tests/unit/test_rate_gate_concurrency.py:84: unused variable 'cert'
tests/unit/test_rate_gate_concurrency.py:85: unused variable 'proxies'
tests/util/metron_transport.py:70: unused variable 'stream'
…

My verification on #218 quoted basedpyright's "0 errors, 0 warnings"
line and grepped past the vulture step underneath it. That was my
mistake; this restores a green make lint.

Why the signature can't just drop them

  • Renaming them (_stream, …) breaks at runtime.
    requests.Session.send does adapter.send(request, **kwargs)
    (sessions.py:784) with those exact keyword names, so a renamed
    parameter is a TypeError, not just a checker complaint.
  • **kwargs fails the type checker. basedpyright:
    Method "send" overrides class "BaseAdapter" in an incompatible manner — Positional parameter count mismatch; base method has 7, but override has 3 (reportIncompatibleMethodOverride).

So the names stay, and the body consumes them with del plus a comment
saying why they're there.

Why not vulture_ignorelist.py

The repo already whitelists one interface-mandated parameter
(option_string, for argparse.Action.__call__), so the precedent
exists and this would be a defensible one-line alternative.

The difference is blast radius. Vulture's whitelist matches by bare
name across the whole tree
— the file works by referencing a name so
it looks used. option_string is safe there because nothing else in
comicbox will ever be called that. stream, verify, cert and
proxies are ordinary words; whitelisting them would permanently blind
vulture to a genuinely dead verify or stream in production code
later, to spare two lines in two test doubles. (timeout is already
unflagged for exactly this reason — the name is used elsewhere, so
vulture assumes it's live.)

Happy to switch to the whitelist if you'd rather keep the test bodies
free of linter accommodations.

Verification

make fix && make lint && make ty && make complexity
  • make lint → exit 0 (was 2)
  • make ty → All checks passed!
  • make complexity → exit 0, nothing over 15
make test → exit=0
2241 passed, 1 skipped, 17 warnings in 43.27s

🤖 Generated with Claude Code

`make lint` has been exiting 2 since #218: vulture flags `stream`,
`verify`, `cert` and `proxies` on both fake `BaseAdapter.send` overrides.

The names cannot change. `requests.Session.send` calls
`adapter.send(request, **kwargs)` with those exact keywords, so renaming
them is a TypeError at runtime, and collapsing them into `**kwargs`
fails basedpyright's override check (positional parameter count
mismatch). So the signature stays and the body consumes them.

`del` rather than a `vulture_ignorelist.py` entry: the whitelist matches
by bare name across the whole tree, and `stream` / `verify` / `cert` /
`proxies` are ordinary enough words that listing them would blind vulture
to real dead code elsewhere. The existing `option_string` entry is safe
there precisely because nothing else would ever be called that.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@ajslater
ajslater merged commit 7f731b7 into develop Sep 21, 2026
2 checks passed
@ajslater
ajslater deleted the claude/fix-vulture-adapter-params branch October 6, 2026 20:43
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.

1 participant