Scope dial polish (Codex): hero stays closest-first + visible Clear

- Hero constraint: _pick_lead now runs only within the CLOSEST non-empty section of a
  personalized Brief, so a "gentler" wider-region/world story can never be floated into
  the hero slot above a local one. Only widens if the closest section is empty.
- Dial gains a visible Clear (alongside Change) so a reader never feels locked into
  personalization; "World" stays the keep-home-but-go-global option.

366 tests green.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
jay
2026-06-19 22:06:06 -04:00
parent 3486f3102a
commit b4b02b5050
3 changed files with 16 additions and 3 deletions
+1
View File
@@ -87,6 +87,7 @@ def test_home_brief_leads_with_local(app_db):
# NY story (#5). CA stories (a different census region) fall to 'country'.
r = TestClient(app_db).get("/api/brief?home=US-NY&limit=10").json()
assert r["title"] == "Close to home"
assert r["items"][0]["section"] == "state" # hero comes from the closest section
state_ids = {it["id"] for it in r["items"] if it["section"] == "state"}
assert state_ids == {1, 2, 3, 4} # high-conf NY only
a5 = next(it for it in r["items"] if it["id"] == 5)