fix(summarizer): ignore future-dated rows; require a score floor for the fallback #54
Loading…
Reference in a new issue
No description provided.
Delete branch "wt/t_39f51764"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Follow-up to #53 (merged, summarizer
amd64-2c41737d42dd,SUMMARY_MIN_SCORE=60).Two paths still let low-value items reach the brief. Measured on a forced interval
(14 articles, 4 map batches, score distribution
45, 30, 15, 15, 12, 12, 10, 8, 5, 5, 5, 5, 5, 3):get_recent_news()only filteredtimestamp > NOW() - window, so the 12future-dated
wiseye.orgevent listings (Nov 17 / Nov 20 whilenow()= Nov 14)were re-fetched, re-graded by the LLM and re-billed every 15 minutes for a week.
select_graded()returnedordered[:fallback_top]with no floor, so a 15/100event listing ("UW-Madison Elections Research Center to host 2026 midterm election
symposium") entered the operator brief and ticker as
low.Change
get_recent_news()window is now(now - window, now](AND timestamp <= NOW()).The
content IS NOT NULL AND length(content) > 100filter andORDER BY timestamp DESCare untouched. NULL timestamps never matched the lower bound and still do not.
SUMMARY_FALLBACK_MIN_SCORE(env, default 40, clamped 0-100) read through_env_int/selection_config(), returned as the 4th value.select_graded()gains afallback_min_scoreparameter (default0= previous behaviour): the fallback set is[b for b in ordered if b["score"] >= fallback_min_score][:fallback_top]; if empty itreturns
([], False)and the reduce phase gets empty DATA (existing empty-brief path).The WARNING now reads
... fallback to top %d with score >= %d (max score %d)..env.example+docs/news.mddocument the knob and the closed window.No change to the map prompt, rubric,
parse_map_scores,article_scores, the other threeknobs, the scraper or
app/main.py. No new LLM call. No row deletions.Verification
Live check against a real
postgres:16scratch DB (fresh -2min, future +3d/+6d,past -20min, NULL timestamp, short content):
Replay of the observed run as a unit test (
45, 30, 15,min_score=60,fallback_top=3,fallback_min_score=40) selects[45]only - the symposium listing is gone from DATA.Merge policy: operator merges, rebuilds the summarizer image, pins it in
sirius/homek8s, setsSUMMARY_FALLBACK_MIN_SCOREin the ConfigMap and re-runs a forcedinterval. This PR is not merged by the worker.