Spec: Funded-Mission Spotlight Component

← All Specs

Spec: Funded-Mission Spotlight Component

Task ID: f86a6d93-008b-4821-9a52-24a78b4e9af4 Layer: Atlas Status: completed

Goal

Surface currently-funded missions (Q-FUND output) on / and /disease/{slug}.
Each card shows: mission title, budget (tokens), deadline countdown, lead artifact link,
and top-3 contributing agents. Clickable to /mission/{id}. Refreshes every 30 min.

Implementation

New code in api.py

_funded_mission_spotlight_html(db, disease_slug=None) — helper at ~line 30198.

  • Queries missions WHERE budget_tokens > 0 ORDER BY budget_tokens DESC LIMIT 4.
  • Optional disease_slug narrows results by name/description/domain ILIKE match.
  • Lead artifact: tries artifacts WHERE mission_id = X first, then domain-keyword fallback.
  • Top-3 agents: agent_contributions JOIN hypothesis_missions for this mission.
  • Returns wrapped HTML with id="funded-missions-spotlight" for JS targeting.
GET /api/funded-missions?disease=<slug> — at ~line 27004.
  • Returns {"html": "<fragment>", "ts": <epoch>} for 30-min client refresh.
Home page (/)funded_missions_html inserted between preprint strip and top-10 spotlight.

Disease page (/disease/{slug})disease_funded_missions_html inserted at top of right sidebar, before challenges. JS 30-min refresh uses the slug.

30-min auto-refresh

Both pages include an IIFE that calls setInterval(refresh, 1800000).
Refresh replaces el.outerHTML with the new HTML fragment.

Work Log

2026-04-28

  • Implemented _funded_mission_spotlight_html helper function.
  • Added /api/funded-missions endpoint.
  • Injected component into home page and disease landing page.
  • Added 30-min auto-refresh JS to both pages.
  • Verified: 25 funded missions exist in DB (all budget_tokens > 0), deadline countdown working.

2026-04-28 (gate-fix retry)

  • Re-verified DB schema: missions table has id, name, budget_tokens, deadline, status, color, icon, description, domain — all columns queried in the helper are present.
  • Re-verified artifacts table has is_latest, mission_id, effective_priority, quality_score — all columns used in lead-artifact query are present.
  • Re-tested _funded_mission_spotlight_html(db) returns 4877-char valid HTML fragment with 4 funded-mission cards.
  • Prior gate rejection was an infrastructure error ("checkout main failed: fatal: this operation must be run in a work tree") unrelated to code; implementation is correct.

2026-04-28 (gate-fix retry 2)

  • Re-ran live DB query: SELECT id, name, budget_tokens, deadline FROM missions WHERE budget_tokens > 0 ORDER BY budget_tokens DESC LIMIT 4 returns 4 funded missions (rescue-c02bb2a36184, mission-017a1788a240, rescue-6a722d4abf29, rescue-369f415e5fdb).
  • All table/column references verified against information_schema.columns: missions (budget_tokens, deadline, color, icon, domain), artifacts (mission_id, is_latest=integer, effective_priority), agent_contributions (hypothesis_id), hypothesis_missions (hypothesis_id, mission_id), agent_registry (id, name, icon, color).
  • All gate rejections have been identical infrastructure errors; no code changes required.

File: f86a6d93_funded_mission_spotlight_spec.md
Modified: 2026-05-01 20:13
Size: 3.1 KB