chore(types): regen database.ts after postgame/signals prod reconcile#805
Conversation
Prod schema moved under the two reconcile migrations merged in #804 (applied 2026-07-11); regenerate so the committed types match the live database again. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019WJ1Gzjj9MT3UsxhMoMzSV
|
No reviewable files after applying ignore patterns. |
|
Important Review skippedReview was skipped due to path filters ⛔ Files ignored due to path filters (1)
CodeRabbit blocks several paths by default. You can override this behavior by explicitly including those paths in the path filters. For example, including ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
|
This pull request has been ignored for the connected project Preview Branches by Supabase. |
PR Summary by QodoRegenerate Supabase database types after postgame schema reconcile
AI Description
Diagram
High-Level Assessment
Files changed (1)
|
Code Review by Qodo
Context used✅ Compliance rules (platform):
98 rules 1. Null title breaks conversion
|
| item_kind: string | null | ||
| item_type: string | ||
| owner_role: string | null | ||
| player_id: string | null | ||
| player_visible: boolean | ||
| priority: string | ||
| review_id: string | ||
| signal_source: string | null | ||
| source_refs: Json | ||
| team_id: string | ||
| timeline_event_id: string | null | ||
| title: string | null | ||
| updated_at: string | null |
There was a problem hiding this comment.
1. Null title breaks conversion 🐞 Bug ☼ Reliability
Database now types baseball_postgame_review_items.title as nullable, but convertPostgameItemToTimeline forwards item.title into appendTimelineEvent which hard-rejects missing/blank titles; any DB row with a null/blank title will make conversion fail and the caller only returns a generic error. The postgame read-model also returns row.title as a required string, so nullable titles can leak into UI data without any fallback.
Agent Prompt
### Issue description
`src/lib/types/database.ts` now reflects production nullability for postgame review item titles (`title: string | null`). Downstream code assumes a non-null title and can fail at runtime when attempting to convert an item to a timeline event because `appendTimelineEvent` requires a non-empty title.
### Issue Context
- Conversion path: `convertPostgameItemToTimeline` loads a postgame item and passes `item.title` directly into `appendTimelineEvent`.
- `appendTimelineEvent` returns `{ ok:false, error:'A timeline event title is required.' }` when title is null/blank.
- The conversion action currently discards this specific error and returns a generic message.
- The postgame read-model also treats `row.title` as a required string.
### Fix Focus Areas
- src/app/baseball/actions/postgame.ts[275-312]
- src/lib/baseball/timeline-writer.ts[155-166]
- src/lib/baseball/read-models/postgame.ts[42-189]
### Suggested fix
1. In `convertPostgameItemToTimeline`, validate `item.title` before calling `appendTimelineEvent`:
- If missing/blank, return a specific error (e.g. `Item is missing a title; cannot convert.`).
- Optionally, propagate `appended.error` instead of always returning `'Could not log the timeline event.'`.
2. In the postgame read-model `mapItem`, ensure `title` is never returned as `null` (either validate and drop/flag invalid rows, or provide a safe fallback string).
3. If titles are intended to be mandatory, consider enforcing `NOT NULL` at the DB level so the schema matches the application invariant.
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools
Summary
Prod schema moved under the two reconcile migrations merged in #804 and applied to production today, so the committed
database.tsno longer matched the live database. This regenerates it verbatim from prod (Supabase type generator, no hand edits).Diff is confined to
baseball_postgame_reviews/baseball_postgame_review_items(the reconciled columns,bodynow nullable) plus new FKRelationshipsentries forcoach_idandtimeline_event_id. The generator also dropped the emptygraphql_publicschema block from its output — nothing insrc/references it.Partner-readable summary
Internal type definitions updated to match the production database after today's schema fixes. No user-facing change.
Type of change
Area
baseball · ci
Risk level
Git Activity Timeline note
Keeps generated database types in sync with production after the postgame/signals schema fixes.
Checklist
npm run typecheckpasses (exit 0)npm run docs:checkpasses (no glossary drift)🤖 Generated with Claude Code
https://claude.ai/code/session_019WJ1Gzjj9MT3UsxhMoMzSV
Generated by Claude Code