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:
+10
-1
@@ -2236,7 +2236,16 @@ def create_app() -> FastAPI:
|
||||
have.add(a["id"])
|
||||
# Lead with a gentle, readable story (charged or paywalled stories stay
|
||||
# in the set, just not as the first thing seen).
|
||||
items = _pick_lead(items)
|
||||
if home_country and scope != "world" and items:
|
||||
# Keep "closest first": pick the gentlest hero from ONLY the closest non-empty
|
||||
# section, so _pick_lead can never float a wider-region/world story above a
|
||||
# local one. Wider tiers stay in their order behind it.
|
||||
lead = items[0].get("__section")
|
||||
head = [a for a in items if a.get("__section") == lead]
|
||||
tail = [a for a in items if a.get("__section") != lead]
|
||||
items = _pick_lead(head) + tail
|
||||
else:
|
||||
items = _pick_lead(items)
|
||||
return BriefResponse(
|
||||
brief_date=data["brief_date"],
|
||||
title=data["title"],
|
||||
|
||||
Reference in New Issue
Block a user