fix: allow UUID version 1-8 as filter values#1486
Conversation
Summary by CodeRabbit
WalkthroughThe 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
✨ Simplify 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. Comment |
There was a problem hiding this comment.
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.
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
📒 Files selected for processing (2)
ui/hooks/filter-utils.test.tsui/hooks/filter-utils.ts
| 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; |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
# Verify all UUID_PATTERN definitions in the codebase
rg -n 'UUID_PATTERN\s*=' --type ts -A 1Repository: 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.
sorenbs
left a comment
There was a problem hiding this comment.
Hi @tobiasdcl — thanks for the fix and for including a regression test, much appreciated!
The change looks great: the version nibble bump to [1-8] correctly covers UUIDv6–v8 per RFC 9562 while still rejecting malformed values, and the v7 test case slots neatly into the existing table. We checked out your branch and the full filter-utils suite passes.
Two small notes, neither blocking:
- There's no changeset on the PR, so we'll add a patch changeset on our side right after merging to make sure this ships in the next
@prisma/studio-corerelease. - Purely FYI: nil (
0000…) and max (ffff…) UUIDs are still rejected by the pattern. That predates your change, so no action needed — just noting it in case anyone hits it later.
Approving — thanks again for the contribution!
fixes #1485