refactor(signal): hygiene cleanups around constants, typing, and config
- Hoist the cell-strip patterns to module level so they match the rest of the module's regex style and aren't reparsed on every call. - Type the markdown transform callback and the mention id walker so the inline Callable signature is no longer an untyped Any. - Add _HTTP_TIMEOUT_SECONDS alongside the other class-level tunables. - Reject group_message_buffer_size <= 0 in a Pydantic field_validator rather than silently disabling the buffer at write time. - Mark SignalConfig.allow_from as a computed_field so it shows up in model_dump() instead of being invisible to serialization. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
committed by
Xubin Ren
co-authored by
Claude Opus 4.7
parent
96eb3b7194
commit
ca72f6b6c9
@@ -448,10 +448,13 @@ class TestGroupBuffer:
|
||||
ch._add_to_group_buffer("g1", "Alice", "+1111", f"msg{i}", i)
|
||||
assert len(ch._group_buffers["g1"]) == 3
|
||||
|
||||
def test_zero_buffer_size_does_not_add(self):
|
||||
ch = _make_channel(group_buffer_size=0)
|
||||
ch._add_to_group_buffer("g1", "Alice", "+1111", "msg", 1000)
|
||||
assert "g1" not in ch._group_buffers
|
||||
def test_zero_buffer_size_rejected_by_validator(self):
|
||||
with pytest.raises(ValueError, match="group_message_buffer_size"):
|
||||
_make_channel(group_buffer_size=0)
|
||||
|
||||
def test_negative_buffer_size_rejected_by_validator(self):
|
||||
with pytest.raises(ValueError, match="group_message_buffer_size"):
|
||||
_make_channel(group_buffer_size=-1)
|
||||
|
||||
def test_context_limits_message_length(self):
|
||||
ch = _make_channel(group_buffer_size=5)
|
||||
|
||||
Reference in New Issue
Block a user