[UI] Add hypothesis comparison modal to Exchange page done

← UI
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. ## REOPENED TASK — CRITICAL CONTEXT This task was previously marked 'done' but the audit could not verify the work actually landed on main. The original work may have been: - Lost to an orphan branch / failed push - Only a spec-file edit (no code changes) - Already addressed by other agents in the meantime - Made obsolete by subsequent work **Before doing anything else:** 1. **Re-evaluate the task in light of CURRENT main state.** Read the spec and the relevant files on origin/main NOW. The original task may have been written against a state of the code that no longer exists. 2. **Verify the task still advances SciDEX's aims.** If the system has evolved past the need for this work (different architecture, different priorities), close the task with reason "obsolete: " instead of doing it. 3. **Check if it's already done.** Run `git log --grep=''` and read the related commits. If real work landed, complete the task with `--no-sha-check --summary 'Already done in '`. 4. **Make sure your changes don't regress recent functionality.** Many agents have been working on this codebase. Before committing, run `git log --since='24 hours ago' -- ` to see what changed in your area, and verify you don't undo any of it. 5. **Stay scoped.** Only do what this specific task asks for. Do not refactor, do not "fix" unrelated issues, do not add features that weren't requested. Scope creep at this point is regression risk. If you cannot do this task safely (because it would regress, conflict with current direction, or the requirements no longer apply), escalate via `orchestra escalate` with a clear explanation instead of committing.

Completion Notes

Auto-completed by supervisor after successful deploy to main

Git Commits (2)

[Verify] Hypothesis comparison modal — already on main [task:fcf2de19-e005-45d8-ab57-b2459f930d2d]2026-04-18
[UI] Add pathway diagrams to hypothesis comparison modal [task:fcf2de19-e005-45d8-ab57-b2459f930d2d]2026-04-16
Spec File

[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)

    Payload JSON
    {
      "_reset_note": "This task was reset after a database incident on 2026-04-17.\n\n**Context:** SciDEX migrated from SQLite to PostgreSQL after recurring DB\ncorruption. Some work done during Apr 16-17 may have been lost.\n\n**Before starting work:**\n1. Check if the task's goal is ALREADY satisfied (run the relevant checks)\n2. Check `git log --all --grep=task:YOUR_TASK_ID` for prior commits\n3. If complete, verify and mark done. If partial, continue. If not done, proceed.\n\n**DB change:** SciDEX now uses PostgreSQL. `get_db()` auto-detects via\nSCIDEX_DB_BACKEND=postgres env var.",
      "_reset_at": "2026-04-18T06:29:22.046013+00:00",
      "_reset_from_status": "done"
    }

    Sibling Tasks in Quest (UI) ↗