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

   ### What changes were proposed in this PR?
   
   Adds 
`amber/src/test/python/core/architecture/handlers/control/test_assign_port_handler.py`
 (14 test functions, 16 collected), the first dedicated tests for the Python 
worker's `AssignPort` RPC handler. Sibling handlers in the same package already 
have test files; this handler's only driver was `test_main_loop.py`, whose 
`AssignPortRequest` fixtures pass no `storage_uris`/`partitionings`, so the 
per-URI channel registration loop never executed and the output branch ran only 
as setup.
   
   Covered behavior:
   
   - Input branch: `add_input_port` receives the port id, the wrapped `Schema`, 
and the `storage_uris`/`partitionings` lists verbatim; one data channel is 
registered per URI, in URI order, with the reader identity derived by 
`get_from_actor_id_for_input_port_storage`, this worker as the target, and 
`is_control` false; with no URIs nothing is registered. Unlike the output 
branch there is no truthiness guard, so an empty-string URI still registers a 
channel — the Scala worker behaves the same, pinned as a cross-language 
symmetry.
   - Output branch: no URIs and an empty-string URI both yield 
`storage_uri_base=None` (the production coordinator really sends `[""]` for a 
storage-less output port — `RegionExecutionManager` falls back to 
`.getOrElse("")`), a single URI is passed through, and every URI after the 
first is dropped (pinned as current behavior).
   - Both branches return `EmptyReturn`, wrap `req.schema` into a value-equal 
`Schema`, and leave the other manager untouched; an `AssignPortRequest` built 
without the `storage_uris` field iterates as an empty repeated field.
   
   The harness follows `test_start_worker_handler.py`: `asyncio.run` per test, 
`SimpleNamespace` context with `MagicMock` managers, no production code changes.
   
   ### Any related issues, documentation, discussions?
   
   Closes #7371.
   
   ### How was this PR tested?
   
   85 passed (69 baseline + 16 new). An independent review applied 14 targeted 
mutations to the handler (branch swap, dropped registration loop, swapped 
channel endpoints, `is_control` flip, reordered/emptied lists, wrong URI index, 
dropped or added truthiness guards on either branch, `None` base, `None` 
return, empty schema in each branch, wrong port id, fully stubbed body) — every 
mutation is killed by at least one test. `black --check` and `ruff check` are 
clean.
   
   ### Was this PR authored or co-authored using generative AI tooling?
   
   Co-authored by: Claude Code (Fable 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