Skip to content

fix(gh-copilot): trim enterprise/organization slugs to fix connection validation failure - #9071

Open
bujjibabukatta wants to merge 1 commit into
apache:mainfrom
bujjibabukatta:fix/#8991
Open

fix(gh-copilot): trim enterprise/organization slugs to fix connection validation failure#9071
bujjibabukatta wants to merge 1 commit into
apache:mainfrom
bujjibabukatta:fix/#8991

Conversation

@bujjibabukatta

Copy link
Copy Markdown
Contributor

Summary

Fixes #8991 — GitHub Copilot connector's "Test Connection" fails with
either enterprise or organization is required even when a valid Enterprise
Slug is filled in and Organization is left blank.

Root Cause

validateConnection() checked Organization for emptiness without trimming
it, while HasEnterprise() already trimmed Enterprise. This mismatch meant
a slug with incidental whitespace (e.g. copy/pasted from GitHub) could be
treated as "present" in one check and "empty" in another. A second, separate
copy of this same check in connection_test_helper.go also had a different
error message, showing the two had drifted out of sync.
The frontend's IConnectionAPI/IConnection types were also missing the
enterprise field, and the test/testOld API payload types didn't
include it either — a type-safety gap worth closing alongside this fix.

Fix

  • models/connection.go — trim Organization/Enterprise in Normalize()
  • api/connection.go — trim Organization in validateConnection()
  • service/connection_test_helper.go — align error message with the above
  • api/connection_test.go — added regression tests going through the real
    JSON decode path (hyphenated slug, whitespace-only org)
  • config-ui/src/types/connection.ts — added missing enterprise field
  • config-ui/src/api/connection/index.ts — added enterprise to payload types

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][GitHub Copilot] GitHub Copilot connector validation fails when using Enterprise Slug without Organization

1 participant