debug: Add detailed logging for signature mismatch errors

Adding comprehensive debug logging to understand what's causing the persistent
signature mismatch errors in CI. The logging will show:
- Provider class name and module
- Both protocol and object signatures
- The actual method object
- The method's source module

This will help us identify if the issue is:
1. A cached module being loaded
2. A parent class overriding the method
3. Some other source of the wrong signature

Once we see the debug output, we can pinpoint the exact root cause.
This commit is contained in:
Omar Abdelwahab 2025-11-12 16:01:13 -08:00
parent 166c37bbbe
commit bae5b14adf

View file

@ -451,6 +451,11 @@ def check_protocol_compliance(obj: Any, protocol: Any) -> None:
obj_params.discard("self") obj_params.discard("self")
if not (proto_params <= obj_params): if not (proto_params <= obj_params):
logger.error(f"Method {name} incompatible proto: {proto_params} vs. obj: {obj_params}") logger.error(f"Method {name} incompatible proto: {proto_params} vs. obj: {obj_params}")
logger.error(f"Provider: {obj.__class__.__name__} from module {obj.__class__.__module__}")
logger.error(f"Protocol signature: {proto_sig}")
logger.error(f"Object signature: {obj_sig}")
logger.error(f"Object method: {obj_method}")
logger.error(f"Object method's module: {inspect.getmodule(obj_method)}")
missing_methods.append((name, "signature_mismatch")) missing_methods.append((name, "signature_mismatch"))
else: else:
# Check if the method has a concrete implementation (not just a protocol stub) # Check if the method has a concrete implementation (not just a protocol stub)