Skip to content

fix: allow UUID version 1-8 as filter values#1486

Open
tobiasdcl wants to merge 3 commits into
prisma:mainfrom
tobiasdcl:main
Open

fix: allow UUID version 1-8 as filter values#1486
tobiasdcl wants to merge 3 commits into
prisma:mainfrom
tobiasdcl:main

Conversation

@tobiasdcl

Copy link
Copy Markdown

fixes #1485

@coderabbitai

coderabbitai Bot commented Jun 16, 2026

Copy link
Copy Markdown

Review Change Stack

Summary by CodeRabbit

  • Bug Fixes
    • Improved UUID validation to accept UUID versions 6, 7, and 8 in filters, in addition to previously supported versions 1-5.

Walkthrough

The UUID_PATTERN regex inside isValidUuidLiteral in filter-utils.ts has its version nibble character class widened from [1-5] to [1-8], allowing UUIDs of versions 6, 7, and 8 to pass validation. A corresponding test row using a UUIDv7 value is added to the parameterized "accepts relevant filters" table in filter-utils.test.ts.

πŸš₯ Pre-merge checks | βœ… 5
βœ… Passed checks (5 passed)
Check name Status Explanation
Title check βœ… Passed The title accurately and concisely describes the main change: extending UUID version support from 1-5 to 1-8 in filter validation.
Description check βœ… Passed The description references the linked issue #1485 that directly relates to the UUID validation changes made in the pull request.
Linked Issues check βœ… Passed The code changes fully address issue #1485 by updating the UUID validation regex pattern to accept UUID versions 1-8 instead of 1-5, and adding a test case for UUIDv7.
Out of Scope Changes check βœ… Passed All changes are directly scoped to the UUID validation requirement: the regex update in filter-utils.ts and a corresponding test case addition in filter-utils.test.ts.
Docstring Coverage βœ… Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
πŸ§ͺ Generate unit tests (beta)
  • Create PR with unit tests
✨ Simplify code
  • Create PR with simplified code

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❀️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot 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.

Warning

CodeRabbit couldn't request changes on this pull request because it doesn't have sufficient GitHub permissions.

Please grant CodeRabbit Pull requests: Read and write permission and re-run the review.

πŸ‘‰ Steps to fix this

Actionable comments posted: 1

πŸ€– Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@ui/hooks/filter-utils.ts`:
- Around line 218-219: The UUID_PATTERN regex in the backend parseUuidTerm
function currently restricts validation to UUID versions 1-5 using [1-5], but
the UI has been updated to accept versions 1-8 using [1-8]. This mismatch causes
valid UUIDv6/7/8 values to pass UI validation but then fail at the backend,
breaking filter queries. Update the UUID_PATTERN regex in the parseUuidTerm
validation to use [1-8] instead of [1-5] to match the UI validation contract and
ensure consistency across both layers.
πŸͺ„ Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
βš™οΈ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: c749f856-4cb0-439a-baf1-ebb5621c70f6

πŸ“₯ Commits

Reviewing files that changed from the base of the PR and between 3631a93 and 4094bb3.

πŸ“’ Files selected for processing (2)
  • ui/hooks/filter-utils.test.ts
  • ui/hooks/filter-utils.ts

Comment thread ui/hooks/filter-utils.ts
Comment on lines 218 to +219
const UUID_PATTERN =
/^[\da-f]{8}-[\da-f]{4}-[1-5][\da-f]{3}-[89ab][\da-f]{3}-[\da-f]{12}$/i;
/^[\da-f]{8}-[\da-f]{4}-[1-8][\da-f]{3}-[89ab][\da-f]{3}-[\da-f]{12}$/i;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | πŸ”΄ Critical

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Verify all UUID_PATTERN definitions in the codebase
rg -n 'UUID_PATTERN\s*=' --type ts -A 1

Repository: prisma/studio

Length of output: 368


Backend UUID validation still restricts to versions 1–5, breaking UUIDv6/7/8 filters.

The UI regex was widened to [1-8] but data/full-table-search.ts (lines 27–29) still uses [1-5]. This causes valid UUIDv6/7/8 values to pass UI validation and then fail at the backend parseUuidTerm function, breaking filter queries.

Update UUID_PATTERN in data/full-table-search.ts to [1-8] to match the UI validation contract.

πŸ€– Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@ui/hooks/filter-utils.ts` around lines 218 - 219, The UUID_PATTERN regex in
the backend parseUuidTerm function currently restricts validation to UUID
versions 1-5 using [1-5], but the UI has been updated to accept versions 1-8
using [1-8]. This mismatch causes valid UUIDv6/7/8 values to pass UI validation
but then fail at the backend, breaking filter queries. Update the UUID_PATTERN
regex in the parseUuidTerm validation to use [1-8] instead of [1-5] to match the
UI validation contract and ensure consistency across both layers.

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.

filter does not allow UUIDv7 as value

1 participant