From 959bce47b21fb18e1915522b191d5ae39bc998a6 Mon Sep 17 00:00:00 2001 From: Raphael Southall <69826455+raphasouthall@users.noreply.github.com> Date: Sat, 22 Aug 2026 13:19:54 +0100 Subject: [PATCH] fix(synthesize): drop blank member tags from the consolidated learning Live run #1830 inherited an empty-string tag from an old harvest row; _cluster_tags now strips and skips blank or non-string tags. --- src/neurostack/synthesize.py | 3 ++- tests/test_synthesize.py | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/neurostack/synthesize.py b/src/neurostack/synthesize.py index 3e5154b..ac91d14 100644 --- a/src/neurostack/synthesize.py +++ b/src/neurostack/synthesize.py @@ -209,7 +209,8 @@ def _cluster_tags(members: list[dict], limit: int = 8) -> list[str]: for m in members: try: for t in json.loads(m.get("tags") or "[]"): - if not t.startswith(_SUPERSEDED_PREFIX): + t = t.strip() if isinstance(t, str) else "" + if t and not t.startswith(_SUPERSEDED_PREFIX): counts[t] = counts.get(t, 0) + 1 except (TypeError, ValueError): continue diff --git a/tests/test_synthesize.py b/tests/test_synthesize.py index c7f7450..f1e513d 100644 --- a/tests/test_synthesize.py +++ b/tests/test_synthesize.py @@ -80,8 +80,8 @@ def test_strip_fences(self): def test_cluster_tags_union_ranked_and_marked(self): members = [ - {"tags": json.dumps(["aks", "azure", "superseded_by:9"])}, - {"tags": json.dumps(["aks"])}, + {"tags": json.dumps(["aks", "azure", "superseded_by:9", ""])}, + {"tags": json.dumps(["aks", " "])}, {"tags": None}, ] tags = _cluster_tags(members)