test(pyamber): add unit test coverage for AddInputChannelHandler - #7750
Merged
aglinxinyuan merged 1 commit intoAug 18, 2026
Merged
Conversation
Add test_add_input_channel_handler.py with 12 tests: delegation to register_input, is_control hash canonicalization of wire-parsed channel ids (dict-key interchangeability, real-InputManager lookups, the data-channel scan), control channels keeping their marker, and default-port (port 0) registration.
Contributor
Automated Reviewer SuggestionsBased on the
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #7750 +/- ##
=========================================
Coverage 91.03% 91.03%
Complexity 4459 4459
=========================================
Files 1174 1174
Lines 47139 47139
Branches 5284 5284
=========================================
Hits 42915 42915
Misses 2549 2549
Partials 1675 1675
*This pull request uses carry forward flags. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Contributor
|
| config | throughput | MB/s | latency | max Δ latest / 7d | |
|---|---|---|---|---|---|
| 🔴 | bs=10 sw=10 sl=64 | 370 | 0.226 | 26,338/31,279/31,279 us | 🟢 -21.5% / 🔴 +105.5% |
| 🟢 | bs=100 sw=10 sl=64 | 786 | 0.48 | 125,039/156,711/156,711 us | 🟢 -13.1% / 🔴 +46.1% |
| ⚪ | bs=1000 sw=10 sl=64 | 911 | 0.556 | 1,094,775/1,152,893/1,152,893 us | ⚪ within ±5% / 🔴 -13.1% |
Baseline details
Latest main 60300e3 from same runner
| config | metric | PR | latest main | 7d avg | Δ latest | Δ 7d |
|---|---|---|---|---|---|---|
| bs=10 sw=10 sl=64 | throughput | 370 tuples/sec | 395 tuples/sec | 779.07 tuples/sec | -6.3% | -52.5% |
| bs=10 sw=10 sl=64 | MB/s | 0.226 MB/s | 0.241 MB/s | 0.476 MB/s | -6.2% | -52.5% |
| bs=10 sw=10 sl=64 | p50 | 26,338 us | 22,619 us | 12,818 us | +16.4% | +105.5% |
| bs=10 sw=10 sl=64 | p95 | 31,279 us | 39,841 us | 15,986 us | -21.5% | +95.7% |
| bs=10 sw=10 sl=64 | p99 | 31,279 us | 39,841 us | 19,339 us | -21.5% | +61.7% |
| bs=100 sw=10 sl=64 | throughput | 786 tuples/sec | 747 tuples/sec | 1,011 tuples/sec | +5.2% | -22.3% |
| bs=100 sw=10 sl=64 | MB/s | 0.48 MB/s | 0.456 MB/s | 0.617 MB/s | +5.3% | -22.2% |
| bs=100 sw=10 sl=64 | p50 | 125,039 us | 129,591 us | 100,965 us | -3.5% | +23.8% |
| bs=100 sw=10 sl=64 | p95 | 156,711 us | 180,273 us | 107,295 us | -13.1% | +46.1% |
| bs=100 sw=10 sl=64 | p99 | 156,711 us | 180,273 us | 115,531 us | -13.1% | +35.6% |
| bs=1000 sw=10 sl=64 | throughput | 911 tuples/sec | 888 tuples/sec | 1,049 tuples/sec | +2.6% | -13.1% |
| bs=1000 sw=10 sl=64 | MB/s | 0.556 MB/s | 0.542 MB/s | 0.64 MB/s | +2.6% | -13.1% |
| bs=1000 sw=10 sl=64 | p50 | 1,094,775 us | 1,124,352 us | 978,248 us | -2.6% | +11.9% |
| bs=1000 sw=10 sl=64 | p95 | 1,152,893 us | 1,182,880 us | 1,021,881 us | -2.5% | +12.8% |
| bs=1000 sw=10 sl=64 | p99 | 1,152,893 us | 1,182,880 us | 1,050,075 us | -2.5% | +9.8% |
Raw CSV
config_idx,batch_size,schema_width,string_len,num_batches,total_ms,total_tuples,total_bytes,tuples_per_sec,mb_per_sec,lat_p50_us,lat_p95_us,lat_p99_us
0,10,10,64,20,540.04,200,128000,370,0.226,26337.50,31279.48,31279.48
1,100,10,64,20,2544.13,2000,1280000,786,0.480,125039.27,156711.22,156711.22
2,1000,10,64,20,21958.15,20000,12800000,911,0.556,1094774.76,1152892.93,1152892.93
aglinxinyuan
approved these changes
Aug 18, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changes were proposed in this PR?
Adds
test_add_input_channel_handler.py(12 tests) forcore/architecture/handlers/control/add_input_channel_handler.py. The handler's three-lineis_controlblock looks like a no-op but is load-bearing:Message.__hash__is patched to hash-of-repr, betterproto's repr omits fields left at their default, and proto3 never putsfalseon the wire — so a data channel'sChannelIdentityarrives==-equal to its canonical form yet hashing differently, andInputManagerkeys its channel registry by that hash.test_main_loop.pydrives AddInputChannel end to end on the happy path but never pins the materialization, so the workaround could regress silently.Every request in the spec is built through a bytes round trip so the handler receives the real wire shape — an in-process request would arrive already canonical and prove nothing. The spec pins:
register_inputis the input manager's only call, with the request's channel and port, and the handler returnsEmptyReturn;register_inputreceives it, asserted by snapshotting the hash inside a side effect — a key inserted at the pre-materialization hash and then mutated in place strands the dict entry;InputManager: the registered channel resolves throughget_port_id, survives theis_controlread thatget_all_data_channel_ids()performs on every key, and is interchangeable as a dict key with an independently built canonical id in both directions;true) and keep their marker, guarding theif notcondition against inversion;PortIdentity()(proto3 omits bothid=0andinternal=False). This is complementary totest_input_manager.py::TestPortIdentityDefaults, which feeds a hand-builtPortIdentity(id=None, internal=None)— a shape no production caller ofregister_inputproduces; the wire shape exercised here is what the two wire-fed callers actually deliver, and it is canonicalized by attribute reads alone, not by theis Nonebranches;Any related issues, documentation, discussions?
Closes #7748.
How was this PR tested?
12 new tests, all green locally:
The only full-suite failures are the pre-existing
core/storage/iceberg/test_iceberg_document.pyitems that need a local catalog stack; they fail identically without this PR.The tests were also mutation-checked: deleting the handler's
is_controlblock, always assigningFalse(guard inversion), canonicalizing afterregister_inputinstead of before, swapping the delegation arguments, dropping the call entirely, and deletingregister_input'sid is Noneguard each turn the expected tests red.Was this PR authored or co-authored using generative AI tooling?
Generated-by: Claude Code (Claude Opus 5)