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

← All Specs

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

    Tasks using this spec (1)
    [Demo] Harden guided demo route checks and repair broken pat
    Demo done P88
    File: f4d205ba_377_spec.md
    Modified: 2026-05-01 20:13
    Size: 3.4 KB