Skip to content

Commit b2352c8

Browse files
committed
fix: _assemble_workspace_bubble doesn't truly mirror production.
1 parent 24a144b commit b2352c8

1 file changed

Lines changed: 9 additions & 12 deletions

File tree

tests/test_blob_parsing_fuzz.py

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -144,20 +144,17 @@ def _build_store_db_raw(path: str, meta: dict, blobs: dict[str, bytes]) -> None:
144144
def _assemble_workspace_bubble(bubble_id: object, value: object) -> dict | None:
145145
"""Mirror workspace_tabs KV bubble load (json.loads → Bubble.from_dict).
146146
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``.
147+
Matches ``services/workspace_tabs.py`` (bubbleId loop): ``json.loads(row["value"])``
148+
with no type branching — same exceptions as production. Rows with ``value IS NULL``
149+
are not selected in production; ``None`` here returns ``None`` for fuzz only.
150+
151+
Intentionally omits ``_loads_kv_value_logged`` (logging / payload hashing).
150152
"""
153+
if value is None:
154+
return None
151155
try:
152-
if value is None:
153-
return None
154-
if isinstance(value, (bytes, bytearray)):
155-
parsed = json.loads(bytes(value).decode("utf-8"))
156-
elif isinstance(value, str):
157-
parsed = json.loads(value)
158-
else:
159-
parsed = value
160-
except (json.JSONDecodeError, TypeError, ValueError, UnicodeDecodeError):
156+
parsed = json.loads(value) # type: ignore[arg-type]
157+
except (json.JSONDecodeError, TypeError, ValueError):
161158
return None
162159
try:
163160
return Bubble.from_dict(parsed, bubble_id=bubble_id).raw # type: ignore[arg-type]

0 commit comments

Comments
 (0)