Skip to content

feat: extend workspace build reasons to track connection types #18827

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 14 commits into
base: main
Choose a base branch
from

Conversation

kacpersaw
Copy link
Contributor

@kacpersaw kacpersaw commented Jul 10, 2025

This PR introduces new build reason values to identify what type of connection triggered a workspace build, helping to troubleshoot workspace-related issues.

Database Migration

Added migration 000349_extend_workspace_build_reason.up.sql that extends the build_reason enum with new values:

dashboard, cli, ssh_connection, vscode_connection, jetbrains_connection

Implementation

The build reason is specified through the API when creating new workspace builds:

UI Changes:

  • Tooltip with reason in Build history
image
  • Reason in Audit Logs Row tooltip
image image

@kacpersaw kacpersaw marked this pull request as ready for review July 14, 2025 15:10
Comment on lines 3 to 5
ALTER TYPE build_reason ADD VALUE IF NOT EXISTS 'ssh_connection';
ALTER TYPE build_reason ADD VALUE IF NOT EXISTS 'vscode_connection';
ALTER TYPE build_reason ADD VALUE IF NOT EXISTS 'jetbrains_connection';
Copy link
Member

@ethanndickson ethanndickson Jul 15, 2025

Choose a reason for hiding this comment

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

The _connection part is implicit here - if you're using any of these, it was to connect to the workspace. I would personally drop the suffixes, but it's up to you.

@kacpersaw kacpersaw requested a review from BrunoQuaresma July 15, 2025 14:15
Copy link
Collaborator

@BrunoQuaresma BrunoQuaresma left a comment

Choose a reason for hiding this comment

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

FE code looks good 👍, only left a minor comment

@@ -87,6 +92,26 @@ export const getDisplayWorkspaceBuildInitiatedBy = (
return undefined;
};

export const getDisplayInitiatorBuildReason = (
Copy link
Collaborator

Choose a reason for hiding this comment

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

Nit: I think this is a nice case to use records.

const buildReasonLabels: Record<BuildReason, string> = {
	initiator: "API",
	dashboard: "Dashboard",
	cli: "CLI",
	// ...
}

So you can use it directly in the component:

<span>{buildReasonLabels[log.build_reason]}</span>

Wdyt?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@BrunoQuaresma I’ve slightly modified the impl based on your suggestion. PTAL

@kacpersaw kacpersaw requested a review from aslilac as a code owner July 16, 2025 09:34
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.

4 participants