Skip to content

Conversation

@brendan-kellam
Copy link
Contributor

@brendan-kellam brendan-kellam commented Oct 31, 2025

This PR fixes a exception that was being thrown when viewing the connections page with a git connection. The root-cause was that we were calling getCodeHostIcon with a connectionType, where it was meant to accept a codeHostType.

Backstory

The Connection table has a connectionType column that stores the connection's type (i.e., the code host). This field is sourced from the config schema and can be one of the following values:

github
gitlab
gitea
gerrit
bitbucket
azuredevops
git

The Repo table has a external_codeHostType that stores the type of code host it belongs to. This is deceptively similar to connectionType, but for reasons lost to time, the values this field can take on are slightly different:

github
gitlab
gitea
gerrit
bitbucket-server
bitbucket-cloud
generic-git-host
azuredevops

Both connectionType and external_codeHostType were of type String, so we didn't have any type guarantees, and there were some places where we were comparing to the wrong values (hence this bug).

To help combat this, I've introduced two enums into the schema ConnectionType and CodeHostType that explicitly define the valid values for connectionType and external_codeHostType, respectively. Since we know all possible values for these fields, the migrations I've added simply map from the string into the corresponding enum value. This adds type safety throughout a lot of paths dealing with these fields.

Fixes #586

Summary by CodeRabbit

  • Refactor
    • Strengthened type safety for code hosting platforms and repository connections through improved internal type definitions.
    • Migrated repository and connection data to use standardized enumerated types in the database for enhanced consistency.
    • Streamlined component rendering logic for repository and code host information display across the platform.

@coderabbitai
Copy link

coderabbitai bot commented Oct 31, 2025

Important

Review skipped

Auto reviews are disabled on this repository.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Walkthrough

Introduces CodeHostType and ConnectionType enums for improved type safety. Creates database migrations converting connectionType and external_codeHostType columns to enum types, updates Prisma schema definitions, and systematically migrates code to use enums instead of string literals, replacing patterns like 'generic-git-host' with 'genericGitHost' and bitbucket variants.

Changes

Cohort / File(s) Summary
Database Schema & Migrations
packages/db/prisma/schema.prisma, packages/db/prisma/migrations/20251031012851_change_connection_type_to_enum/migration.sql, packages/db/prisma/migrations/20251031014307_change_repo_code_host_type_to_enum/migration.sql
Introduces two new PostgreSQL enums (ConnectionType and CodeHostType); converts Repo.external_codeHostType and Connection.connectionType columns from TEXT to their respective enum types via migration; updates Prisma schema to reflect these enum types with documentation and map annotations for Bitbucket variants.
Backend Type Annotations
packages/backend/src/constants.ts, packages/backend/src/repoCompileUtils.ts, packages/backend/src/utils.ts
Adds CodeHostType import from @sourcebot/db and types PERMISSION_SYNC_SUPPORTED_CODE_HOST_TYPES; updates repoCompileUtils to use CodeHostType for Bitbucket configuration and replace 'generic-git-host' with 'genericGitHost'; changes external_codeHostType checks from 'generic-git-host' to 'genericGitHost' in getRepoPath.
Frontend Type Migration
packages/web/src/app/[domain]/chat/components/demoCards.tsx, packages/web/src/app/[domain]/components/configEditor.tsx, packages/web/src/app/[domain]/components/importSecretDialog.tsx, packages/web/src/features/chat/components/searchScopeIcon.tsx, packages/web/src/features/chat/components/chatThread/referencedFileSourceListItem.tsx, packages/web/src/app/[domain]/settings/secrets/components/importSecretCard.tsx
Migrates CodeHostType import source from @/lib/utils to @sourcebot/db; updates function signatures and prop types to use CodeHostType; updates Bitbucket case labels from 'bitbucket-cloud'/'bitbucket-server' to 'bitbucketCloud'/'bitbucketServer'.
Repository & Repo Table Components
packages/web/src/app/[domain]/components/navigationMenu/progressIndicator.tsx, packages/web/src/app/[domain]/components/pathHeader.tsx, packages/web/src/app/[domain]/components/repositoryCarousel.tsx, packages/web/src/app/[domain]/repos/components/repoBranchesTable.tsx, packages/web/src/app/[domain]/repos/components/reposTable.tsx
Removes FileIcon fallbacks and simplifies rendering to always use icon/displayName from info object; removes LaptopIcon import; types codeHostType as CodeHostType instead of string in repo type definitions; removes unnecessary casts and updates getCodeHostIcon calls.
Browse & Repo Details
packages/web/src/app/[domain]/browse/[...path]/components/codePreviewPanel.tsx, packages/web/src/app/[domain]/repos/[id]/page.tsx
Removes guard against missing codeHostInfo in Open-in link rendering (now depends only on fileWebUrl); simplifies repo link button rendering by removing codeHostInfo short-circuit check.
Connections Management
packages/web/src/app/[domain]/settings/connections/[id]/page.tsx, packages/web/src/app/[domain]/settings/connections/components/connectionsTable.tsx, packages/web/src/app/[domain]/settings/connections/page.tsx
Replaces codeHostType: CodeHostType with connectionType: ConnectionType in Connection type; updates Bitbucket handling from separate server/cloud cases to unified 'bitbucket' case; renames 'generic-git-host' case to 'git'; updates getCodeHostIcon calls to use connection.connectionType.
Utilities & Schema Validation
packages/web/src/lib/utils.ts, packages/web/src/lib/schemas.ts, packages/web/src/features/search/schemas.ts, packages/web/src/features/fileTree/actions.ts
Removes CodeHostType export from utils; updates getCodeHostInfoForRepo return type from CodeHostInfo | undefined to CodeHostInfo; expands getCodeHostIcon signature to accept CodeHostType | ConnectionType; adds new case labels (bitbucket, bitbucketCloud, bitbucketServer, git, genericGitHost) to switch statements; converts schema validation fields from z.string() to z.nativeEnum(CodeHostType); updates generic-git-host checks to genericGitHost.

Sequence Diagram

Not applicable—this is a systematic type safety refactoring with enum introduction. No new control flows or feature interactions are introduced.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

  • Areas requiring extra attention:
    • Removed guards in codePreviewPanel.tsx and repos/[id]/page.tsx: These now render/access codeHostInfo without null checks; verify that fileWebUrl being truthy reliably implies codeHostInfo is available or handle undefined gracefully.
    • Generic-git-host → genericGitHost migration: Verify this string mapping is consistently applied across all paths (backend utils, repoCompileUtils, fileTree actions) and doesn't break file: protocol handling.
    • Bitbucket case consolidation: New Bitbucket Cloud/Server logic in connections/[id]/page.tsx uses deploymentType to choose between config.url and defaults; confirm this aligns with actual connection behavior.
    • getCodeHostInfoForRepo return type change: Now always returns CodeHostInfo instead of CodeHostInfo | undefined; ensure all call sites are prepared for this contract change.
    • Icon/displayName fallback removal: Multiple components now remove FileIcon fallbacks when info is absent; verify info object is always available in those contexts.

Possibly related PRs

  • PR feat: Generic git host support (local & remote) #307: Directly related—introduces generic-git-host support that this PR now renames to genericGitHost and propagates throughout the codebase.
  • PR Add Bitbucket support #275: Related—introduces Bitbucket support (bitbucket-cloud/bitbucket-server) that this PR now consolidates and renames to bitbucketCloud/bitbucketServer enums.
  • PR V4 #311: Directly related—modifies CodeHostType enum and repo/DB types with similar enum and string-literal migrations.

Suggested labels

sourcebot-team

Suggested reviewers

  • msukkari

Pre-merge checks and finishing touches

