diff --git a/src/energysphere/energi_bridge.py b/src/energysphere/energi_bridge.py index 64d49cc..0cb0b18 100644 --- a/src/energysphere/energi_bridge.py +++ b/src/energysphere/energi_bridge.py @@ -52,7 +52,7 @@ class EnergiBridgeMapper: ) # --- Additional helpers for richer IR coverage --- - def map_shared_variable(self, sv: "SharedVariable") -> Dict[str, Any]: # type: ignore[name-defined] + def map_shared_variable(self, sv: Any) -> Dict[str, Any]: # be resilient to different shapes """Map a SharedVariable (or similar) to a canonical IR representation.""" return { "type": "SharedVariable", @@ -62,14 +62,15 @@ class EnergiBridgeMapper: "privacy_bound": getattr(sv, "privacy_bound", None), } - def map_plan_delta(self, delta: "PlanDelta") -> Dict[str, Any]: # type: ignore[name-defined] + def map_plan_delta(self, delta: Any) -> Dict[str, Any]: # be resilient to different shapes """Map a PlanDelta to a canonical IR representation.""" return { "type": "PlanDelta", "delta_id": getattr(delta, "delta_id", ""), "changes": getattr(delta, "changes", {}), "timestamp": getattr(delta, "timestamp", 0.0), - "author": getattr(delta, "delta_id", ""), + # Prefer an explicit author field if present; otherwise fall back to delta_id + "author": getattr(delta, "author", getattr(delta, "delta_id", "")), }