Problem
The expressions protocol alignment tests (test_protocol_alignment.py) verify that every protocol method has a concrete implementation on the composed ExpressionSystem class. But no test validates that the __getattr__ dispatch mechanism on BaseExpressionAPI actually routes to a real implementation rather than an inherited Protocol stub.
Gap
Consider a scenario where:
- A builder class inherits
SomeProtocol (which declares method_x)
- The builder forgets to implement
method_x
- The alignment test checks the composed ExpressionSystem — but
__getattr__ dispatch operates on individual builder classes
The alignment test passes (because another builder or the composed class might have method_x), but the dispatch routes to the wrong builder's inherited stub.
What's needed
A test that:
- For each method discoverable via
_FLAT_NAMESPACES dispatch, verifies the dispatched method is a concrete implementation (defined in __dict__ of the builder class), not an inherited Protocol stub
- Alternatively: a test that instantiates the API, calls each method name through normal attribute access, and verifies it doesn't return
None/... (the protocol stub return values)
Relationship to #114
Issue #114 proposes fixing the dispatch to use ns_cls.__dict__ instead of hasattr. That fix makes this test less critical (stubs would never be dispatched), but the test remains valuable as defence-in-depth — verifying that every method the dispatch could route is actually implemented.
Discovered during
Codex adversarial review of the Relation API builder decomposition spec (2026-05-06).
Problem
The expressions protocol alignment tests (
test_protocol_alignment.py) verify that every protocol method has a concrete implementation on the composed ExpressionSystem class. But no test validates that the__getattr__dispatch mechanism onBaseExpressionAPIactually routes to a real implementation rather than an inherited Protocol stub.Gap
Consider a scenario where:
SomeProtocol(which declaresmethod_x)method_x__getattr__dispatch operates on individual builder classesThe alignment test passes (because another builder or the composed class might have
method_x), but the dispatch routes to the wrong builder's inherited stub.What's needed
A test that:
_FLAT_NAMESPACESdispatch, verifies the dispatched method is a concrete implementation (defined in__dict__of the builder class), not an inherited Protocol stubNone/...(the protocol stub return values)Relationship to #114
Issue #114 proposes fixing the dispatch to use
ns_cls.__dict__instead ofhasattr. That fix makes this test less critical (stubs would never be dispatched), but the test remains valuable as defence-in-depth — verifying that every method the dispatch could route is actually implemented.Discovered during
Codex adversarial review of the Relation API builder decomposition spec (2026-05-06).