fix(langchain): coerce None in format_store_content#2524
Conversation
Avoid TypeError when store-tool confirmation formats None placeholders for nl/sql or a non-list tags argument.
Walkthrough
ChangesStore content formatting
Estimated code review effort: 1 (Trivial) | ~5 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
sdk/wren-langchain/tests/unit/test_format_store_content.py (1)
26-34: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winCover non-None non-string text inputs.
The tests exercise the
Nonebranches, but not thestr(nl)/str(sql)coercion paths described by the PR objective. Add a case such as integers to prevent regressions.Suggested test
+def test_format_store_content_non_string_text() -> None: + out = _fmt.format_store_content(123, 456, []) + assert 'Stored: "123"' in out + assert "456" in out🤖 Prompt for 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. In `@sdk/wren-langchain/tests/unit/test_format_store_content.py` around lines 26 - 34, Add a unit test for format_store_content covering non-None, non-string nl and sql inputs such as integers, and assert their string-coerced values appear in the formatted output. Keep the existing None and non-list tag tests unchanged.
🤖 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.
Nitpick comments:
In `@sdk/wren-langchain/tests/unit/test_format_store_content.py`:
- Around line 26-34: Add a unit test for format_store_content covering non-None,
non-string nl and sql inputs such as integers, and assert their string-coerced
values appear in the formatted output. Keep the existing None and non-list tag
tests unchanged.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: b078faef-eb48-40cb-a599-638b3e1dd3d7
📒 Files selected for processing (2)
sdk/wren-langchain/src/wren_langchain/_format.pysdk/wren-langchain/tests/unit/test_format_store_content.py
Summary
Motivation
Store-tool confirmation paths can pass placeholders. formatting must not TypeError after a successful store.
License
sdk/** Apache-2.0
Verification
Test plan
Summary by CodeRabbit
Bug Fixes
Tests