Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions devcycle_python_sdk/managers/config_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,9 +128,8 @@ def run(self):
time.sleep(self._options.config_polling_interval_ms / 1000.0)

def sse_message(self, message: ld_eventsource.actions.Event):
if self._sse_connected is False:
self._sse_connected = True
logger.info("DevCycle: Connected to SSE stream")
if not self._sse_connected:
self.sse_state(None)
logger.info(f"DevCycle: Received message: {message.data}")
sse_message = json.loads(message.data)
dvc_data = json.loads(sse_message.get("data"))
Expand All @@ -145,9 +144,11 @@ def sse_message(self, message: ld_eventsource.actions.Event):
def sse_error(self, error: ld_eventsource.actions.Fault):
logger.debug(f"DevCycle: Received SSE error: {error}")

def sse_state(self, state: ld_eventsource.actions.Start):
self._sse_connected = True
logger.info("DevCycle: Connected to SSE stream")
def sse_state(self, state: Optional[ld_eventsource.actions.Start]):
Copy link

Copilot AI Dec 11, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Type signature inconsistency detected. The SSEManager constructor expects handle_state to be of type Callable[[ld_eventsource.actions.Start], None] (line 15 in sse_manager.py), but the sse_state method signature has been changed to accept Optional[ld_eventsource.actions.Start]. The SSEManager type hints should be updated to reflect this change, using Optional[ld_eventsource.actions.Start] instead of just ld_eventsource.actions.Start.

Copilot uses AI. Check for mistakes.
# Prevents duplicate logs when Comment events call this repeatedly
if not self._sse_connected:
self._sse_connected = True
logger.info("DevCycle: Connected to SSE stream")
Comment on lines 152 to 155
Copy link

Copilot AI Dec 11, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The new behavior introduced in sse_state() and sse_message() (handling Comment events and calling sse_state with None) lacks test coverage. Consider adding tests that verify the SSE connection state is correctly set when receiving Comment events before Start events, and when receiving Event messages before Start events.

Copilot uses AI. Check for mistakes.

def close(self):
self._polling_enabled = False
Loading