❌ Failed checks (2 warnings)
Check name Status Explanation Resolution
Out of Scope Changes Check ⚠️ Warning While most changes are necessary for implementing type-safe enums to fix issue #586, several modifications appear to be out of scope. Multiple UI components have had null safety checks removed without clear justification relative to the issue requirements: codePreviewPanel.tsx removes the guard against undefined codeHostInfo, repos/[id]/page.tsx removes the short-circuit check for codeHostInfo, progressIndicator.tsx and repositoryCarousel.tsx remove fallback logic when info is absent, and reposTable.tsx removes the codeHostInfo dependency check. These defensive changes are unrelated to the specific requirement of recognizing git connections and could introduce runtime errors if the assumed data structures are not always present. Review and reconsider the removal of null safety checks in codePreviewPanel.tsx, repos/[id]/page.tsx, navigationMenu/progressIndicator.tsx, repositoryCarousel.tsx, and reposTable.tsx. These changes should either be removed as they're not necessary to fix issue #586, or their necessity should be clearly justified with additional test coverage demonstrating that these values will always be present in all code paths. Consider splitting these potentially risky refactorings into a separate PR focused on null safety improvements.
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed The PR title "fix(web): Fix /settings/connections throwing a error when there is a git connection present" clearly and specifically describes the main issue being fixed. It identifies both the page affected and the specific scenario causing the error, matching the core bug from linked issue #586 where git connections cause the connections view to fail. While the PR involves broader refactoring to introduce type-safe enums, the title accurately captures the primary bug being addressed from the user's perspective.
Linked Issues Check ✅ Passed The PR addresses the core requirements from issue #586 by introducing ConnectionType and CodeHostType enums that properly distinguish between connection types and repository code host types. The ConnectionType enum includes 'git' as a valid value, and getCodeHostIcon is updated to accept both CodeHostType | ConnectionType, including 'git' in its switch cases. This prevents the runtime error that occurred when git connections were passed to functions expecting only CodeHostType values. The database migrations and schema updates ensure type safety, and the connectionsTable is updated to use ConnectionType correctly. These changes directly resolve the issue where git connections defined in v3 config schema fail to load in the UI.

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 and usage tips.

@github-actions

This comment has been minimized.

@brendan-kellam
Copy link
Contributor Author

@coderabbitai review

@coderabbitai
Copy link

coderabbitai bot commented Oct 31, 2025

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (3)
packages/backend/src/utils.ts (1)

62-67: Leverage the new enum constant

We just promoted these fields to enums so we can stop relying on raw strings. Please switch this comparison to CodeHostType.genericGitHost (and import the enum) so future refactors stay type-safe.

Apply this diff:

