Yicong-Huang opened a new pull request, #4526:
URL: https://github.com/apache/texera/pull/4526

   ### What changes were proposed in this PR?
   
   Fixes the recurring CI flake in 
`core/runnables/test_main_loop.py::TestMainLoop::test_main_loop_thread_can_align_ecm`.
   
   **Root cause** (not a race — deterministic priority):
   
   ```python
   input_queue.put(ECMElement(tag=mock_control_input_channel, 
payload=test_ecm))   # 1
   input_queue.put(mock_binary_data_element)                                    
    # 2
   input_queue.put(ECMElement(tag=mock_data_input_channel, payload=test_ecm))   
   # 3 -> aligns ECM, runs NoOperation
   output_data_element: DataElement = output_queue.get()    # ASSUMES data first
   ```
   
   `output_queue` is a `LinkedBlockingMultiQueue` whose sub-queues are keyed by 
channel with **priority 1 for control** and **priority 2 for data** 
(`internal_queue.py:80`). MainLoop puts these in order: data → NoOperation 
reply. Whichever is in the queue when the test calls `.get()` decides what 
comes out first:
   
   - Fast machine → test pops between the two puts → only data is queued → data 
comes out → ✅
   - Slow CI → both items queued before pop → priority returns control reply 
first → ❌ `is_control=True` mismatch
   
   Production behavior is correct: control should outrank data on egress.
   
   **Fix**: drain both items and identify each by type (`DataElement` vs 
`DCMElement`), assert each independently. No production change.
   
   ### Any related issues, documentation, discussions?
   
   Closes #4524. Has been hitting unrelated PRs (#4512, #4520).
   
   ### How was this PR tested?
   
   ```
   $ python -m pytest 
core/runnables/test_main_loop.py::TestMainLoop::test_main_loop_thread_can_align_ecm
   ```
   
   Ran 30 consecutive iterations locally — 30 PASS, 0 FAIL.
   
   `ruff format --check .` and `ruff check .` clean.
   
   ### Was this PR authored or co-authored using generative AI tooling?
   
   Generated-by: Claude Code (Opus 4.7)


-- 
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]

Reply via email to