synthesize: context and offer kinds, Q1 section, points cap, firmer novel rule (dress rehearsal tuning)

From a 50-response dress rehearsal on 2026-10-27:

- Answers about why someone joined were being clustered as points and
  padded the privacy theme with 'joined because they hate ads'. Tag them
  as kind=context, keep them out of clustering, and render a 'Why people
  joined' sample instead.
- Two members volunteered help and landed under standout ideas. Tag
  those as kind=offer and give them an 'Offers of help' section.
- 'Points raised' lists ran to 27 bullets per theme; cap at 12 with a
  pointer to synthesis.json.
- One run read 'novel' as 'left unthemed' and returned 2 standout ideas
  instead of ~10. The cluster prompt now says standout ideas usually sit
  inside a theme and asks for 5 to 10 concrete mechanisms.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
solo.istandClaude Fable 5.1 committed 2026-10-27 01:01:26 -04:00
1 parent 68775856f4
commit a285ccb1dc
7 files changed
+144 -104

No files matched your search

+35 -4
View File
@@ -47,8 +47,8 @@ class FakeGateway(S.Gateway):
if line.startswith("### "):
head, _, _ = line[4:].partition(": ")
rid, q = head.split(" / ")
items.append({"id": rid, "q": q, "label": f"point about {q} from {rid}", "kind": "idea", "stance": "for",
"quote": None})
items.append({"id": rid, "q": q, "label": f"point about {q} from {rid}",
"kind": "context" if q == "Q1" else "idea", "stance": "for", "quote": None})
elif items and items[-1]["quote"] is None and line.strip():
items[-1]["quote"] = " ".join(line.split()[:6])
items.append({"id": rid, "q": "Q1", "label": "fabricated", "kind": "concern", "stance": "against",
@@ -155,15 +155,21 @@ class PipelineTests(unittest.TestCase):
self.assertEqual(len(dropped), 3) # one fabricated quote per batch
self.assertTrue(all(it["quote"] in " ".join(loaded["responses"][int(it["rid"][1:]) - 1]["answers"].values())
for it in items))
clusters = S.stage_cluster(gw, items, use_tools=False)
to_cluster, context, offers = S.split_items(items)
self.assertTrue(context and all(it["q"] == "Q1" for it in context))
self.assertFalse(any(it["kind"] in S.UNCLUSTERED_KINDS for it in to_cluster))
clusters = S.stage_cluster(gw, to_cluster, use_tools=False)
self.assertEqual(gw.calls, 4)
cluster_input = gw.posted[-1]["messages"][1]["content"]
self.assertNotIn(" context ", cluster_input)
self.assertFalse(set(it["iid"] for it in context) & set(clusters["unthemed"]))
self.assertEqual(len(clusters["themes"]), 2)
self.assertEqual(clusters["open_questions"][1], {"question": "Bare string question", "item_ids": []})
# Same inputs again: everything served from cache, no network.
gw2 = FakeGateway(cache_dir=Path(d) / "cache")
S.stage_tag(gw2, loaded, batch_size=5, use_tools=False)
S.stage_cluster(gw2, items, use_tools=False)
S.stage_cluster(gw2, to_cluster, use_tools=False)
self.assertEqual(gw2.calls, 0)
self.assertEqual(gw2.cache_hits, 4)
@@ -172,6 +178,8 @@ class PipelineTests(unittest.TestCase):
self.assertIn("# Coopertron 5000 report", md)
self.assertIn("## Priorities (pick up to 3)", md)
self.assertIn("**4** · privacy", md) # r01, r03, r06, r09 picked privacy
self.assertIn("## Why people joined", md)
self.assertNotIn("## Offers of help", md) # the fake never emits offers
self.assertIn("### 1. ", md)
self.assertIn("Institutional access", md)
self.assertIn("Own the stack", md)
@@ -209,6 +217,29 @@ class PipelineTests(unittest.TestCase):
self.assertEqual(gw.calls, 2)
class RenderTests(unittest.TestCase):
def test_offers_section_and_points_cap(self):
loaded = S.load_responses(FIX / "sample.csv")
r01 = loaded["responses"][0]
q2 = loaded["questions"][1]
words = r01["answers"][q2].split()
items = [{"iid": f"i{n:03d}", "rid": "r01", "q": "Q2", "label": f"distinct point {n}", "kind": "idea",
"stance": "for", "quote": " ".join(words[:3])} for n in range(1, 16)]
items.append({"iid": "i999", "rid": "r01", "q": "Q2", "label": "volunteers to run the prompt library",
"kind": "offer", "stance": "for", "quote": " ".join(words[:4])})
to_cluster, context, offers = S.split_items(items)
self.assertEqual(len(offers), 1)
self.assertEqual(len(to_cluster), 15)
clusters = {"themes": [{"name": "Big theme", "summary": "", "item_ids": [it["iid"] for it in to_cluster]}],
"unthemed": [], "novel": [], "dissent": [], "open_questions": []}
md = S.render(loaded, items, clusters, {"date": "2026-10-27", "source": "x.csv", "model": "m", "dropped": []})
self.assertIn("## Offers of help", md)
self.assertIn("**volunteers to run the prompt library**", md)
self.assertIn(f"…and {15 - S.POINTS_PER_THEME} more", md)
self.assertEqual(md.count("- distinct point "), S.POINTS_PER_THEME)
self.assertNotIn("## Why people joined", md)
class ReasoningExhaustionTests(unittest.TestCase):
def test_fails_fast_without_retry(self):
os.environ[S.KEY_ENV] = "sk-test-not-real"