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.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (1)
Walkthrough
ChangesStore content formatting
Estimated code review effort: 1 (Trivial) | ~5 minutes Possibly related PRs
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
|
Reviewed — the fix is correct and I'd be happy to see it merged. One test-quality suggestion and a small nit, neither blocking. Correctness ✅ 🟡 Suggestion — test uses
from wren_langchain._envelope import (...)I confirmed from wren_langchain._format import format_store_contentand using 🟢 Nit |
…ify tag guard Address goldmedal review on Canner#2524: - Replace importlib file-loading with direct `from wren_langchain._format import format_store_content` (matches other unit tests, less fragile). - Add test covering non-None non-string nl/sql coercion path (int -> str). - Drop redundant `tags is None or` in the isinstance guard.
|
Thanks for the thorough review, @goldmedal — much appreciated. Applied both:
Also added a small case (from CodeRabbit) covering the non-None non-string coercion path ( Pushed as e60f254. |
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