@@ -156,6 +156,9 @@ def show_graph(
156156 make_state_node (s , state_interfaces )
157157 make_command_node (s , command_interfaces )
158158
159+ # Set of (consumer_ctrl, short_iface) pairs whose state comes from another controller
160+ exp_state_consumers = {(consumer_ctrl , iface ) for _ , consumer_ctrl , iface in exp_state_edges }
161+
159162 for source_ctrl , consumer_ctrl , iface in exp_state_edges :
160163 s .edge (
161164 "{}:{}" .format (source_ctrl , "controller_start_exp_state_" + iface ),
@@ -171,10 +174,12 @@ def show_graph(
171174 "{}:{}" .format (target_ctrl , "controller_end_" + iface ),
172175 )
173176 for state_connection in state_connections [controller_name ]:
174- s .edge (
175- "{}:{}" .format ("state_interfaces" , "state_start_" + state_connection ),
176- "{}:{}" .format (controller_name , "state_end_" + state_connection ),
177- )
177+ # Only draw hw edge if this interface is not sourced from another controller's exp state
178+ if (controller_name , state_connection ) not in exp_state_consumers :
179+ s .edge (
180+ "{}:{}" .format ("state_interfaces" , "state_start_" + state_connection ),
181+ "{}:{}" .format (controller_name , "state_end_" + state_connection ),
182+ )
178183 for command_connection in command_connections [controller_name ]:
179184 s .edge (
180185 "{}:{}" .format (controller_name , "command_start_" + command_connection ),
@@ -234,12 +239,15 @@ def parse_response(list_controllers_response, list_hardware_response, visualize=
234239 hw_cmds .add (cmd_iface )
235240 command_connections [controller .name ] = hw_cmds
236241
237- # Classify required_state_interfaces as hw or consumed exported state
238- hw_states = set ()
242+ # All required state interfaces need input ports; strip controller prefix for exp- state ones
243+ ctrl_states = set ()
239244 for state_iface in controller .required_state_interfaces :
240- if state_iface not in exported_state_owners :
241- hw_states .add (state_iface )
242- state_connections [controller .name ] = hw_states
245+ if state_iface in exported_state_owners :
246+ _ , short_iface = exported_state_owners [state_iface ]
247+ ctrl_states .add (short_iface )
248+ else :
249+ ctrl_states .add (state_iface )
250+ state_connections [controller .name ] = ctrl_states
243251
244252 # Build edges for (exp state) → (state): controller exports state that another controller reads
245253 exp_state_edges = []
0 commit comments