Sources: accepted-duplicate % (curation-quality signal)

Per Codex's optional note: alongside the ingest-wide duplicate_rate, expose
accepted_dup_rate — of what a source got ACCEPTED, how much was a duplicate of
already-served content (accepted_total − served). Nearly free (derived from
existing counts); surfaced as a tooltip on the Dup column so the table stays
uncluttered.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
jay
2026-06-08 15:47:51 -04:00
parent 0f8d5b555a
commit 9deca522b4
3 changed files with 8 additions and 2 deletions
+1 -1
View File
@@ -344,7 +344,7 @@
</td>
<td class="num">{s.served}</td>
<td class="num">{s.acceptance_rate != null ? s.acceptance_rate + '%' : '—'}</td>
<td class="num">{s.duplicate_rate != null ? s.duplicate_rate + '%' : '—'}</td>
<td class="num" title={s.accepted_dup_rate != null ? `${s.accepted_dup_rate}% of accepted were duplicates` : ''}>{s.duplicate_rate != null ? s.duplicate_rate + '%' : '—'}</td>
<td class="dim">{s.last_success_at ? fwhen(s.last_success_at) : '—'}</td>
<td class="dim">{s.active ? fwhen(s.next_due_at) : '—'}</td>
<td class="num">{s.failures || ''}</td>
+5 -1
View File
@@ -320,8 +320,12 @@ def source_health(conn: sqlite3.Connection) -> list[dict]:
for r in rows:
d = dict(r)
total = d["total_articles"] or 0
d["acceptance_rate"] = round(100 * d["accepted_total"] / total) if total else None
accepted = d["accepted_total"] or 0
d["acceptance_rate"] = round(100 * accepted / total) if total else None
d["duplicate_rate"] = round(100 * d["duplicates"] / total) if total else None
# Curation quality: of what this source got ACCEPTED, how much was a
# duplicate of content already served (accepted_total served = accepted dupes).
d["accepted_dup_rate"] = round(100 * (accepted - d["served"]) / accepted) if accepted else None
out.append(d)
return out
+2
View File
@@ -47,6 +47,8 @@ def test_source_health_orders_failing_first_and_computes_next_due(tmp_path):
assert flaky["next_due_at"] is not None
good = next(s for s in sh if s["name"] == "Good")
assert good["served"] == 1 and good["next_due_at"] is None # never attempted → due now
# source 1: 2 accepted (art 1, art 3) but art 3 is a duplicate → 50% of accepted were dupes
assert good["accepted_dup_rate"] == 50
def test_attention_flags_resting_flagged_and_brief():