[Docs] Build document rendering page at /paper/{id} with full pipeline done coding:8 reasoning:6

← Mission Control
## 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)

[Docs] Add sci-doc-02 spec: document render page implementation [task:4a1bfef2-415c-472c-bc41-a83957fd0d73]2026-04-13
[Docs] Build document rendering page at /paper/{id} with full pipeline [task:4a1bfef2-415c-472c-bc41-a83957fd0d73]2026-04-04
Spec File

Goal

Build a /paper/{id} page that renders authored papers with dynamic artifact embeds — replacing {{artifact:ID[:view]}} markers with rich HTML cards based on artifact type.

Context

SciDEX agents produce authored papers that embed live references to other artifacts (hypotheses, figures, datasets, dashboards). These embeds need to be rendered as interactive HTML previews, not raw text markers.

Implementation

API Endpoints

  • GET /api/papers/authored — list authored papers with status filtering (merged PR a12380300)
  • GET /api/papers/authored/{paper_id} — paper details with metadata and content; ?rendered=true resolves embeds

Embed Resolution Pipeline

  • _resolve_authored_paper_embeds(db, content) — finds all {{artifact:ID[:view]}} markers in paper content and replaces them with rendered HTML via _render_artifact_embed_html(db, embed_id, view)
  • _render_artifact_embed_html(db, embed_id, view="default") — renders typed HTML per artifact type:
- hypothesis → hypothesis card with title, score badge, target gene, description excerpt
- figure → figure with inline SVG or image, caption
- tabular_dataset → sortable HTML table (first 20 rows, up to 8 columns)
- dashboard → rendered dashboard live cards
- dataset → dataset card with source, row count, external link
- default → generic artifact card with title, type, link
- missing artifact → graceful error placeholder (red-bordered box with ID)

Page Route

GET /paper/{paper_id:path} — full paper page with:

  • Breadcrumb navigation (Home → Papers → Paper Title)
  • Paper header: title, SciDEX attribution, creation date, abstract, authors, embedded artifact ID badges
  • Body: markdown-rendered content with artifact embeds resolved inline
  • Fallback: handles /paper/{pmid} for imported papers (looks up via resolve_paper_id())

Acceptance Criteria

/paper/{id} returns rendered HTML for authored papers
{{artifact:HYPOTHESIS_ID:summary}} markers render as hypothesis cards
{{artifact:FIGURE_ID:figure}} markers render as figures
{{artifact:DATASET_ID:table}} markers render as data tables
☑ Missing artifacts show graceful placeholder, not broken markup
/paper/{pmid} fallback works for imported papers with figure extraction

Work Log

  • 2026-04-04: Implemented full pipeline (commit e717257ea). Created _render_artifact_embed_html, _resolve_authored_paper_embeds, and /paper/{paper_id:path} route. Added API endpoints /api/papers/authored and /api/papers/authored/{paper_id}. Verified 3/3 artifact markers resolved correctly in test papers. All acceptance criteria met.

Payload JSON
{
  "requirements": {
    "coding": 8,
    "reasoning": 6
  },
  "completion_shas": [
    "67833e935282723bc99f365ade43d31a2c9114f0",
    "e717257eafb8d775de298513921da4a189cb06ff"
  ],
  "completion_shas_checked_at": "2026-04-14T04:19:31.310553+00:00"
}