Skip to content

Declared-receiver call-closure proofs for threaded_absence and zero_one_tuple - #640

Merged
trissim merged 1 commit into
mainfrom
feat/declared-receivers-call-closure
Nov 27, 2026
Merged

trissim merged 1 commit into
mainfrom
feat/declared-receivers-call-closure

Conversation

@trissim

@trissim trissim commented Nov 27, 2026

Copy link
Copy Markdown
Contributor

Summary

  1. Factored MethodOwnerReceiverProof (nominal_refactor_advisor/probe_owner.py) to eliminate the duplicated mypy receiver-closure loop across refactors/threaded_absence.py and refactors/zero_one_tuple.py (IMPL-12) and fall back to DeclaredReceiverTyping when mypy degrades unfollowed installed imports (follow_imports="skip") to Any/Unknown/object:
    • DeclaredType.reaches_method_owner(reaching_symbols, reaching_ancestors, is_nominal_class) polymorphic dispatch on DeclaredScannedClasses and DeclaredForeignInstance.
    • MethodOwnerReceiverProof transitively closes reaching_ancestors over installed bases and refuses to dismiss scanned or installed Protocols (typing.Protocol / typing_extensions.Protocol), builtins.object, or Any.
  2. Installed-module import alias resolution in DeclaredReceiverTyping.qualified (nominal_refactor_advisor/declared_receivers.py, class_index.py):
    • Added cached InstalledClassDeclarations.import_aliases_map(module_name) and InstalledClassDeclarations.is_nominal_non_protocol_class(qualified_name, scan).
    • Allows Self and imported annotations declared inside installed base classes (e.g. agent_comms.nominal.declared_family.DeclaredFamily.member_named(cls, name) -> type[Self]) to resolve when inherited by scanned classes.
  3. __init__ self.<attr>: T instance attribute annotations (class_index.py, declared_receivers.py):
    • Collected unambiguous self.<attr>: T annotations in CompactIndexedClass.init_attribute_annotations.
    • Added _InstanceMemberRead(_MemberRead) so instance attribute reads resolve __init__ annotations along the resolved MRO prefix (including subclasses of open bases) without leaking instance attributes onto DeclaredClassObject.
  4. Awaited async call typing (class_index.py, declared_receivers.py):
    • Added is_async: bool = False on CompactAnnotatedMethod and CompactAnnotatedFunctionReturn, plus AwaitCallStep, AwaitedCalledReferenceRoot, _AwaitedMethodCall, and ast.Await handling in ReceiverPathBuilder. Non-async def callables remain UndeclaredType.

Live Toad-Bench Verification

Running --codemod-synthesize-plan --codemod-goal-detector threaded_absence --codemod-goal-detector zero_one_tuple against OpenHCSDev/toad (472e6eb25):

  • All 3 zero_one_tuple StructuredTag.decode_block findings (CtxTag.decode_block, ToolCallTag.decode_block, ThinkTag.decode_block) cleared structured_context.py:587 accesses .decode_block on Any and unlocked directly to OWNER_PICK (zero_one_tuple proof blockers 5 -> 2, owner_pick 0 -> 3).
  • All 4 projection_attachment.py:199 (self._session_id.accepts on AcpSessionId | NoAcpSessionId) and both log_records.py:170 (self.params.update on acp.schema.SessionNotification) Any blockers cleared.

Tests

  • Focused suite (tests/test_declared_receivers.py, tests/test_threaded_absence.py, tests/test_zero_one_tuple.py, tests/test_installed_stubs.py, tests/test_installed_creation_proofs.py, tests/test_repository_architecture.py): 87 passed, 0 failed.
  • REL_IMPORTS=0.

@trissim
trissim merged commit 60dcc96 into main Nov 27, 2026
@trissim
trissim deleted the feat/declared-receivers-call-closure branch November 27, 2026 22:39
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