"Vibe-Trading: Your Personal Trading Agent"
Python ai-agentalgorithmic-tradingbacktestingfintechllmmcpmulti-agentpythonquantitative-financetrading
fix(feishu): keep empty edge columns when parsing markdown tables
santhreal90def21855be
diff --git a/agent/src/channels/feishu.py b/agent/src/channels/feishu.pyindex 5df6c52e6..295f2ee92 100644--- a/agent/src/channels/feishu.py+++ b/agent/src/channels/feishu.py@@ -1067,7 +1067,14 @@ class FeishuChannel(BaseChannel):return Nonedef split(_line: str) -> list[str]:- return [c.strip() for c in _line.strip("|").split("|")]+ # Peel only the row's bounding pipes; str.strip("|") would also+ # drop empty leading/trailing cells (||Name| → Name).+ parts = _line.strip().split("|")+ if parts and parts[0] == "":+ parts = parts[1:]+ if parts and parts[-1] == "":+ parts = parts[:-1]+ return [c.strip() for c in parts]headers = [cls._strip_md_formatting(h) for h in split(lines[0])]rows = [[cls._strip_md_formatting(c) for c in split(_line)] for _line in lines[2:]]diff --git a/agent/tests/test_feishu_parse_md_table_edge_columns.py b/agent/tests/test_feishu_parse_md_table_edge_columns.pynew file mode 100644index 000000000..efd34be7a--- /dev/null+++ b/agent/tests/test_feishu_parse_md_table_edge_columns.py@@ -0,0 +1,27 @@+"""Feishu markdown tables must keep empty leading/trailing columns."""++from __future__ import annotations++from src.channels.feishu import FeishuChannel+++def test_parse_md_table_keeps_trailing_empty_header_column() -> None:+ table = "|Name|Qty||\n|---|---|---|\n|a|1|note|\n|b|2|other|\n"+ parsed = FeishuChannel._parse_md_table(table)+ assert parsed is not None+ assert [c["display_name"] for c in parsed["columns"]] == ["Name", "Qty", ""]+ assert parsed["rows"] == [+ {"c0": "a", "c1": "1", "c2": "note"},+ {"c0": "b", "c1": "2", "c2": "other"},+ ]+++def test_parse_md_table_keeps_leading_empty_header_with_row_labels() -> None:+ table = "||Name|Qty|\n|---|---|---|\n|row1|a|1|\n|row2|b|2|\n"+ parsed = FeishuChannel._parse_md_table(table)+ assert parsed is not None+ assert [c["display_name"] for c in parsed["columns"]] == ["", "Name", "Qty"]+ assert parsed["rows"] == [+ {"c0": "row1", "c1": "a", "c2": "1"},+ {"c0": "row2", "c1": "b", "c2": "2"},+ ]