Skip to content

Commit 24a144b

Browse files
committed
fix: resolve findings from coderabbitai's review report
1 parent 8d0f297 commit 24a144b

1 file changed

Lines changed: 15 additions & 5 deletions

File tree

tests/test_blob_parsing_fuzz.py

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
import tempfile
1515
import unittest
1616

17-
from hypothesis import given, settings
17+
from hypothesis import HealthCheck, given, settings
1818
from hypothesis import strategies as st
1919

2020
REPO_ROOT = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
@@ -26,7 +26,7 @@
2626
classify_blob_data,
2727
messages_to_bubbles,
2828
traverse_blobs,
29-
_extract_blob_refs,
29+
_extract_blob_refs, # internal helper; covered directly alongside classify_blob_data
3030
)
3131
from utils.text_extract import extract_text_from_bubble
3232

@@ -76,7 +76,7 @@
7676

7777

7878
@st.composite
79-
def _cli_message(draw) -> dict:
79+
def _cli_message(draw):
8080
# Empty role is intentional adversarial input (unknown / missing role).
8181
role = draw(st.sampled_from(["user", "assistant", "system", "tool", ""]))
8282
content = draw(
@@ -142,7 +142,12 @@ def _build_store_db_raw(path: str, meta: dict, blobs: dict[str, bytes]) -> None:
142142

143143

144144
def _assemble_workspace_bubble(bubble_id: object, value: object) -> dict | None:
145-
"""Mirror workspace_tabs KV bubble load (json.loads → Bubble.from_dict)."""
145+
"""Mirror workspace_tabs KV bubble load (json.loads → Bubble.from_dict).
146+
147+
Intentionally re-implements the conversion instead of importing
148+
``_loads_kv_value_logged`` (logging / payload hashing side effects).
149+
Keep in sync with the bubbleId load loop in ``services/workspace_tabs.py``.
150+
"""
146151
try:
147152
if value is None:
148153
return None
@@ -246,10 +251,15 @@ def test_classify_blob_data_never_raises(self, data: bytes) -> None:
246251
extra_ids=st.lists(_BLOB_ID_HEX, max_size=6, unique=True),
247252
payloads=st.lists(st.binary(max_size=1024), min_size=1, max_size=8),
248253
)
249-
@settings(max_examples=40, deadline=None)
254+
@settings(
255+
max_examples=40,
256+
deadline=None,
257+
suppress_health_check=[HealthCheck.too_slow],
258+
)
250259
def test_traverse_blobs_never_raises(
251260
self, root_id: str, extra_ids: list[str], payloads: list[bytes]
252261
) -> None:
262+
# CliSessionMeta only requires latestRootBlobId (str); BFS runs after meta parse.
253263
meta = {"latestRootBlobId": root_id, "createdAt": 1_700_000_000_000}
254264
blobs: dict[str, bytes] = {root_id: payloads[0]}
255265
for i, bid in enumerate(extra_ids):

0 commit comments

Comments
 (0)