Skip to content

Ignore the default port when matching profile hosts - #7948

Open
ilyakuz-db wants to merge 3 commits into
mainfrom
ilyakuz-db/normalize-default-port-host
Open

ilyakuz-db wants to merge 3 commits into
mainfrom
ilyakuz-db/normalize-default-port-host

Conversation

@ilyakuz-db

@ilyakuz-db ilyakuz-db commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

Changes

Profile host matching in libs/databrickscfg now ignores the scheme's default port, so https://<host> and https://<host>:443 match the same profile.

Why

A bundle with workspace.host: https://<host>:443 and a profile with host = https://<host> fails every command with the host in the profile (https://<host>) doesn’t match the host configured in the bundle (https://<host>:443), although both point to the same workspace. normalizeHost kept the explicit port, so the comparison treated them as different hosts. Host-only profile resolution and strict profile matching use the same helper and get the same fix.

Tests

Added normalizeHost cases and a bundle workspace test with a profile host without the port and a bundle host with :443 (it fails without the fix). Ran the libs/databrickscfg, bundle/config, cmd/root, cmd/configure and cmd/auth unit tests and the auth/bundle_and_profile acceptance test locally.

Status Check Revision Comments
✅ Local review 9ea6754 Codex and auto review, no P0/P1 after 1 round; the auto review's Codex reviewer returned no result. Comment and changelog P2s fixed since
✅ Design review 9ea6754 RIGHT-SIZED: fixes the shared helper every profile host comparison uses
⚠️ E2E validation a42dbc8 not run on a workspace; acceptance tests run locally
➖ Isaac review - n/a
⏳ Code owners review a42dbc8 (latest) waiting for code owners
✅ CI / merge conflicts a42dbc8 (latest) no conflicts; 18 checks pass, 10 skipped

✅ success · ⏳ pending · ⚠️ warning · ❌ failed · ➖ n/a

This pull request and its description were written by Isaac.

ilyakuz-db and others added 2 commits November 24, 2026 20:56
Co-authored-by: Isaac <no-reply@databricks.com>
Co-authored-by: Isaac <no-reply@databricks.com>
@ilyakuz-db
ilyakuz-db requested review from a team as code owners November 24, 2026 21:07
Co-authored-by: Isaac <no-reply@databricks.com>
@ilyakuz-db ilyakuz-db self-assigned this Nov 24, 2026
@github-actions github-actions Bot added the DABs DABs related issues label Nov 24, 2026

@review-oss-bot review-oss-bot Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Automated review at a42dbc8. Each finding was verified against the code.

No blocking issues found. 1 non-blocking comment(s) and 1 question(s) below.

This PR makes normalizeHost in libs/databrickscfg drop the scheme's default port. A bundle host of https://<host>:443 now matches a profile with host = https://<host> in host-only resolution, strict matching, ValidateConfigAndProfileHost and SaveToProfile section matching. The fix is correct for those paths. The one open item is test level: the change is user-visible, so it should be covered in an acceptance test. There is also a question about the separate profile.WithHost matcher, which still keeps the port.

Questions

  1. The description says this fixes the helper every profile host comparison uses. But profile.WithHost, WithHostAndAccountID and WithHostAccountIDAndWorkspaceID (libs/databrickscfg/profile/profiler.go) compare hosts through canonicalizeHost/CanonicalHostName, which keeps the port. So https://h:443 still won't match a profile with https://h on those lookups, and cmd/configure's normalizeHost still writes the port. Should the default-port stripping go into one shared canonicalizer used by both matchers, or into the bundle's NormalizeHostURL? Or is the narrower fix intended? (non-blocking)

assert.NoError(t, err)
})

t.Run("default config file with match on the default port", func(t *testing.T) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

[nice to have] This fix removes a user-visible bundle error, but it is only covered by this Go unit test. .agents/rules/testing.md says user-visible CLI behavior gets acceptance tests first, extending an existing directory. Could acceptance/auth/bundle_and_profile get a case with workspace.host: https://<host>:443 and a profile without the port? Its golden would then show the command succeeding where it used to fail with "the host in the profile ... doesn’t match the host configured in the bundle".

@eng-dev-ecosystem-bot

Copy link
Copy Markdown
Collaborator

✅ Integration test report

Commit: a42dbc8

Run: 45488210360

Env 💚​RECOVERED ✅​pass 🙈​skip Time
💚​ aws linux-2core-8gb 1 272 19 5:09
💚​ aws-windows-latest-4core-16gb 1 274 17 4:25
💚​ azure linux-2core-8gb 1 271 19 4:25
💚​ azure-windows-latest-4core-16gb 1 273 17 3:58
💚​ gcp linux-2core-8gb 1 272 19 5:10
💚​ gcp-windows-latest-4core-16gb 1 274 17 3:55
Test Name aws linux-2core-8gb aws-windows-latest-4core-16gb azure linux-2core-8gb azure-windows-latest-4core-16gb gcp linux-2core-8gb gcp-windows-latest-4core-16gb
💚​ TestAccept 💚​R 💚​R 💚​R 💚​R 💚​R 💚​R
Top 6 slowest tests (at least 2 minutes):
duration env testname
4:22 aws-windows-latest-4core-16gb TestAccept
4:09 aws linux-2core-8gb TestAccept
3:56 azure-windows-latest-4core-16gb TestAccept
3:53 gcp-windows-latest-4core-16gb TestAccept
3:40 gcp linux-2core-8gb TestAccept
3:23 azure linux-2core-8gb TestAccept

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

DABs DABs related issues factory-generated

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants