Skip to content

Fix /analyze/compare 500 (missing created_at_iso)#12

Merged
f1shyfang merged 1 commit into
mainfrom
fix/compare-500-timestamp
May 30, 2026
Merged

Fix /analyze/compare 500 (missing created_at_iso)#12
f1shyfang merged 1 commit into
mainfrom
fix/compare-500-timestamp

Conversation

@f1shyfang
Copy link
Copy Markdown
Owner

Problem

Live smoke test against https://lyra-ml-api.onrender.com found POST /analyze/compare returning 500. Root cause: db.insert_run derives the NOT NULL runs.created_at_iso from response["meta"]["timestamp_iso"]. analyze() includes a meta block, but compare() does not — so the insert failed with NOT NULL constraint failed: runs.created_at_iso. (/health, /analyze, /history, /docs were all 200.)

Fix

insert_run now falls back to datetime.now(timezone.utc).isoformat() when the response carries no meta timestamp — persistence no longer depends on the response shape (covers compare and any future mode).

Verification (local)

/analyze/compare → 200; the run persists and shows up in /history with mode: "compare".

🤖 Generated with Claude Code

…no meta

insert_run derived the NOT NULL created_at_iso from response.meta.timestamp_iso,
which analyze() sets but compare() does not — so every /analyze/compare hit
failed with 'NOT NULL constraint failed: runs.created_at_iso' (HTTP 500).
Fall back to the current UTC time so persistence never depends on response shape.

Verified locally: /analyze/compare -> 200 and the run persists to /history.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings May 30, 2026 11:49
@vercel
Copy link
Copy Markdown

vercel Bot commented May 30, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
lyra-hackathon Ready Ready Preview, Comment May 30, 2026 11:50am

@f1shyfang f1shyfang merged commit 292a013 into main May 30, 2026
1 of 3 checks passed
@f1shyfang f1shyfang deleted the fix/compare-500-timestamp branch May 30, 2026 11:50
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants