Skip to content

Delete FieldRepresentation.__init_subclass__ now that MroDispatch is lazy - #5295

Merged
trissim merged 1 commit into
mainfrom
perf/drop-field-rep-init-subclass
Nov 28, 2026
Merged

trissim merged 1 commit into
mainfrom
perf/drop-field-rep-init-subclass

Conversation

@trissim

@trissim trissim commented Nov 28, 2026

Copy link
Copy Markdown
Contributor

Delete the 18-line FieldRepresentation.__init_subclass__ fast-path workaround (src/agent_comms/nominal/field_codec.py:1634-1651, added in ef66d4f924) now that OpenHCSDev/metaclass-registry#20 (9933bdf) resolves MroDispatch._handler_declarations and _handler_names lazily per class with zero __init_subclass__ cost.

Why

  • MroDispatch no longer walks the MRO at class creation time, so every FieldRepresentation subclass (~400 classes) gets zero import-time handler work natively without a cls.__bases__ fast-path copy (paper1 Thm 4.6 / IMPL-12).
  • Deleting the cls.__bases__ hook also removes the Add durable coordination, goals, claims and read state to agent-comms #1 P58 sibling-override proof blocker on agent-comms (20 findings in field_codec.py).

Verification

  • pytest -p no:xdist tests/test_field_codec.py tests/test_codec_capabilities.py: 151/151 passed (6.34s) against metaclass-registry@9933bdf
  • Whole-tree module import sweep: 921/921 modules imported, 0 errors
  • 5-round warm alternating unprofiled A/B vs origin/main (import agent_comms.nominal.field_codec): 173.4 ms -> 164.3 ms (-9.1 ms)
  • REL_IMPORTS=0

@trissim
trissim merged commit f1edb54 into main Nov 28, 2026
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