Skip to content

Check caller receiver hierarchy in parameter pushes/moves and descendant overrides in forwarding_facade - #641

Merged
trissim merged 3 commits into
mainfrom
fix/move-param-receiver-and-facade-overrides
Nov 28, 2026
Merged

trissim merged 3 commits into
mainfrom
fix/move-param-receiver-and-facade-overrides

Conversation

@trissim

@trissim trissim commented Nov 28, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes two soundness defects caught on OpenHCSDev/toad (#2327, 47258924a):

  1. Caller receiver-hierarchy verification in PushForeignAbsenceBranchOperation and MoveMethodToClassOperation (probe_owner.py:345-355, refactors/foreign_absence_branch.py:2152-2335, refactors/member_move.py:552-575):
    • In Toad 6358df80a, ReadMarkedHistory.retain_painted(self, fragment: EvidencedFragment) had a narrowed parameter annotation while HistoryFragment owned evidence = None and callers (qt/history.py:2255, widgets/wire_history.py:72) passed HistoryFragment instances. Pushing retain_painted onto EvidencedFragment alone caused AttributeError on the first non-evidenced fragment inside VirtualRowCanvas.paintEvent, blanking every Qt DM view.
    • Added DeclaredPathProbeOwner.outside_family_symbols and _require_parameter_callers_within_owner (plus DestinationInstanceMethod._require_argument_within_destination): checks every scanned caller argument against the target owner hierarchy (using declared types first, plus batched type-checker inference when an ancestor owns the probed attribute) and stops with NeededInput.SOURCE_CHANGE naming the offending file:line when a caller passes a supertype or outside instance.
  2. Full-hierarchy descendant override check in ForwardingFacadeDetector (detectors/_restated_facts.py:1047-1112):
    • ForwardingFacadeDetector.restates previously checked only overridden_declarations (ancestors), missing AfterSequence(AfterMessage).older() overriding WireCut.older() two hops down (toad/client/history.py:463, :507).
    • Replaced _overrides_inherited with _participates_in_dispatch, excluding any member overridden by any descendant in index.descendant_symbols(symbol) as polymorphic base dispatch.

Evidence

  • Live against Toad src/toad/client/history.py: ForwardingFacadeDetector findings on WireCut drop 1 -> 0.
  • Added regression tests reproducing both Toad bugs in tests/test_foreign_absence_branch.py, tests/test_move_method_to_class.py, and tests/test_restated_fact_detectors.py.
  • REL_IMPORTS=0, TOTAL_TOUCHED_FINDINGS=0.

@trissim
trissim merged commit a557bc4 into main Nov 28, 2026
1 of 10 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.

1 participant