Remove bare-value fallback from _extract_labeled

The JS always emits {id, label} objects now; the else branch was dead code
and the docstring was wrong. Update the remaining test that was still
passing bare strings.

https://claude.ai/code/session_01EyAJcMoDktLrY9tSbdHViA
This commit is contained in:
Claude
2026-06-08 19:00:03 +00:00
committed by Lukáš Kucharczyk
parent 11cd62a3b9
commit 428edbcfe8
2 changed files with 4 additions and 10 deletions
+3 -9
View File
@@ -62,15 +62,9 @@ def _filter_parse(filter_json: str) -> dict:
return {}
def _extract_labeled(items: list) -> list[LabeledOption]:
"""Convert a list of bare values or ``{id, label}`` dicts to ``(value, label)`` pairs."""
result = []
for item in items:
if isinstance(item, dict):
result.append((str(item.get("id", "")), str(item.get("label", ""))))
else:
result.append((str(item), ""))
return result
def _extract_labeled(items: list[dict]) -> list[LabeledOption]:
"""Convert a list of ``{id, label}`` dicts to ``(value, label)`` pairs."""
return [(str(item["id"]), str(item["label"])) for item in items]
def _filter_get_choice(existing: dict, field: str) -> FilterChoice:
+1 -1
View File
@@ -293,7 +293,7 @@ class TestFilterBarRendering:
html = str(
FilterBar(
filter_json=json.dumps(
{"status": {"value": ["f"], "modifier": "INCLUDES"}}
{"status": {"value": [{"id": "f", "label": "Finished"}], "modifier": "INCLUDES"}}
),
)
)