[remote_base] Make protocol methods non-virtual and size receiver lists from codegen (#19084)

This commit is contained in:
J. Nick Koston
2026-09-11 14:12:40 -05:00
committed by GitHub
parent 6a21ab4ea7
commit 37e9b2b7af
60 changed files with 606 additions and 201 deletions
+25
View File
@@ -187,6 +187,31 @@ def test_slot_counter_emits_requested_count() -> None:
assert _define_value("TEST_SLOT_COUNT") == "2"
def test_slot_counter_keyed_emits_largest_count() -> None:
"""Keyed requests size storage every key declares at the same capacity:
the define is the busiest key's count, not the total over all keys."""
request = ch.slot_counter("TEST_SLOT_COUNT_KEYED")
request("rx_a")
request("rx_a")
request("rx_a")
request("rx_b")
assert ch.get_slot_count("TEST_SLOT_COUNT_KEYED") == 3
ch.CORE.flush_tasks()
assert _define_value("TEST_SLOT_COUNT_KEYED") == "3"
def test_slot_counter_rejects_mixed_keyed_and_unkeyed_requests() -> None:
"""A keyed and an unkeyed request for one define cannot be sized together."""
request = ch.slot_counter("TEST_SLOT_COUNT_MIXED")
request("rx_a")
with pytest.raises(ValueError, match="TEST_SLOT_COUNT_MIXED"):
request()
unkeyed = ch.slot_counter("TEST_SLOT_COUNT_MIXED_2")
unkeyed()
with pytest.raises(ValueError, match="TEST_SLOT_COUNT_MIXED_2"):
unkeyed("rx_a")
def test_slot_counter_without_requests_emits_nothing() -> None:
"""No requests, no job, no define — the guarded storage compiles out."""
ch.slot_counter("TEST_SLOT_COUNT_UNUSED")