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

   ### What changes were proposed in this PR?
   
   This PR extends 
`amber/src/test/python/core/architecture/packaging/test_output_manager.py` (10 
→ 39 tests) to give the Python worker's `OutputManager` direct semantic 
assertions. Nearly every line of `output_manager.py` already executes under 
`test_main_loop.py`'s end-to-end tests, but the behaviors below had no direct 
assertion anywhere in `amber/src/test/python` — the end-to-end suite reaches 
`add_partitioning` only through a fixture that sends `OneToOnePartitioning` and 
asserts an `EmptyReturn`, `emit_state` appears in the test tree solely as a 
monkeypatch target, and `test_partitioners.py` constructs partitioners directly 
rather than through the dispatch table.
   
   - `save_tuple_to_storage_if_needed`: mirrors the five shapes its twin 
`save_state_to_storage_if_needed` already had — no-writer no-op, unknown-port 
no-op (asserting the other port's queue stays untouched), fan-out to every port 
when `port_id` is omitted, the single-selected-port path, and that the exact 
tuple object is enqueued unconverted; plus `close_port_storage_writers` 
stopping the tuple threads.
   - `add_output_port`: the `port_id.id` None→0 and `internal` None→False 
normalizations, the "each port can only be added once" guard, and that a 
storage writer is only set up when a storage URI is given — all against a real 
`OutputManager` rather than the `MagicMock` the handler tests use.
   - `add_partitioning`: all five `Partitioning`→`Partitioner` dispatch-table 
entries driven through `OutputManager` (parametrized), registration of only the 
channels sent from this worker, `is_control` None→False canonicalization, and 
`OneToOnePartitioner`'s receiver selection by worker id.
   - Emit chain: `tuple_to_batch` batching below/at batch size and fan-out to 
every partitioner (frame contents asserted via `to_pydict`), `tuple_to_frame` 
serialization against the port schema, `emit_ecm` flushing the pending batch 
before passing the ECM through by identity, and `emit_state` flush ordering, 
`StateFrame` wrapping and loop-column defaults.
   - Query methods: `is_missing_output_ports`, `get_port_ids` ordering, and 
`get_output_channel_ids` listing `add_partitioning`'s registrations.
   
   One pre-existing test is strengthened: 
`test_recreates_result_and_state_tables_and_reopens_writer` now asserts the 
(uri, schema) pairing of `create_document` calls instead of the URI set alone, 
so swapping the result/state schemas can no longer pass. No production code is 
changed.
   
   ### Any related issues, documentation, discussions?
   
   Closes #7813
   
   ### How was this PR tested?
   
   All tests in this PR are new or strengthened unit tests; run them from 
`amber/src/main/python` with `python -m pytest 
../../test/python/core/architecture/packaging/ -q` — 62 passed (39 in the 
extended file, including the 10 pre-existing ones unchanged in behavior). The 
suite is hermetic (no Arrow Flight, no Iceberg; storage writers are stubbed at 
the writer-triple boundary) and was verified stable across repeated runs. Each 
key assertion was mutation-checked: thirteen distinct hand-applied production 
mutations (dispatch-entry swaps, removal of each None normalization, removal of 
the once-only guard and channel filter, skipping the pending-batch flush, 
dropping the loop bookkeeping, gutting the fan-out, and swapping the 
result/state schemas) each turned exactly the intended test red, and every 
mutation was reverted byte-exact.
   
   ### Was this PR authored or co-authored using generative AI tooling?
   
   Generated-by: Claude Code (Claude 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