Thanks to visit codestin.com
Credit goes to github.com

Skip to content

chore(site): add generateConnectionSessionId helper function - #27935

Merged
aqandrew merged 8 commits into
mainfrom
aqandrew/generate-session-id-helper-function
Aug 11, 2026
Merged

chore(site): add generateConnectionSessionId helper function#27935
aqandrew merged 8 commits into
mainfrom
aqandrew/generate-session-id-helper-function

Conversation

@aqandrew

@aqandrew aqandrew commented Aug 6, 2026

Copy link
Copy Markdown
Contributor
  • adds a generateConnectionSessionId helper function which reuses our existing generateRandomString logic
  • adds tests for generateConnectionSessionId in utils/random.test.ts (utils/random.ts was previously untested)
  • renames our existing generateRandomString function to be generateRandomBase64String

additional context in #27671 (comment)

This PR doesn't change any of our UIs. The new generateConnectionSessionId function is a piece of frontend plumbing related to DEVEX-663. I originally implemented #27677 so that web terminal connections to workspaces would be identified by uuids--but according to the RFC for DEVEX-663, those connection session ids should be lowercase hexadecimal strings (not uuids).

Comment thread site/src/utils/random.ts
* Generate a random hexadecimal string from the specified number of bytes.
*/
const generateRandomString = (bytes: number): string => {
const byteArr = crypto.getRandomValues(new Uint8Array(bytes));

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

getRandomValues not getRandomBytes 👍
bytes are mapped into hex characters as a string.

@untra

untra commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

I approved this because it looked like the CI light was 🟢 , but apparently github actions was having a severe outage last night, and it's now clear no CI steps have run for this last commit. This PR has tests and the renamed functions are clear. hmu for a re-review after ci runs again

@aqandrew
aqandrew requested a review from untra August 10, 2026 20:25
@aqandrew

Copy link
Copy Markdown
Contributor Author

@untra ready for review again! There's 1 failing check but it's an unrelated Pixel test

Comment thread site/src/pages/TemplateBuilder/TemplateBuilderPage.tsx
Comment thread site/src/pages/TemplateBuilder/TemplateBuilderPage.tsx
@aqandrew
aqandrew marked this pull request as draft August 10, 2026 23:41
@aqandrew aqandrew changed the title feat(site): generate random hex string (non-uuid) for template builder session ID chore(site): add generateConnectionSessionId helper function Aug 10, 2026
@linear-code

linear-code Bot commented Aug 10, 2026

Copy link
Copy Markdown

DEVEX-663

@aqandrew
aqandrew marked this pull request as ready for review August 10, 2026 23:59

@jeremyruppel jeremyruppel left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

looks great! sorry for the bad info about Template Builder session IDs!

@aqandrew
aqandrew merged commit b721935 into main Aug 11, 2026
39 checks passed
@aqandrew
aqandrew deleted the aqandrew/generate-session-id-helper-function branch August 11, 2026 16:38
@github-actions github-actions Bot locked and limited conversation to collaborators Aug 11, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants