Skip to content

feat(dynamic-variables): generate UUID v7 for $randomUUID - #9043

Open
Max-Reisinger wants to merge 2 commits into
usebruno:mainfrom
Max-Reisinger:feature/random-uuid-v7
Open

feat(dynamic-variables): generate UUID v7 for $randomUUID#9043
Max-Reisinger wants to merge 2 commits into
usebruno:mainfrom
Max-Reisinger:feature/random-uuid-v7

Conversation

@Max-Reisinger

@Max-Reisinger Max-Reisinger commented Aug 20, 2026

Copy link
Copy Markdown
Contributor

Description

Updates the built-in {{$randomUUID}} dynamic variable to generate UUID version 7 values.

Problem

{{$randomUUID}} currently uses faker.string.uuid(), which generates UUID v4 values. This prevents users from using a time-ordered UUID v7 through the built-in dynamic variable, including in WebSocket messages.

Fixes #9040

Fix

  • Added uuid@^10.0.0 and its TypeScript definitions to the bruno-common build dependencies.
  • Replaced the faker.string.uuid() call for randomUUID with uuid.v7().
  • Updated the existing dynamic-variable test to validate the UUID v7 version and variant bits.
  • Kept the existing {{$guid}} behavior unchanged.

Testing

  • npm test --workspace=packages/bruno-common -- --runInBand
  • npm run lint -- packages/bruno-common/src/utils/faker-functions.ts packages/bruno-common/src/utils/faker-functions.spec.ts
  • npm run build --workspace=packages/bruno-common
  • Verified the built CommonJS artifact generates a UUID reported as version 7.

Screenshots

Not applicable. This change does not modify the UI.

Contribution Checklist:

  • I've used AI significantly to create this pull request
  • The pull request only addresses one issue or adds one feature.
  • The pull request does not introduce any breaking changes
  • I have added screenshots or gifs to help explain the change if applicable.
  • I have read the contribution guidelines.
  • Create an issue and link to the pull request.
  • I've run the claude code review skill locally.

Summary by CodeRabbit

  • Enhancements
    • Updated generated random UUID values to use the newer UUIDv7 format.
    • Improved UUID validation to ensure generated values follow the expected standard.

@coderabbitai

coderabbitai Bot commented Aug 20, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 707f97d3-5d33-4fb6-bb8d-9285fe1e9748

📥 Commits

Reviewing files that changed from the base of the PR and between 15e0242 and df51176.

📒 Files selected for processing (1)
  • packages/bruno-common/src/utils/faker-functions.spec.ts

Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review.


Walkthrough

The built-in randomUUID mock now generates UUIDv7 values through the uuid package. Tests validate UUIDv7 version and variant bits, timestamp encoding, and lexicographic ordering.

Changes

UUID v7 dynamic variable

Layer / File(s) Summary
UUID v7 generation and dependencies
packages/bruno-common/package.json, packages/bruno-common/src/utils/faker-functions.ts
Added uuid dependencies and changed mockDataFunctions.randomUUID to use uuidv7().
UUID v7 format and ordering validation
packages/bruno-common/src/utils/faker-functions.spec.ts
Added timestamp and ordering coverage. Updated UUID patterns for version 4 and version 7 with valid RFC variant bits.

Estimated code review effort: 2 (Simple) | ~10 minutes

Merge Risk: ⚪ Minimal · up to df511

This localized change updates the built-in random UUID generation to UUID v7, with no actionable merge-blocking risk remaining beyond normal checks and review.

Suggested reviewers: bijin-bruno

Poem

Version seven starts,
Timestamps guide each new UUID,
Ordered values grow,
Variant bits stay valid,
Tests record the flow.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly describes the main change: generating UUID v7 for the $randomUUID dynamic variable.
Linked Issues check ✅ Passed The changes implement issue #9040 by generating UUID v7 values and adding tests for version, variant, ordering, and unchanged UUID length.
Out of Scope Changes check ✅ Passed The dependency, implementation, and test changes directly support the linked issue and PR objectives.
Docstring Coverage ✅ Passed Docstring check was indeterminate for this PR — some files could not be analyzed in time. Not blocking.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

update the inbuilt dynamic variable {{$randomUUID}} to uuid version 7

1 participant