Skip to content

test(plotter): exercise the swallow-and-continue paths, and say pass - #2095

Merged
lmeyerov merged 2 commits into
masterfrom
fix/pyright-trivial-grabbag
Sep 18, 2026
Merged

lmeyerov merged 2 commits into
masterfrom
fix/pyright-trivial-grabbag

Conversation

@lmeyerov

Copy link
Copy Markdown
Contributor

Third of the pyright-ratchet cleanup series (#2092 gate, #2093 layout, #2094 outliers). Ratchet 271 → 262.

What this started as, and why it changed

PlotterBase used a bare 1 as a no-op statement in nine places — someone's stand-in for pass, which is what reportUnusedExpression was flagging. Swapping it for pass is inert: every touched file is AST-identical once 1-as-statement is normalized to Pass.

But a purely cosmetic change drags nine previously-unexecuted lines into the changed-line-coverage gate, and measurement showed how unexecuted they were: across the full suite (8530 tests), 1 of the 15 bare-1 sites repo-wide runs. So the change worth making alongside the rename is covering what those guards actually promise.

What is now pinned

The five maybe_* optional-import helpers (cudf, dask_cudf, dask.dataframe, pyspark, polars) are the contract engine dispatch is built on: each must return None when its library is absent rather than raise. Pinned in both directions, plus the lru_cache that makes them cheap enough to call per dispatch decision.

Two except: guards protect an upload from an advisory step — a failure inside infer_labels, and an edges table whose len() raises. Both are pinned by tests that fail when the guard is removed; I verified that by removing each one and watching the matching test go red.

This is the same defect class as #2094, where an optional-import guard turned out not to work at all. These five do work — now there is a test saying so.

Two deletions rather than conversions

Two of the nine no-ops sat directly after a logger.debug(...), so they were redundant rather than required. Deleting them is more honest than converting them, and it keeps them out of the coverage gate.

Deliberately not here

The other six bare-1 sites (gremlin.py, layouts.py, plugins/cugraph.py ×3, plugins/igraph.py) are left for the PRs that own those files. cugraph's three are unreachable on a CPU lane, so they need the GPU-lane treatment rather than a cosmetic sweep bundled in here.

Verification

bin/lint.sh (ruff, type-hygiene 4448, comment-density 1151) · pyright guard 262 · mypy 351 files · changed-line coverage 7/7 = 100% · 72 plotter tests.

Unrelated observation while running the full suite: test_temporal_leak_family_1915.py::TestB7Units::test_align_mixed_tz_converts_only_mixed_datetime_pairs fails on clean master under pandas 3.0.5. Not touched by this PR; flagging it separately.

🤖 Generated with Claude Code

https://claude.ai/code/session_017ropeBMLJUuy6ViYwy15ud

lmeyerov and others added 2 commits September 17, 2026 19:23
PlotterBase used a bare `1` as a no-op statement in nine places, which is what
`reportUnusedExpression` was flagging. Replacing it with `pass` is inert -- the
file is AST-identical once `1`-as-statement is normalized -- so the change worth
making alongside it is covering what those guards actually promise.

The five maybe_* helpers (cudf, dask_cudf, dask.dataframe, pyspark, polars) are
the contract engine dispatch is built on: each must return None when its library
is absent rather than raise. That is now pinned in both directions, plus the
lru_cache that makes them cheap enough to call per dispatch decision.

Two `except:` guards protect an upload from an advisory step: a failure inside
infer_labels, and an edges table whose len() raises. Both are pinned by tests
that fail when the guard is removed -- verified by removing each one.

Two of the nine no-ops sat directly after a `logger.debug(...)`, so they were
redundant rather than required; those are deleted instead of converted, which
also keeps them out of the changed-line coverage gate.

The remaining bare-`1` sites (gremlin, layouts, cugraph, igraph) are left for
the PRs that own those files. cugraph's three are unreachable on a CPU lane, so
they need the GPU-lane treatment rather than a cosmetic sweep here.

Pyright ratchet 271 -> 262 (-9). Changed-line coverage 7/7.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017ropeBMLJUuy6ViYwy15ud
test_polars_lane_completeness caught it: a test module that mentions polars must
either run in the polars lane or be justified as not needing one. This module
asserts maybe_polars returns the module when polars is present, so it wants the
lane -- without it that half of the pin never executes. Under polars it goes
from 8 passed / 5 skipped to 9 passed / 4 skipped.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017ropeBMLJUuy6ViYwy15ud
@lmeyerov
lmeyerov merged commit dc0d5a2 into master Sep 18, 2026
80 checks passed
lmeyerov added a commit that referenced this pull request Sep 18, 2026
from_igraph's third branch, which un-swizzles integer vertex IDs, recorded
success in a separate `found` boolean: node_id_col was bound inside the loop
and read after it, with `if not found` as the only thing tying the two
together. The name is in fact always bound -- every arm of the chain either
assigns it or raises -- but nothing local says so, which is why it read as
possibly unbound.

Binding node_id_col = None up front and testing that instead says the same
thing with one name rather than two, and the flag disappears.

Behaviour verified rather than assumed: round-trips through igraph produce
byte-identical edge frames on master and here for all three shapes that reach
different arms -- named vertices, integer vids (the arm this touches), and a
bare attribute-less graph. 37 igraph tests, 50 plugin tests.

Also `pass` for a bare `1` used as a no-op, the same idiom cleared from
PlotterBase in #2095.

cugraph's findings are not here: they are GPU-only, so no lane feeding the
changed-line gate can execute them, and they want dgx validation of their own.

Pyright ratchet 245 -> 240 (-5). Changed-line coverage 3/3.


Claude-Session: https://claude.ai/code/session_017ropeBMLJUuy6ViYwy15ud

Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
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