Filter DA1 responses from replay buffer on WebSocket connect
The replay buffer can contain DA1/DA2 terminal attribute responses (e.g., \x1b[?1;10;0c) that were captured before filtering was added to the session classes. These responses appear as visible text like '1;10;0c' when sent to the client on reconnect. This adds an additional filter pass when sending the replay buffer, ensuring no DA1 responses reach the client regardless of when they were captured.
This commit is contained in:
@@ -172,10 +172,10 @@ class TestDockerStatsCollector:
|
||||
"""Services can be added dynamically after start."""
|
||||
collector = DockerStatsCollector("/nonexistent")
|
||||
collector._service_names = ["svc1"]
|
||||
|
||||
|
||||
collector.add_service("svc2")
|
||||
assert "svc2" in collector._service_names
|
||||
|
||||
|
||||
# Adding same service again is a no-op
|
||||
collector.add_service("svc2")
|
||||
assert collector._service_names.count("svc2") == 1
|
||||
@@ -183,17 +183,17 @@ class TestDockerStatsCollector:
|
||||
def test_remove_service_dynamic(self):
|
||||
"""Services can be removed dynamically."""
|
||||
from collections import deque
|
||||
|
||||
|
||||
collector = DockerStatsCollector("/nonexistent")
|
||||
collector._service_names = ["svc1", "svc2"]
|
||||
collector._cpu_history["svc1"] = deque([10.0, 20.0])
|
||||
collector._prev_cpu["svc1"] = (100, 200)
|
||||
|
||||
|
||||
collector.remove_service("svc1")
|
||||
assert "svc1" not in collector._service_names
|
||||
assert "svc1" not in collector._cpu_history
|
||||
assert "svc1" not in collector._prev_cpu
|
||||
|
||||
|
||||
# Removing non-existent service is safe
|
||||
collector.remove_service("nonexistent") # Should not raise
|
||||
|
||||
|
||||
Reference in New Issue
Block a user