aboutsummaryrefslogtreecommitdiffstats
path: root/packages/meshbay-hub/tests/test_playlist_store.py
diff options
context:
space:
mode:
authorChristophe Besson <cbesson@gmail.com>2026-09-16 17:51:19 +0200
committerChristophe Besson <cbesson@gmail.com>2026-09-16 17:51:19 +0200
commit929bfcccf8928a30d86d48a8b0137db0dd4a1ee0 (patch)
treea22966059d22cccd60238752406f98a58304ec16 /packages/meshbay-hub/tests/test_playlist_store.py
parentc35f3a73eb68cdd7c4179cded3d1ead63ec5a033 (diff)
downloadmeshbay-929bfcccf8928a30d86d48a8b0137db0dd4a1ee0.tar.gz
playlists: promise the count that holds when nothing compresses
The ceiling is 1200 tracks on a library that repeats and 660 on one that never does; the message said 1000, which would send a reader back into the wall at 660. It says 500, measured at both ends. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Diffstat (limited to 'packages/meshbay-hub/tests/test_playlist_store.py')
-rw-r--r--packages/meshbay-hub/tests/test_playlist_store.py31
1 files changed, 25 insertions, 6 deletions
diff --git a/packages/meshbay-hub/tests/test_playlist_store.py b/packages/meshbay-hub/tests/test_playlist_store.py
index ce094c4..701de41 100644
--- a/packages/meshbay-hub/tests/test_playlist_store.py
+++ b/packages/meshbay-hub/tests/test_playlist_store.py
@@ -286,17 +286,36 @@ def test_what_a_playlist_costs_sealed_is_measured_not_quoted(steps):
"""The ceiling the UI promises comes from here, not from the design doc.
§4 measured ~270 bytes a track *raw* and ~60 *sealed*; the raw figure was
- then read for the sealed one and "about 225 tracks" written down, which is
- five times too strict. So the number is measured where it is used.
+ read for the sealed one and "about 225 tracks" written down, which is five
+ times too strict. So it is measured where it is used.
"""
sizes = steps["what a playlist costs sealed"]["sizes"]
per_track = (sizes["1000"] - sizes["100"]) / 900
assert 30 < per_track < 90, f"a track now costs {per_track:.0f} sealed bytes"
- # The sentence shown to a reader is "playlists of about 1000 tracks". If
- # compression regresses, or a field is added to what is stored, that
- # sentence becomes false — and this is what says so.
assert sizes["1000"] < 62 * 1024, (
- f"a thousand tracks no longer fit in one frame: {sizes['1000']} bytes")
+ f"a thousand ordinary tracks no longer fit in one frame: {sizes['1000']}")
+
+
+def test_the_promised_count_holds_for_a_library_that_never_repeats(steps):
+ """The number in the message has to survive the worst compression, not the
+ friendly one.
+
+ Everything deflate saves here comes from repetition — the same artist, the
+ same album, the same folder, over and over. A library that never repeats
+ costs nearly twice as much a track, and the two ceilings are 1200 and 660.
+ A reader told to split at 1000 would hit the wall again at 660; the message
+ says 500, and this is what keeps it true.
+ """
+ diverse = steps["what a playlist costs sealed"]["diverse"]
+ per_track = (diverse["1000"] - diverse["100"]) / 900
+ assert per_track > (
+ (steps["what a playlist costs sealed"]["sizes"]["1000"]
+ - steps["what a playlist costs sealed"]["sizes"]["100"]) / 900), (
+ "the harsh fixture compresses as well as the ordinary one — "
+ "it is not measuring the worst case any more")
+ assert diverse["500"] < 62 * 1024, (
+ f"500 tracks of wholly unrepeating metadata no longer fit: "
+ f"{diverse['500']} bytes, at {per_track:.0f} a track")
def test_a_playlist_too_large_for_a_frame_is_named(steps):