Enrich /artifact/<exp_id> with experiment-specific extras

← All Specs

Enrich /artifact/<exp_id> with experiment-specific extras

Task ID: experiment-artifact-extras-2026-05-13 Layer: Atlas (artifact_detail) Date: 2026-05-13 Status: complete — shipped in PR #1413 (merge commit 2a6a76beb) Parent quest: quest_artifact_page_unification_spec.md (delivers part of PR-6: type-specific scores/market/metrics slot) v1 carve-out: user-authorized; v1 still serves scidex.ai

Symptom

https://scidex.ai/experiments/exp-c3c760f8-d421-4033-92d3-46fe89694922
was reported broken. It returned HTTP 200 (not a 404 — the type-prefix
301 alias added 2026-04-28 already folded /experiments/<id> and /experiment/<id> into /artifact/<id>), but the rendered page was the
generic experiment shell. Experiment-only data was invisible: this
experiment had 2 linked prediction markets and a market_price of
$0.50 that never appeared anywhere on the page.

Root cause

Two coexisting renderers for the same data:

  • A dedicated experiment_detail handler (@app.api_route(
  • "/experiment/{exp_id}"), ~375 LOC) rendered a rich page: scoring
    radar, prerequisite graph, prediction markets, results, mission
    badges, related-target link, cost/timeline/pathway grid. **It was
    dead code* — registered after* the type-alias 301 redirect, so
    FastAPI's in-order matching meant the redirect always won. The
    handler had been unreachable since the alias shipped (2026-04-28).

  • The live artifact_detail elif atype == "experiment" branch read
  • the experiments source table but rendered only protocol / outcomes
    / linked-hypotheses / criteria — none of the markets, prereqs,
    results, radar, missions, or metadata grid.

    Plus a single stray link in the entity-page experiments table emitted
    the plural /experiments/<id> form (one redirect hop).

    Fix

    api.py:

  • New helper _render_experiment_extras_html(db, artifact_id)
  • (api.py:31062). Returns "" when the id has no row in experiments
    (safe for the 719 artifact-only backfilled rows that never got an
    experiments row). Each section is independently gated on its own
    data, so empty experiments render nothing. Sections:
    metadata grid (cost / timeline / pathway / market_price / status),
    6-dim scoring radar, related-target link, prerequisite graph
    (upstream + downstream), mission badges, prediction markets (direct +
    via linked hypotheses), experiment results (outcome cards with
    score-impact deltas).
  • Wired into artifact_detail: a new experiment_extras_html
  • variable populated only in the atype == "experiment" branch,
    injected after {type_viewer_html} at both the ?embed=1 view and
    the main overview tab.
  • Deleted the dead experiment_detail handler (~375 LOC). It was
  • already unreachable; the type-alias redirect continues to fold
    /experiment/<id> and /experiments/<id> into the now-richer
    /artifact/<id>. Net diff: +388 / −376.
  • Stray-link fix: the entity-page experiments table now emits
  • /artifact/<id> directly (no redirect hop).

    Verification

    Five fixtures, validated on a local test server and on live after
    deploy (all /experiments/<id>, /experiment/<id>, /artifact/<id>
    forms return identical enriched content):

    Fixtureextrasradarprereqmarketsresultsmissionstarget
    exp-c3c760f8… (reported URL)✓ 2
    TREM2-agonist (prereq-heavy)✓ 7✓ 3
    exp_test_1f387354 (results)✓ CONFIRMED +0.055
    artifact-only (no experiments row)✗ bails cleanly
    hypothesis / analysis artifact✗ no spillover
    • 41/41 targeted tests pass (route order, artifact page kinds, artifact
    IO/versioning/diff/locator, rerun, proposal generator).
    • Pre-existing test_wiki_crosslinks.py::test_experiment_detail_shows_wiki_crosslinks
    failure is NOT introduced by this PR — it broke on 2026-04-28 when the
    type-alias redirect shipped (the dead handler was already unreachable).
    Tracked separately: experiment-wiki-crosslinks-restore-2026-05-18.

    Deferred (captured in follow-up specs)

    The deleted handler had four capabilities not ported into the helper.
    Captured for follow-up — see:

    • experiment-wiki-crosslinks-restore-2026-05-18_spec.md — experiment→wiki
    crosslinks panel (real product gap, also unblocks the broken test).
    • experiment-extras-followups-2026-05-18_spec.md — Debate History
    widget, "What This Experiment Tests" callout, Related Hypotheses
    block, redirect-hop polish.

    (Note: a Mol/PDBe 3D structure viewer was never* part of experiment_detail — it lives on the hypothesis page. It is not a
    deferred experiment feature.)

    File: experiment-artifact-extras-2026-05-13_spec.md
    Modified: 2026-05-18 19:31
    Size: 4.7 KB