-import { PrismaClient, Repo } from "@sourcebot/db";
+import { PrismaClient, Repo, CodeHostType } from "@sourcebot/db";
@@
-    if (repo.external_codeHostType === 'genericGitHost' && cloneUrl.protocol === 'file:') {
+    if (repo.external_codeHostType === CodeHostType.genericGitHost && cloneUrl.protocol === 'file:') {
packages/web/src/app/[domain]/components/importSecretDialog.tsx (1)

87-101: Use the enum in the switch

Now that codeHostType is strongly typed, we can stop matching on bare strings. Please switch these cases to the corresponding CodeHostType.* members so future renames stay in sync.

Here’s a concrete update:

-        switch (codeHostType) {
-            case 'github':
+        switch (codeHostType) {
+            case CodeHostType.github:
                 return <GitHubPATCreationStep step={1} />;
-            case 'gitlab':
+            case CodeHostType.gitlab:
                 return <GitLabPATCreationStep step={1} />;
-            case 'bitbucketCloud':
+            case CodeHostType.bitbucketCloud:
                 return <BitbucketCloudPATCreationStep step={1} />;
-            case 'bitbucketServer':
+            case CodeHostType.bitbucketServer:
                 return <BitbucketServerPATCreationStep step={1} />;
-            case 'gitea':
+            case CodeHostType.gitea:
                 return <GiteaPATCreationStep step={1} />;
-            case 'gerrit':
+            case CodeHostType.gerrit:
                 return null;
packages/web/src/app/[domain]/settings/connections/[id]/page.tsx (1)

72-76: Consider adding fallback for Bitbucket Server URL.

Line 75 uses a non-null assertion (config.url!) for Bitbucket Server, which will throw if config.url is undefined. While the config schema likely enforces this for server deployments, an explicit error or fallback would make the code more defensive.

Consider replacing the non-null assertion with an explicit check:

 case 'bitbucket': {
     const config = connection.config as unknown as BitbucketConnectionConfig;
     if (config.deploymentType === 'cloud') {
         return config.url ?? 'https://bitbucket.org';
     } else {
-        return config.url!;
+        return config.url ?? (() => { throw new Error('Bitbucket Server URL is required but not configured') })();
     }
 }
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 4899c9f and 01e2d65.

📒 Files selected for processing (26)
  • packages/backend/src/constants.ts (1 hunks)
  • packages/backend/src/repoCompileUtils.ts (5 hunks)
  • packages/backend/src/utils.ts (1 hunks)
  • packages/db/prisma/migrations/20251031012851_change_connection_type_to_enum/migration.sql (1 hunks)
  • packages/db/prisma/migrations/20251031014307_change_repo_code_host_type_to_enum/migration.sql (1 hunks)
  • packages/db/prisma/schema.prisma (4 hunks)
  • packages/web/src/app/[domain]/browse/[...path]/components/codePreviewPanel.tsx (1 hunks)
  • packages/web/src/app/[domain]/chat/components/demoCards.tsx (1 hunks)
  • packages/web/src/app/[domain]/components/configEditor.tsx (1 hunks)
  • packages/web/src/app/[domain]/components/importSecretDialog.tsx (2 hunks)
  • packages/web/src/app/[domain]/components/navigationMenu/progressIndicator.tsx (2 hunks)
  • packages/web/src/app/[domain]/components/pathHeader.tsx (3 hunks)
  • packages/web/src/app/[domain]/components/repositoryCarousel.tsx (1 hunks)
  • packages/web/src/app/[domain]/repos/[id]/page.tsx (1 hunks)
  • packages/web/src/app/[domain]/repos/components/repoBranchesTable.tsx (2 hunks)
  • packages/web/src/app/[domain]/repos/components/reposTable.tsx (6 hunks)
  • packages/web/src/app/[domain]/settings/connections/[id]/page.tsx (3 hunks)
  • packages/web/src/app/[domain]/settings/connections/components/connectionsTable.tsx (3 hunks)
  • packages/web/src/app/[domain]/settings/connections/page.tsx (2 hunks)
  • packages/web/src/app/[domain]/settings/secrets/components/importSecretCard.tsx (1 hunks)
  • packages/web/src/features/chat/components/chatThread/referencedFileSourceListItem.tsx (2 hunks)
  • packages/web/src/features/chat/components/searchScopeIcon.tsx (1 hunks)
  • packages/web/src/features/fileTree/actions.ts (1 hunks)
  • packages/web/src/features/search/schemas.ts (3 hunks)
  • packages/web/src/lib/schemas.ts (2 hunks)
  • packages/web/src/lib/utils.ts (9 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
**/*

📄 CodeRabbit inference engine (.cursor/rules/style.mdc)

Filenames should always be camelCase. Exception: if there are filenames in the same directory with a format other than camelCase, use that format to keep things consistent.

Files:

  • packages/web/src/lib/schemas.ts
  • packages/web/src/app/[domain]/components/pathHeader.tsx
  • packages/web/src/app/[domain]/browse/[...path]/components/codePreviewPanel.tsx
  • packages/web/src/app/[domain]/repos/[id]/page.tsx
  • packages/web/src/app/[domain]/settings/connections/[id]/page.tsx
  • packages/web/src/features/search/schemas.ts
  • packages/backend/src/constants.ts
  • packages/db/prisma/migrations/20251031012851_change_connection_type_to_enum/migration.sql
  • packages/backend/src/repoCompileUtils.ts
  • packages/web/src/features/chat/components/searchScopeIcon.tsx
  • packages/web/src/app/[domain]/settings/connections/components/connectionsTable.tsx
  • packages/web/src/app/[domain]/settings/secrets/components/importSecretCard.tsx
  • packages/web/src/features/chat/components/chatThread/referencedFileSourceListItem.tsx
  • packages/db/prisma/schema.prisma
  • packages/backend/src/utils.ts
  • packages/web/src/app/[domain]/settings/connections/page.tsx
  • packages/web/src/app/[domain]/components/configEditor.tsx
  • packages/web/src/app/[domain]/components/importSecretDialog.tsx
  • packages/web/src/app/[domain]/repos/components/reposTable.tsx
  • packages/web/src/app/[domain]/components/navigationMenu/progressIndicator.tsx
  • packages/web/src/app/[domain]/chat/components/demoCards.tsx
  • packages/web/src/app/[domain]/components/repositoryCarousel.tsx
  • packages/db/prisma/migrations/20251031014307_change_repo_code_host_type_to_enum/migration.sql
  • packages/web/src/features/fileTree/actions.ts
  • packages/web/src/lib/utils.ts
  • packages/web/src/app/[domain]/repos/components/repoBranchesTable.tsx
🧠 Learnings (1)
📚 Learning: 2025-05-14T19:20:48.667Z
Learnt from: brendan-kellam
Repo: sourcebot-dev/sourcebot PR: 307
File: packages/backend/src/repoCompileUtils.ts:491-503
Timestamp: 2025-05-14T19:20:48.667Z
Learning: SSH/SCP-style Git URLs (like `gitgithub.com:org/repo.git`) throw errors when passed directly to JavaScript's `new URL()` constructor. A fix is to convert them using: `new URL(`ssh://${url.replace(':', '/')}`)` for non-HTTP URLs.

Applied to files:

  • packages/web/src/app/[domain]/settings/connections/[id]/page.tsx
  • packages/backend/src/repoCompileUtils.ts
  • packages/backend/src/utils.ts
  • packages/web/src/app/[domain]/repos/components/reposTable.tsx
  • packages/web/src/features/fileTree/actions.ts
  • packages/web/src/lib/utils.ts
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: build
🔇 Additional comments (22)
packages/web/src/app/[domain]/chat/components/demoCards.tsx (1)

13-13: Import migration to new CodeHostType enum location looks good.

The change correctly moves the CodeHostType import source from @/lib/utils to @sourcebot/db and applies the type to the getCodeHostIcon call on line 45. This aligns with the PR's goal of introducing enums for improved type safety and resolves the underlying type mismatch that was causing the bug.

Ensure that the getCodeHostIcon function in @/lib/utils has been updated to properly handle the CodeHostType enum values (including the renamed variants like genericGitHost). If the function signature or internal logic changed as part of this PR, verify that it correctly maps enum values to the expected icon data.

Also applies to: 45-45

packages/web/src/app/[domain]/components/configEditor.tsx (1)

16-16: LGTM! Import source change aligns with type safety improvements.

Moving CodeHostType from @/lib/utils to @sourcebot/db is consistent with the PR's objective to centralize enum definitions at the schema level, improving type safety across the codebase.

packages/web/src/app/[domain]/components/navigationMenu/progressIndicator.tsx (1)

94-99: Ensure fallback handling is consistent with getCodeHostInfoForRepo updates.

Similar to repositoryCarousel.tsx, the FileIcon fallback has been removed here as well. Please ensure that getCodeHostInfoForRepo has been updated to handle all enum values consistently across the codebase. See the verification request in repositoryCarousel.tsx.

packages/backend/src/repoCompileUtils.ts (3)

395-395: LGTM!

Explicit typing of codeHostType as CodeHostType adds type safety and correctly uses the enum values.


428-429: Good practice mapping enum values to external system expectations.

The explicit mapping from enum values (bitbucketServer/bitbucketCloud) to zoekt's expected format (bitbucket-server/bitbucket-cloud) is correct and well-commented.


511-511: LGTM!

The migration from 'generic-git-host' string literal to 'genericGitHost' enum value is consistent with the enum definition in schema.prisma where @map("generic-git-host") handles the database representation.

Also applies to: 575-575

packages/db/prisma/migrations/20251031014307_change_repo_code_host_type_to_enum/migration.sql (1)

1-22: Well-documented migration with proper data verification.

The migration correctly creates the CodeHostType enum and converts the existing column. The detailed comment and commit references demonstrate that existing data has been verified to match the enum values. The use of USING "external_codeHostType"::text::"CodeHostType" will fail fast if any invalid values exist, which is the desired behavior.

packages/db/prisma/schema.prisma (2)

32-45: Well-designed enum with proper backwards compatibility.

The CodeHostType enum definition with @map annotations correctly maintains backwards compatibility with the existing database schema. The documentation about PascalCase behavior in Prisma v7 is helpful for future maintainers.

Also applies to: 71-71


143-153: ConnectionType enum correctly includes 'git' value to fix issue #586.

The ConnectionType enum properly defines the connection types from the v3 config schema. Note that ConnectionType and CodeHostType are distinct enums with different value sets (e.g., ConnectionType has git and bitbucket, while CodeHostType has genericGitHost and separate bitbucketServer/bitbucketCloud values).

Also applies to: 165-165

packages/web/src/app/[domain]/settings/secrets/components/importSecretCard.tsx (1)

7-7: LGTM!

Moving the CodeHostType import to @sourcebot/db centralizes type definitions and is consistent with the broader refactor across the codebase.

packages/web/src/lib/schemas.ts (1)

5-5: Excellent type safety improvement!

Changing from z.string() to z.nativeEnum(CodeHostType) adds runtime validation ensuring that codeHostType values are valid enum members. This prevents invalid values from propagating through the system.

Also applies to: 17-17

packages/web/src/features/fileTree/actions.ts (1)

266-266: LGTM!

The update from 'generic-git-host' to 'genericGitHost' correctly uses the enum value defined in the CodeHostType enum. The logic for handling local repositories remains unchanged.

packages/web/src/app/[domain]/repos/components/repoBranchesTable.tsx (1)

18-25: LGTM! Clean enum migration.

The transition from string to CodeHostType enum improves type safety. The removal of the type cast at line 43 confirms the prop is now correctly typed.

Also applies to: 43-43

packages/web/src/app/[domain]/repos/[id]/page.tsx (1)

68-68: LGTM! Appropriate simplification.

Removing the redundant codeHostInfo && check is correct since getCodeHostInfoForRepo always returns an object.

packages/backend/src/constants.ts (1)

1-10: LGTM! Type safety improvement.

Adding the CodeHostType[] annotation ensures compile-time validation of the supported code host types.

packages/web/src/features/chat/components/chatThread/referencedFileSourceListItem.tsx (1)

23-23: LGTM! Consistent enum adoption.

The prop type change aligns with the codebase-wide migration to typed enums.

Also applies to: 44-44

packages/web/src/features/search/schemas.ts (1)

2-2: LGTM! Enhanced runtime validation.

Using z.nativeEnum(CodeHostType) provides both compile-time and runtime type safety for code host types in API responses.

Also applies to: 37-37, 157-157

packages/web/src/app/[domain]/components/pathHeader.tsx (2)

19-19: LGTM! Prop type aligned with enum migration.

The codeHostType prop now correctly uses the CodeHostType enum.

Also applies to: 30-30


205-211: LGTM! Simplified rendering logic.

The code host icon link is now unconditionally rendered, simplifying the component logic.

packages/web/src/app/[domain]/settings/connections/[id]/page.tsx (2)

50-87: LGTM! Correctly uses ConnectionType enum values.

The switch statement now correctly handles ConnectionType values ('git', 'bitbucket') instead of CodeHostType values. This fixes the root issue mentioned in the PR objectives where 'git' connections were causing errors.


68-68: Review comment is resolved — config schema already enforces URL presence.

The v3 config schema requires the url field for both gerrit and git connection types, so the code correctly assumes config.url will be present without needing a fallback. The concern about undefined values is unfounded given the schema's enforcement.

packages/db/prisma/migrations/20251031012851_change_connection_type_to_enum/migration.sql (1)

1-14: LGTM. Migration is safe—enum values match schema and all known data values are valid.

The migration correctly uses the USING clause to safely convert existing text values to the enum type. The seven enum values (github, gitlab, gitea, gerrit, bitbucket, azuredevops, git) match the schema definition in packages/schemas/src/v3/connection.type.ts exactly. No migrations between adding the connectionType column and this enum migration modify its values, and only valid enum values (github) are hardcoded in the application code. The configManager.ts derives connectionType directly from the schema type field, further ensuring compatibility.

Verify in your production environment that no existing Connection records have unexpected values before applying this migration.

msukkari
msukkari previously approved these changes Oct 31, 2025
@brendan-kellam brendan-kellam merged commit 581a5a0 into main Oct 31, 2025
9 checks passed
@brendan-kellam brendan-kellam deleted the bkellam/fix_586 branch October 31, 2025 20:08
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.

[bug] Git connections defined using v3 config schema don't load in UI

3 participants