Skip to content

Commit 640c4e9

Browse files
committed
updated with actual tested limits
1 parent 5266abb commit 640c4e9

2 files changed

Lines changed: 14 additions & 14 deletions

File tree

src/runloop_api_client/_constants.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@
1414
MAX_RETRY_DELAY = 60.0
1515

1616
# Maximum allowed size (in bytes) for individual entries in `file_mounts` when creating Blueprints
17-
# NOTE: Capped at ~786,000 bytes to align with the approximate macOS maximum
18-
# shell command length when embedding base64-encoded content. Since base64 is
19-
# ASCII, bytes ≈ characters here, and we measure size using UTF-8 encoding.
20-
FILE_MOUNT_MAX_SIZE_BYTES = 786_000
17+
# NOTE: Empirically, ~131,000 is the maximum command length after
18+
# base64 encoding; 98,250 is the pre-encoded limit that stays within that bound.
19+
# We measure size in bytes using UTF-8 encoding; base64 output is ASCII.
20+
FILE_MOUNT_MAX_SIZE_BYTES = 98_250
2121

2222
# Maximum allowed total size (in bytes) across all `file_mounts` when creating Blueprints
2323
FILE_MOUNT_TOTAL_MAX_SIZE_BYTES = 786_000 * 10 # ~10 mb

tests/api_resources/test_blueprints.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -110,8 +110,8 @@ def test_streaming_response_create(self, client: Runloop) -> None:
110110

111111
@parametrize
112112
def test_create_rejects_large_file_mount(self, client: Runloop) -> None:
113-
# 786,000 bytes + 1 byte
114-
too_large_content = "a" * (786_000 + 1)
113+
# 98,250 bytes + 1 byte (pre-encoded limit to stay within ~131,000 b64'd)
114+
too_large_content = "a" * (98_250 + 1)
115115
with pytest.raises(ValueError, match=r"over the limit"):
116116
client.blueprints.create(
117117
name="name",
@@ -120,9 +120,9 @@ def test_create_rejects_large_file_mount(self, client: Runloop) -> None:
120120

121121
@parametrize
122122
def test_create_rejects_total_file_mount_size(self, client: Runloop) -> None:
123-
# Ten files at exactly per-file max, plus 1 extra byte to exceed total limit
124-
per_file_max = 786_000
125-
file_mounts = {f"/tmp/{i}.txt": "a" * per_file_max for i in range(10)}
123+
# Eighty files at per-file max (98,250) equals current total limit; add 1 byte to exceed
124+
per_file_max = 98_250
125+
file_mounts = {f"/tmp/{i}.txt": "a" * per_file_max for i in range(80)}
126126
file_mounts["/tmp/extra.txt"] = "x"
127127
with pytest.raises(ValueError, match=r"total file_mounts size .* over the limit"):
128128
client.blueprints.create(
@@ -560,8 +560,8 @@ async def test_streaming_response_create(self, async_client: AsyncRunloop) -> No
560560

561561
@parametrize
562562
async def test_create_rejects_large_file_mount(self, async_client: AsyncRunloop) -> None:
563-
# 786,000 bytes + 1 byte
564-
too_large_content = "a" * (786_000 + 1)
563+
# 98,250 bytes + 1 byte (pre-encoded limit to stay within ~131,000 b64'd)
564+
too_large_content = "a" * (98_250 + 1)
565565
with pytest.raises(ValueError, match=r"over the limit"):
566566
await async_client.blueprints.create(
567567
name="name",
@@ -570,9 +570,9 @@ async def test_create_rejects_large_file_mount(self, async_client: AsyncRunloop)
570570

571571
@parametrize
572572
async def test_create_rejects_total_file_mount_size(self, async_client: AsyncRunloop) -> None:
573-
# Ten files at exactly per-file max, plus 1 extra byte to exceed total limit
574-
per_file_max = 786_000
575-
file_mounts = {f"/tmp/{i}.txt": "a" * per_file_max for i in range(10)}
573+
# Eighty files at per-file max (98,250) equals current total limit; add 1 byte to exceed
574+
per_file_max = 98_250
575+
file_mounts = {f"/tmp/{i}.txt": "a" * per_file_max for i in range(80)}
576576
file_mounts["/tmp/extra.txt"] = "x"
577577
with pytest.raises(ValueError, match=r"total file_mounts size .* over the limit"):
578578
await async_client.blueprints.create(

0 commit comments

Comments
 (0)