eugenegujing opened a new pull request, #7061:
URL: https://github.com/apache/texera/pull/7061

   ### What changes were proposed in this PR?
   
   Adds 
`amber/src/test/python/core/architecture/handlers/control/test_start_worker_handler.py`,
 the first test for `StartWorkerHandler`. Nothing under `amber/src/test/python` 
referenced the handler, and `test_main_loop.py` bypasses it by enqueueing 
`StartChannel`/`EndChannel` elements directly, so none of its three branches 
were asserted. Six sibling handlers in the same package already have direct 
tests.
   
   Four tests run against real collaborators -- a `StateManager` built on the 
production transition graph and a real `InputManager` sharing the context's 
`InternalQueue` -- rather than mocks, because they pin behavior mocks cannot 
express: a rejected transition from `UNINITIALIZED` leaves the queue, the state 
and the `InputManager` untouched; the two markers are routed to the data 
sub-queue and are therefore subject to `disable_data` gating; and the response 
version tracks the real state clock rather than a constant.
   
   `test_double_start_enqueues_a_second_pair_of_markers` deliberately pins 
observed current behavior rather than correctness. `StateManager.transit_to` 
returns early when the target equals the current state, so a second 
`StartWorker` is a silent no-op on the state and appends another marker pair -- 
including a second `PORT_ALIGNMENT` `EndChannel` on the same port. The test 
comment says so and asks for a rewrite if an idempotency guard is ever added.
   
   Test-only change; no production code is touched.
   
   ### Any related issues, documentation, discussions?
   
   Closes #7058.
   
   The real-collaborator tests double as a Python-side guard against the 
stale-state-snapshot family of bugs described in #6010 
(`WorkerExecution.scala:56`); a mocked `get_state_with_version` returns a 
constant and cannot catch a hoisted snapshot.
   
   ### How was this PR tested?
   
   New unit tests only; no production behavior changes.
   
   ```
   cd amber
   pytest src/test/python/core/architecture/handlers/ -q
   ```
   
   - 19 test functions / 21 cases; the handlers package goes from 46 to 67 
passing tests.
   - `black --check` and `ruff check` clean.
   
   ### Was this PR authored or co-authored using generative AI tooling?
   
   Generated-by: Claude Code (Opus 5)
   


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