[UI] Add hypothesis comparison modal to Exchange page

← All Specs

[UI] Add hypothesis comparison modal to Exchange page

ID: fcf2de19-e00 Priority: 90 Type: one_shot Status: open

Goal

Quest 2/16: Exchange page already has compare checkboxes (compare-cb class) but no comparison modal/panel. Add a comparison view that shows 2-3 selected hypotheses side-by-side with scores, evidence counts, and pathway diagrams.

Acceptance Criteria

☑ Concrete deliverables created
☑ Work log updated with timestamped entry

Work Log

2026-04-18 08:45 PT — Post-rebase verification

  • Rebased onto origin/main (b19c84131) after stash to apply pending main-line commits
  • Confirmed scripts/run_debate_llm.py exists (16503 bytes) — merge gate issue resolved
  • Only diff vs origin/main: spec work log update (19 lines)
  • Hypothesis comparison modal confirmed on main (same evidence as 08:30 entry)
  • Task is complete; commit is ready to push

2026-04-18 08:30 PT — Verification

Evidence that task is complete on origin/main (ec1f30a53):

Verified via source code inspection on origin/main:

  • Exchange page has compare-cb checkboxes and a floating compare bar with "Compare Side-by-Side" button (api.py:28094-28106)
  • goCompare() JavaScript function navigates to /compare?ids= with selected hypothesis IDs (api.py:28082-28085)
  • /compare route exists at api.py:30974+ and renders:
  • - Side-by-side hypothesis cards with composite scores and evidence counts (lines 31046-31066)
    - Radar chart with 10 dimensions (lines 31020-31044, 31454-31457)
    - Score comparison bars (lines 31158-31168)
    - Verdict summary showing dimensions won per hypothesis (lines 31121-31137)
    - Evidence sections with supporting/contradicting citations (lines 31087-31119)
    - Price history overlay chart (lines 31210-31275)
    - Pathway diagrams rendering mermaid diagrams from h.pathway_diagram field (lines 31389-31417)
    - Conditional mermaid@11 library include when hypotheses have pathway diagrams (line 31423)
  • Compare checkboxes on Exchange page are wired via toggleCompare() function (line 28030)
  • Note: While commit 29cacd33f (which documented this work) is only on remote agent branches (gh/*), the actual code was verified to exist on origin/main via git show origin/main:api.py. The work likely landed via a different merge path.

    2026-04-16 13:50 PT — Slot 0

    • Rebased on origin/main after previous stash/rebase cycle lost changes
    • Added pathway diagrams rendering to /compare route in api.py (~28351-28499):
    - Added pathway_diagrams_html generation that renders mermaid diagrams from h.pathway_diagram field
    - Conditionally includes mermaid@11 library when hypotheses have pathway diagrams
    - Conditionally includes mermaid.initialize() and mermaid.run() JavaScript
    - Displays diagrams side-by-side with color-coded headers matching hypothesis colors (#4fc3f7, #81c784, #ff8a65)
    • Verified Python syntax: python3 -m py_compile api.py passes
    • Hypotheses with pathway diagrams exist: h-76888762, h-d2df6eaf, h-d40d2659
    • API running from main checkout; changes in worktree (expected workflow per AGENTS.md)

    Tasks using this spec (1)
    [UI] Add hypothesis comparison modal to Exchange page
    UI done P90
    File: fcf2de19_e00_spec.md
    Modified: 2026-05-01 20:13
    Size: 3.1 KB