[Demo] Harden guided demo route checks and repair broken path references done

← Demo
Recurring demo validations miss legacy path variants; add robust demo route coverage and fix discovered broken demo links/routes so walkthrough pages return 200/3xx. ## 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 (5)

[Demo] Correct commit SHA in spec work log [task:f4d205ba-3770-4792-91bc-b1e7dde1a29b]2026-04-18
[Demo] Fix None-type score formatting in api.py demo walkthrough [task:f4d205ba-3770-4792-91bc-b1e7dde1a29b]2026-04-18
[Demo] Update spec work log after squash: db93bca5e on origin [task:f4d205ba-3770-4792-91bc-b1e7dde1a29b]2026-04-16
[Demo] Harden guided demo route checks and fix case-sensitive walkthrough lookup in api.py; add demo routes to smoke_check.py [task:f4d205ba-3770-4792-91bc-b1e7dde1a29b]2026-04-16
[Demo] Update demo route check spec [task:f4d205ba-3770-4792-91bc-b1e7dde1a29b]2026-04-04
Spec File

Goal

Improve demo route coverage in smoke_check.py to catch legacy path variants and broken demo routes, and fix case-insensitive ID lookup for demo/showcase walkthrough routes so walkthrough pages return 200/3xx.

Acceptance Criteria

smoke_check.py checks all demo/showcase/walkthrough routes (current + legacy variants)
☐ All legacy demo path aliases redirect correctly (301) to canonical paths
☐ Case-insensitive ID lookup in walkthrough_detail() and showcase_top_analyses()
☐ Walkthrough pages with curated IDs return 200 (not 404)
☐ smoke_check.py passes for all demo routes

Approach

  • Read current smoke_check.py and api.py demo routes
  • Add missing demo/showcase/walkthrough routes to DEMO_ROUTES in smoke_check.py
  • Fix case-insensitive analysis_id lookup in walkthrough_detail() and showcase_top_analyses()
  • Test all routes with curl
  • Dependencies

    • Prior work: df260372d updated spec only (no code changes)

    Work Log

    2026-04-16 — Started investigation

    • Confirmed prior commit df260372d only updated spec file (no code changes)
    • Verified API is currently returning 502 (service may be down)
    • Identified demo routes in api.py: /demo, /showcase, /demo/walkthrough, /demo/showcase, /demo-showcase, /demos, /walkthrough, /walkthroughs, /walkthrough/{id}
    • Identified case sensitivity issue in walkthrough_detail() line 56888: direct lookup without case normalization

    2026-04-16 — Implementation

    • smoke_check.py: Added 12 demo/showcase/walkthrough routes to DEMO_ROUTES:
    - /demo (200), /showcase (200) with content assertions
    - Legacy redirects: /demo/walkthrough (301), /demo/showcase (301), /demo-showcase (301), /demos (301)
    - Walkthrough index: /walkthrough (302), /walkthroughs (302)
    - Demo sub-pages: /demo/biophysical-model (200), /demo/provenance-chain (200)
    - Fixed /analyses expected status from [200] to [200, 301] (redirects to /analyses/)
    • api.py walkthrough_detail(): Changed direct ID lookup from WHERE id=? to WHERE LOWER(id)=LOWER(?) for case-insensitive matching — fixes 404 errors when URLs contain mixed-case analysis IDs
    • api.py showcase_top_analyses(): Already uses case-insensitive lookup (confirmed at line 55133)
    • Committed as db93bca5e and pushed to origin (squashed from prior 0cd3d9654 + 20a969fdc into single commit with api.py mentioned in message for pre-push hook compliance)

    2026-04-18 — Fix None-type score formatting in /demo walkthrough page

    • Root cause: When top_hyps list contains entries with None composite_score (from hero_titles SQL query or backfill query), three f-string format calls in demo_walkthrough_page() threw TypeErrors:
    - Line 61267: h["score"] > 0.65 → TypeError: '>' not supported between instances of 'NoneType' and 'float'
    - Line 61291: {h["score"]:.3f} → TypeError: unsupported format string passed to NoneType
    - Line 62002: {trace_hyp["score"]:.3f} → same format string error
    • Fix applied (all three locations):
    - (h["score"] or 0) > 0.65 — safe comparison
    - {(h["score"] or 0):.3f} — safe formatting
    - {(trace_hyp["score"] or 0):.3f} — safe formatting
    • Verification: python3 smoke_check.py → 30/30 passed; /demo returns 200
    • Commit: 56f69a389

    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 (Demo) ↗