Add Hypothesis property tests for blob/bubble parsing (#71)#81
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (5)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughAdds Hypothesis to dev dependencies and CI, ignores Hypothesis artifacts, centralizes blob classification and publicizes extract_blob_refs, coerces bubble text to str, and adds Hypothesis fuzz tests for bubble parsing, blob-chain traversal, and text extraction. ChangesProperty-Based Testing for Blob Parsing
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@tests/test_blob_parsing_fuzz.py`:
- Around line 158-160: In _assemble_workspace_bubble the branch that checks if
not isinstance(bubble_id, str) calls Bubble.from_dict(parsed,
bubble_id=bubble_id) which will raise SchemaError via require_non_empty_str, so
the subsequent return None is dead code; remove the unreachable "return None"
after Bubble.from_dict in _assemble_workspace_bubble so control flow relies on
the existing SchemaError handling and the outer except SchemaError that already
returns None.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: e10ebaad-910d-447a-a14b-601a0a2b0f21
📒 Files selected for processing (7)
.github/workflows/tests.yml.gitignoreREADME.mdpyproject.tomltests/test_blob_parsing_fuzz.pyutils/cli_chat_reader.pyutils/text_extract.py
…e_id isn’t a str.
|
@coderabbitai review this PR. |
|
Tip For best results, initiate chat on the files or code changes. 🧩 Analysis chain🏁 Script executed: #!/bin/bash
echo "=== tests/test_blob_parsing_fuzz.py ==="
cat tests/test_blob_parsing_fuzz.py
echo ""
echo "=== utils/cli_chat_reader.py ==="
cat utils/cli_chat_reader.py
echo ""
echo "=== utils/text_extract.py ==="
cat utils/text_extract.py
echo ""
echo "=== pyproject.toml ==="
cat pyproject.toml
echo ""
echo "=== .github/workflows/tests.yml ==="
cat .github/workflows/tests.yml
echo ""
echo "=== README.md ==="
cat README.md
echo ""
echo "=== .gitignore (last 20 lines) ==="
tail -20 .gitignore
echo ""
echo "=== models/conversation.py (Bubble class) ==="
cat models/conversation.py 2>/dev/null || fd -e py -g '*conversation*' --exec cat {}
echo ""
echo "=== services/workspace_tabs.py ==="
cat services/workspace_tabs.py 2>/dev/null || fd -e py -g '*workspace_tabs*' --exec cat {}
echo ""
echo "=== Directory structure ==="
tree -L 3 --gitignore 2>/dev/null || find . -maxdepth 3 -not -path './.git/*' | sortLength of output: 94416
PR Review: Add Hypothesis property tests for blob/bubble parsing (
|
| Severity | Item |
|---|---|
| 🔴 | test_traverse_blobs_never_raises: meta fixture may always trigger SchemaError, never reaching BFS |
| 🟡 | Missing suppress_health_check=[HealthCheck.too_slow] for SQLite-creating test |
| 🟡 | _assemble_workspace_bubble reimplements production logic without a sync note |
| 🟡 | @st.composite _cli_message return annotation should be SearchStrategy[dict] |
| 🟢 | classify_blob_data refactor — clean, correct |
| 🟢 | extract_text_from_bubble str-coercion fix — correct |
| 🟢 | Bounded strategies + deadline=None — appropriate for CI |
Summary
tests/test_blob_parsing_fuzz.pywith Hypothesis property tests for the blob/bubble parsing pipeline (closes Add fuzz/property-based tests for blob parsing #71).Bubble.from_dict(including adversarial non-dict inputs and invalidbubble_idtypes), workspace-tabs-style KV assembly (json.loads→Bubble.from_dict), CLI blob chain parsing (classify_blob_data,_extract_blob_refs,traverse_blobson generatedstore.dbfixtures), and text extraction (extract_text_from_bubble,messages_to_bubbles).classify_blob_data()inutils/cli_chat_reader.pysotraverse_blobsand fuzz tests use the same JSON-vs-chain classification logic.extract_text_from_bubbleto always returnstrwhentextis a non-string truthy value.hypothesis>=6.100,<7to[project.optional-dependencies].devinpyproject.tomland installs it in CI alongside pytest.pip install -e ".[dev]"in the README and ignores.hypothesis/in.gitignore.Test plan
python -m unittest tests.test_blob_parsing_fuzz -vpython -m unittest discover tests -v(full suite, including new fuzz tests)Notes
hypothesis,pytest,mypy) are not added torequirements.txt/requirements-lock.txt(same pattern as pytest today).Summary by CodeRabbit
Documentation
Bug Fixes
Tests
Chores