codeant-ai-for-open-source[bot] commented on code in PR #43678:
URL: https://github.com/apache/superset/pull/43678#discussion_r3885528751


##########
tests/unit_tests/coordination/test_service.py:
##########
@@ -321,3 +321,39 @@ def test_signal_listener_stop_signals_and_joins(mocker: 
MockerFixture) -> None:
 
     assert stop_event.is_set()
     thread.join.assert_called_once_with(timeout=2.0)
+
+
+def test_signal_listener_stop_wakes_before_join(mocker: MockerFixture) -> None:
+    """stop() nudges the wake (so a blocked read returns) before joining."""
+    thread = mocker.MagicMock(name="thread")
+    thread.is_alive.side_effect = [True, False]
+    stop_event = threading.Event()
+    wake = mocker.MagicMock(name="wake")
+
+    SignalListener(thread, stop_event, wake=wake).stop()
+
+    assert stop_event.is_set()
+    wake.assert_called_once_with()
+    thread.join.assert_called_once_with(timeout=2.0)
+
+
+def test_listen_stop_wakes_blocked_backend_read(
+    app_context: None, mocker: MockerFixture
+) -> None:
+    """With a backend, stop() writes a wake entry so a listener parked in a
+    blocking XREAD returns at once instead of waiting out the block 
interval."""
+    backend = mocker.MagicMock(name="backend")
+    backend.stream_last_id.return_value = "0-0"
+    backend.xread.return_value = []  # no entries โ†’ the loop keeps reading
+    mocker.patch.object(CoordinationService, "get_backend", 
return_value=backend)

Review Comment:
   **Suggestion:** The mock returns immediately with an empty result, so this 
test never exercises a listener blocked in `xread`; a broken wake 
implementation could still pass because `stop()` only waits for the bounded 
join and the assertion checks the write independently. Make `xread` block until 
the wake nudge is issued, then assert that the listener thread terminates 
promptly. [possible bug]
   
   <details>
   <summary><b>Severity Level:</b> Minor ๐Ÿงน</summary>
   
   ```mdx
   - โš ๏ธ Backend wake regressions remain undetected.
   - โš ๏ธ Async task teardown coverage misses blocked Redis reads.
   - โš ๏ธ The test does not validate prompt listener termination.
   ```
   </details>
   
   [![Use CodeAnt 
Skill](https://new-codeant-butcket.s3.us-west-1.amazonaws.com/badges/use-codeant-skill-flat-v2.svg)](https://docs.codeant.ai/cli/resolve-pr-comments-skill)
 [![Fix in 
Cursor](https://new-codeant-butcket.s3.us-west-1.amazonaws.com/badges/fix-in-cursor-flat.svg)](https://app.codeant.ai/fix-in-ide?tool=cursor&prompt_id=b26d404266c242c6897c02c6c7a400df&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
 [![Fix in VSCode 
Claude](https://new-codeant-butcket.s3.us-west-1.amazonaws.com/badges/fix-in-vscode-claude-flat.svg)](https://app.codeant.ai/fix-in-ide?tool=vscode-claude&prompt_id=b26d404266c242c6897c02c6c7a400df&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
   <details>
   <summary><b>Prompt for AI Agent ๐Ÿค– </b></summary>
   
   ```mdx
   This is a comment left during a code review.
   
   **Path:** tests/unit_tests/coordination/test_service.py
   **Line:** 348:348
   **Comment:**
        *Possible Bug: The mock returns immediately with an empty result, so 
this test never exercises a listener blocked in `xread`; a broken wake 
implementation could still pass because `stop()` only waits for the bounded 
join and the assertion checks the write independently. Make `xread` block until 
the wake nudge is issued, then assert that the listener thread terminates 
promptly.
   
   Validate the correctness of the flagged issue. If correct, How can I resolve 
this? If you propose a fix, implement it and please make it concise.
   Once fix is implemented, also check other comments on the same PR, and ask 
user if the user wants to fix the rest of the comments as well. if said yes, 
then fetch all the comments validate the correctness and implement a minimal fix
   ```
   </details>
   <a 
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F43678&comment_hash=305344e242f669400520be47deb125098acdfb847fa35d059f477c7a8c2637cb&reaction=like'>๐Ÿ‘</a>
 | <a 
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F43678&comment_hash=305344e242f669400520be47deb125098acdfb847fa35d059f477c7a8c2637cb&reaction=dislike'>๐Ÿ‘Ž</a>



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to