Skip to content

fix(archive): guard non-uuid route params before querying — stray paths threw 22P02 in Postgres#673

Merged
SomethingNew71 merged 1 commit into
mainfrom
fix/archive-uuid-guard
Jul 16, 2026
Merged

fix(archive): guard non-uuid route params before querying — stray paths threw 22P02 in Postgres#673
SomethingNew71 merged 1 commit into
mainfrom
fix/archive-uuid-guard

Conversation

@SomethingNew71

Copy link
Copy Markdown
Collaborator

What

getWheel / getColor passed the raw catch-all route segment straight into .eq('id', ...) on a uuid column. Any non-uuid path — /archive/colors/review (seen live in the Postgres error logs today: 22P02 invalid input syntax for type uuid: "review"), crawler junk, or the wheel page's literal 'noWheel' fallback — reached Postgres and threw. The client already swallowed the error into a not-found state, so the only symptom was server-side error noise.

Fix

Validate the id against the repo's existing UUID_RE idiom (same regex as the server/api routes) and return null before querying. User-visible behavior is unchanged — non-uuid paths land on the same not-found rendering as before, just without a Postgres round-trip.

Tests

  • Updated getWheel/getColor test call args to valid uuids (row fixture ids unchanged).
  • New regression tests assert a non-uuid id returns null and Supabase is never called.
  • bun run test on both suites: 58 passed.

🤖 Generated with Claude Code

…hs threw 22P02 in Postgres

getWheel/getColor passed the raw catch-all segment into eq('id', ...) on a
uuid column, so hits like /archive/colors/review (and the 'noWheel' fallback)
logged "invalid input syntax for type uuid" errors in Postgres. Validate the
param against the repo's UUID_RE idiom and return null (existing not-found
path) before any query. Adds regression tests asserting Supabase is never
called for non-uuid ids.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings July 16, 2026 01:44
@vercel

vercel Bot commented Jul 16, 2026

Copy link
Copy Markdown

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

Project Deployment Actions Updated (UTC)
classicminidiy Ready Ready Preview, Comment Jul 16, 2026 1:48am

Request Review

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR prevents noisy Postgres 22P02 invalid input syntax for type uuid errors from /archive/wheels/* and /archive/colors/* by short-circuiting getWheel/getColor when the route param is not a UUID, avoiding unnecessary Supabase/Postgres queries while keeping the same “not found” UX.

Changes:

  • Added a UUID_RE guard in getWheel and getColor to return null before querying when the id is not UUID-shaped.
  • Updated unit tests to call getWheel/getColor with UUID-like inputs and added regression tests asserting invalid ids do not call Supabase.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.

File Description
app/composables/useWheels.ts Adds UUID validation guard to prevent invalid route params from reaching eq('id', ...) on a uuid column.
app/composables/useColors.ts Adds UUID validation guard to prevent invalid route params from reaching eq('id', ...) on a uuid column.
tests/unit/composables/useWheels.test.ts Updates call args to UUIDs and adds regression coverage that non-UUID ids return null without querying Supabase.
tests/unit/composables/useColors.test.ts Updates call args to UUIDs and adds regression coverage that non-UUID ids return null without querying Supabase.

@SomethingNew71
SomethingNew71 merged commit d98dcdd into main Jul 16, 2026
3 checks passed
@SomethingNew71
SomethingNew71 deleted the fix/archive-uuid-guard branch July 16, 2026 01:49
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