Pad "Top 10 of the Week" to always show 10 entries

← All Specs

Pad "Top 10 of the Week" to always show 10 entries

Task ID: top10-pad-2026-05-06 Layer: Atlas (homepage spotlight + Atom feed) Date: 2026-05-06

Problem

https://scidex.ai was rendering only 1 row in the homepage "Top 10 of the
Week" spotlight. Same for the /feed/top10 Atom feed.

Root cause: both queries used a PARTITION BY domain ... WHERE rn = 1
window, which caps the result to one hypothesis per domain. All 32
hypotheses created in the past 7 days share domain = 'neurodegeneration',
so the strict per-domain dedup collapsed the list to a single entry.

-- before
SELECT ... FROM ranked WHERE rn = 1 ORDER BY composite_score DESC LIMIT 10

Fix

api.py (homepage spotlight ~L39243, feed /feed/top10 ~L39738):

  • Soft diversity instead of hard cap. Drop WHERE rn = 1. Order by
  • (rn ASC, composite_score DESC) then LIMIT 10. When many domains exist,
    the first picks span domains; when only one domain has fresh entries, the
    list degrades gracefully to many-per-domain.
  • Pad with older when <10. If the recent set returns fewer than 10
  • rows, top up with the highest-scoring older hypotheses (created >7 days
    ago), excluding IDs already in the recent set.
  • Honest labeling. Padded rows render an EARLIER badge in the
  • homepage table so the UI doesn't claim those are from the past 7 days.
    The Atom feed does not gain a flag; padded entries are still real
    hypotheses worth syndicating.

    Files changed

    • api.py — homepage Top 10 of the Week block (soft diversity + pad +
    badge); /feed/top10 Atom feed (soft diversity + pad).

    Verification

    • python3 -c "import ast; ast.parse(open('api.py').read())" → OK
    • After deploy: homepage / should show 10 rows; padded rows tagged
    EARLIER. /feed/top10 should emit 10 <entry> elements.

    File: top10-pad-2026-05-06_spec.md
    Modified: 2026-05-18 04:17
    Size: 1.8 KB