Skip to content

Do not write a dotted profile's keys into its parent section - #7266

Queued
maksim-zuev-db wants to merge 4 commits into
mainfrom
databrickscfg-save-own-section-keys
Queued

maksim-zuev-db wants to merge 4 commits into
mainfrom
databrickscfg-save-own-section-keys

Conversation

@maksim-zuev-db

@maksim-zuev-db maksim-zuev-db commented Oct 30, 2026 •

Copy link
Copy Markdown
Member

Changes

SaveToProfile and SaveResourcesToProfile now write keys with section.NewKey instead of section.Key, so they only touch the target section's own keys.

Why

Follow-up to this review comment on #7196.

go-ini treats [team.prod] as a child of [team], and section.Key returns the parent's key when the child doesn't have it. So saving a new team.prod profile wrote the missing keys into [team]: databricks auth login rewrote its host, and databricks configure rewrote its host and token. SaveResourcesToProfile overwrote the parent's resources the same way.

Tests

  • TestSaveToProfile_DottedNameDoesNotWriteParentSection saves to team.prod next to an existing [team] and checks both sections. It fails without the fix.
  • libs/databrickscfg/..., cmd/auth and cmd/configure unit tests pass.

This pull request and its description were written by Isaac.

maksim-zuev-db and others added 2 commits October 30, 2026 15:10
go-ini treats [team.prod] as a child of [team], and Section.Key returns
the parent's key when the child doesn't have it. So saving host to a new
[team.prod] next to an existing [team] rewrote [team]'s host and left
[team.prod] without it. SaveResourcesToProfile had the same problem.
Section.NewKey only looks at the section's own keys.

Co-authored-by: Isaac <no-reply@databricks.com>
Co-authored-by: Isaac <no-reply@databricks.com>
@eng-dev-ecosystem-bot

eng-dev-ecosystem-bot commented Oct 30, 2026 •

Copy link
Copy Markdown
Collaborator

Integration test report

Commit: 11832c8

Run: 41628015045

Env ✅​pass 🙈​skip Time
✅​ aws linux-2core-8gb 281 15 5:26
✅​ aws-windows-latest-4core-16gb 283 13 3:20
✅​ azure linux-2core-8gb 280 15 5:23
✅​ azure-windows-latest-4core-16gb 282 13 3:37
✅​ gcp linux-2core-8gb 281 15 5:27
✅​ gcp-windows-latest-4core-16gb 283 13 3:26
Top 6 slowest tests (at least 2 minutes):
duration env testname
4:10 gcp linux-2core-8gb TestAccept
4:10 aws linux-2core-8gb TestAccept
4:07 azure linux-2core-8gb TestAccept
3:29 azure-windows-latest-4core-16gb TestAccept
3:19 gcp-windows-latest-4core-16gb TestAccept
3:14 aws-windows-latest-4core-16gb TestAccept

Co-authored-by: Isaac <no-reply@databricks.com>
@maksim-zuev-db
maksim-zuev-db marked this pull request as ready for review November 2, 2026 12:08
@maksim-zuev-db
maksim-zuev-db requested review from a team as code owners November 2, 2026 12:09

@simonfaltum simonfaltum left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The section-local writes fix dotted profiles overwriting their parent's keys and preserve existing merge behavior. No blocking issues found.

Validation: go test -count=1 ./libs/databrickscfg/... ./cmd/auth/... ./cmd/configure passed locally; CI is green.

Non-blocking nit in libs/databrickscfg/ops_test.go:218-243: please use https://team.test and https://prod.test throughout the new fixture, per the reserved test-domain rule in AGENTS.md.

Co-authored-by: Isaac <no-reply@databricks.com>
@maksim-zuev-db
maksim-zuev-db added this pull request to the merge queue Nov 3, 2026
Any commits made after this event will not be merged.

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

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants