Skip to content

feat(api): mint submission, run and report IDs as UUIDv7 - #1579

Open
Naveen Chatlapalli (1aifanatic) wants to merge 1 commit into
microsoft:mainfrom
1aifanatic:feat/572-uuidv7-ids
Open

Naveen Chatlapalli (1aifanatic) wants to merge 1 commit into
microsoft:mainfrom
1aifanatic:feat/572-uuidv7-ids

Conversation

@1aifanatic

@1aifanatic Naveen Chatlapalli (1aifanatic) commented Oct 27, 2026 •

Copy link
Copy Markdown

Summary

Fixes #572.

The API now mints these IDs with UUIDv7 (RFC 9562) instead of UUIDv4:

  • submissionId (single, multi-run, profile-variation and bulk-resubmit submissions, plus the fallback minted when an uploaded run archive has none)
  • request _id and each attempt's run._id, including retries
  • report _id (POST /reports, bulk create, bulk trigger)

UUIDv7 puts a millisecond timestamp in the most significant bits, so string and binary sort order is creation order. Grouping the runs list by submissionId now sorts chronologically by default, and index inserts become append-mostly.

What doesn't change

  • Existing v4 IDs stay valid. Same format and length, no migration. They simply carry no ordering, and they age out of active views.
  • Content-addressed UUIDv5 IDs (task prompts, skill revisions) are untouched.
  • Profile, insight and token-manager IDs still use v4. They aren't grouped or ordered by ID, so I kept this PR to the IDs the issue targets. Happy to extend it if you'd like everything on v7.

uuid@^11.1.1 is already a dependency of apps/api and ships v7, so there's no new dependency.

Tests

apps/api/src/endpoints.test.ts:

  • a single submission's submissionId, request _id and run._id match a strict v7 pattern
  • three sequential submissions return IDs whose lexical sort equals creation order
  • every run of a count: 2 submission gets v7 request and run IDs and shares the submission ID
  • POST /reports returns a v7 report ID

npx vitest run apps/api/src: 37 files, 791 tests pass. tsc --noEmit for apps/api is clean.

Docs

docs/architecture/app-design.md (Run submission flow) documents which IDs are v7, why, and how legacy v4 IDs behave.

🤖 Generated with Claude Code

UUIDv7 encodes the creation time in its leading bits, so new submission,
request, run and report IDs sort chronologically. Grouping the runs list by
submission ID now orders by time without a separate timestamp. Existing v4
IDs remain valid; content-addressed v5 IDs are unchanged.

Fixes microsoft#572

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

This branch has not been deployed

No deployments
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.

Switch submission IDs from UUIDv4 to UUIDv7 for natural time ordering

1 participant