Skip to content

fix: record initial ticket_history row when a ticket is created - #74

Draft
sonnymay wants to merge 1 commit into
mainfrom
claude/vibrant-meitner-06u4l4
Draft

sonnymay wants to merge 1 commit into
mainfrom
claude/vibrant-meitner-06u4l4

Conversation

@sonnymay

Copy link
Copy Markdown
Owner

Summary

POST /tickets inserted the ticket but never wrote a ticket_history row. For tickets created through the API, the audit trail started at the first status change, and the starting status was never recorded. The seed data in schema.sql already logs creation as old_status = null → <initial status>, and the endpoint now writes the same row.

  • The history row uses the inserted row's id and status returned by Supabase (Prefer: return=representation). If the insert returns no row, no history row is written.
  • On the Tickets page, a history entry with a null old_status used to show an empty pill. It now shows "Created".
  • One README sentence updated to match.

No open PR (#17–#73) or issue covers creation history; I searched issues and PRs for "ticket_history", "initial status history" and "creation history". #45, #47 and #72 edit update_ticket/Ticket, and #71 edits Tickets.jsx, so small merge conflicts are possible. None of them change this logic.

Testing

  • Added test_create_ticket_records_initial_status_history and test_create_ticket_skips_history_when_insert_returns_no_row.
  • pytest: 45 passed (with SUPABASE_URL/SUPABASE_KEY set). ruff check and ruff format --check are clean.
  • npx eslint src/pages/Tickets.jsx is clean and vite build succeeds.

Generated by Claude Code

POST /tickets inserted the ticket but never wrote a history row, so the
audit trail for API-created tickets started at the first status change
and the original status was lost. The seed data already models creation
as old_status=null -> initial status; the endpoint now does the same.

The Tickets page also rendered null old_status as an empty pill; it now
shows "Created".

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0171zWzo7vSa9Ls6xtBaJgNJ
@vercel

vercel Bot commented Nov 13, 2026 •

Copy link
Copy Markdown

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

Project Deployment Actions Updated
supportops Ready Ready Preview Nov 13, 2026 3:22pm UTC

This branch was successfully deployed

1 active deployment
Preview — 5a217cad Deployed Nov 13, 2026 by vercel[bot]
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.

1 participant