diff --git a/docs/pr-media/1834/compression-toast-visible.png b/docs/pr-media/1834/compression-toast-visible.png new file mode 100644 index 00000000..045ba46b Binary files /dev/null and b/docs/pr-media/1834/compression-toast-visible.png differ diff --git a/static/messages.js b/static/messages.js index 75758f7c..52402e5d 100644 --- a/static/messages.js +++ b/static/messages.js @@ -1152,7 +1152,7 @@ function attachLiveStream(activeSid, streamId, uploaded=[], options={}){ } if(typeof _setCompressionSessionLock==='function') _setCompressionSessionLock(null); if(!S.busy&&typeof renderMessages==='function') renderMessages(); - showToast(message||'Context compressed'); + showToast(message||'Context compressed', 8000); }); source.addEventListener('metering',e=>{ diff --git a/tests/test_auto_compression_card.py b/tests/test_auto_compression_card.py index aaac6b7e..a14bf2ef 100644 --- a/tests/test_auto_compression_card.py +++ b/tests/test_auto_compression_card.py @@ -103,6 +103,21 @@ def test_auto_compression_card_reuses_compression_card_renderer(): assert "auto_compress_label" in helper +def test_auto_compression_compressed_sse_showtoast_has_explicit_longer_duration(): + block = _compressed_listener_block() + + assert 'showToast' in block + # Must call showToast with an explicit duration that is meaningfully longer + # than the default (3000 ms) so the compressed event toast is harder to miss. + import re + m = re.search(r'showToast\(.*?,\s*(\d+)\s*\)', block) + assert m is not None, 'showToast call in compressed SSE handler has no explicit duration' + duration = int(m.group(1)) + assert duration >= 8000, ( + f'compressed SSE showToast duration ({duration} ms) must be >= 8000 ms' + ) + + def test_auto_compression_card_survives_compression_session_rotation(): src = _read("static/messages.js")