Skip to content

fix(python): cover assignment/return value-refs, broaden shadow guard to full scope - #79

Merged
dejo1307 merged 4 commits into
mainfrom
improve-python-extractors
Jul 9, 2026
Merged

fix(python): cover assignment/return value-refs, broaden shadow guard to full scope#79
dejo1307 merged 4 commits into
mainfrom
improve-python-extractors

Conversation

@GertL

@GertL GertL commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

Summary

Follow-up to #72/#74 (indirect-reference resolution and the resolveCall
shadow guard). Two aspects I identified while testing:

  • No value-ref edge was emitted for a callback passed via assignment or
    return (cb = handler; return cb, return handler). This is a common pattern
    for factories/registries/DI-by-return. These functions had no incoming
    edge and were misreported as dead code.
  • The shadow guard (paramNames) only excluded function parameters. A loop
    variable, local assignment, with ... as alias, or walrus binding that
    happens to share a name with an unrelated top-level def would still be
    credited as a call to that def.

This replaces the parameter-only guard with localBound: every name bound
anywhere in the enclosing function's own scope (not just parameters),
applied uniformly to both direct-call resolution (resolveCall) and
value-ref resolution (valueRefTarget).

Also includes an unrelated, additive change to pkg/explain: a
relation-kind count breakdown (declares/imports/calls/.../has_method) in
the --explain Report and rendered output, for visibility into the edge
mix of a snapshot. Which is quite useful in my opinion.

cacheVersion bumped v95 → v96 since Python extractor output changes for
existing source (new edges + fewer false-positive edges); registered in
cachecov's versionCoverage per repo convention.

GertL added 4 commits July 9, 2026 07:42
The RelReferences relation kind was dropped during the rebase merge with
upstream's RelCalls-based value-ref fix; these two MCP tool-description
strings still advertised it as a valid relation_kinds filter value.
@GertL
GertL requested a review from dejo1307 July 9, 2026 05:00
@dejo1307
dejo1307 merged commit 3cc921d into main Jul 9, 2026
4 checks passed
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.

2 participants