Bug Report
File: metaflow/util.py, line 387
Summary
compress_list([]) legitimately returns "" (joining an empty list).
However, decompress_list("") immediately crashes with IndexError
because lststr[0] is accessed with no guard for empty input.
This makes the natural round-trip decompress_list(compress_list([]))
crash, breaking the contract that these two functions are inverses of
each other.
Reproducer
from metaflow.util import compress_list, decompress_list
print(compress_list([])) # returns ""
decompress_list(compress_list([])) # IndexError: string index out of range
Stack trace
File "metaflow/util.py", line 387, in decompress_list
if lststr[0] == zlibmarker:
IndexError: string index out of range
**Expected behavior**
`decompress_list(compress_list([]))` returns `[]`.
**Actual behavior**
`IndexError: string index out of range` at `lststr[0]`.
**Root cause**
Line 387 accesses `lststr[0]` with no guard for empty string.
An empty task ID list is a valid real-world state.
**Environment**
- Metaflow: latest master
- Python: 3.11+
Bug Report
File:
metaflow/util.py, line 387Summary
compress_list([])legitimately returns""(joining an empty list).However,
decompress_list("")immediately crashes withIndexErrorbecause
lststr[0]is accessed with no guard for empty input.This makes the natural round-trip
decompress_list(compress_list([]))crash, breaking the contract that these two functions are inverses of
each other.
Reproducer
Stack trace
File "metaflow/util.py", line 387, in decompress_list
if lststr[0] == zlibmarker: