Repository navigation
Report attribute probes that never succeed - #475
Merged
Merged
Conversation
absent_attribute_probe (pattern 57) reports a getattr or hasattr whose literal name no class the receiver is declared as, nor any scanned subclass, binds through its MRO (member_in_mro) or stores on itself; such a probe has a fixed answer and the branch it guards is dead. A dunder, a name stored on any other receiver, an open MRO, a lookup hook and a class storing by a computed name all keep a probe off it. named_attribute leaves those sites to it, so each site is one detector's. Fixtures are toad's own shapes: the turn owner's `describe` probe (composer_surround) is reported; the line link's `href` probe is not, since ProjectLink declares it, while its `url` probe is. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016gZLduhisRHdamZ5LNK72Z
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.
This adds
absent_attribute_probe(pattern 57). It reports agetattrorhasattrwhose literal name is bound or stored by no class the receiver is declared as, and by none of its scanned subclasses, according tomember_in_mroand the stores on each class's own object. Such a probe always gives the same answer, so the branch it guards is dead.A probe is never reported when:
__getattr__or__getattribute__;named_attributehands these sites over, so each site belongs to one detector.This is only the detector part of the pre-amend commit e0be993, rebased on main. The
named_attributeexemptions from that commit are not included; they are separate precision work.Evidence
Fixtures use toad's real shapes, with
DeclaredFamilymembers created byFamilyMeta, whose order Detectors and refactors read one creation proof: a family's order is closed #471 proved:hasattr(owner, 'describe')(fromcomposer_surround) is reported, andnamed_attributeno longer reports it.getattr(link, 'url', None) or getattr(link, 'href', None),hrefis not reported becauseProjectLinkdeclares it, and it stays anamed_attributesite;urlis reported.Every site found on fresh archives of agent-comms 106007daa, toad 9b203dad + agent-comms, and textual f5ec9e757:
toad/qt/composer_surround.py:68,owner.describe. None ofTurnOwner,ActivityTurn,AgentTurn,ClientTurn,ManagedTurnorNoTurnbinds or storesdescribe.The real
window.pyurlprobe is not reported: some module stores.urlon another receiver, so the name is held conservatively.named_attributegoes from 37 to 36 on toad + agent-comms because thedescribesite moved; it is unchanged on agent-comms (5) and textual (40).Tests:
tests/test_restated_fact_detectors.py,tests/test_pattern_semantic_authority.pyandtests/test_class_mro.pypassed 158.pytest tests -k test_repository_passed 72.Generated by Claude Code