Repository navigation
Ignore the default port when matching profile hosts - #7948
ilyakuz-db wants to merge 3 commits into
Conversation
Co-authored-by: Isaac <no-reply@databricks.com>
Co-authored-by: Isaac <no-reply@databricks.com>
Co-authored-by: Isaac <no-reply@databricks.com>
There was a problem hiding this comment.
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
- The description says this fixes the helper every profile host comparison uses. But
profile.WithHost,WithHostAndAccountIDandWithHostAccountIDAndWorkspaceID(libs/databrickscfg/profile/profiler.go) compare hosts throughcanonicalizeHost/CanonicalHostName, which keeps the port. Sohttps://h:443still won't match a profile withhttps://hon those lookups, andcmd/configure'snormalizeHoststill writes the port. Should the default-port stripping go into one shared canonicalizer used by both matchers, or into the bundle'sNormalizeHostURL? 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) { |
There was a problem hiding this comment.
[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".
✅ Integration test reportCommit: a42dbc8
Top 6 slowest tests (at least 2 minutes):
|
Changes
Profile host matching in
libs/databrickscfgnow ignores the scheme's default port, sohttps://<host>andhttps://<host>:443match the same profile.Why
A bundle with
workspace.host: https://<host>:443and a profile withhost = https://<host>fails every command withthe 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.normalizeHostkept 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
normalizeHostcases and a bundle workspace test with a profile host without the port and a bundle host with:443(it fails without the fix). Ran thelibs/databrickscfg,bundle/config,cmd/root,cmd/configureandcmd/authunit tests and theauth/bundle_and_profileacceptance test locally.9ea67549ea6754RIGHT-SIZED: fixes the shared helper every profile host comparison usesa42dbc8a42dbc8(latest)a42dbc8(latest)✅ success · ⏳ pending ·⚠️ warning · ❌ failed · ➖ n/a
This pull request and its description were written by Isaac.