Skip to content

Fix missing git info for bundles deployed from the new type of in-workspace Git folder - #5709

Open
ilyakuz-db wants to merge 1 commit into
mainfrom
fix-git-info-new-git-folders
Open

Fix missing git info for bundles deployed from the new type of in-workspace Git folder#5709
ilyakuz-db wants to merge 1 commit into
mainfrom
fix-git-info-new-git-folders

Conversation

@ilyakuz-db

@ilyakuz-db ilyakuz-db commented Jun 24, 2026

Copy link
Copy Markdown
Contributor

Changes

The new type of in-workspace Git folder returns only id and path from get-status?return_git_info=true (no url/branch/commit), so bundles deployed from one recorded empty git provenance. Classic Repos and existing workspace Git folders return full git info inline and were not affected.

These folders do expose a real, readable .git on the /Workspace FUSE mount, so FetchRepositoryInfo now reads provenance from disk when a .git is reachable, and takes the existing get-status path otherwise. No new API call is added.

Why

The .git check is a stat walk-up — the same one the on-disk reader already does — so guarding with it is free: a fraction of a millisecond, against ~80ms for get-status. Reading the folder's own .git needs no extra permissions, and the local check is cheaper than any API-based recovery of the same fields.

Verified on Azure dogfood serverless against a real git-in-dataplane folder: provenance is recorded correctly (origin URL, branch, and commit all present, matching the folder's actual git state), and bundle validate in that folder drops from ~3.2s to ~0.45s.

Note that on-disk .git reflects the checkout rather than server-side state. For recording what was actually deployed, that is arguably the more accurate source.

Tests

libs/git/info_test.go: .git present on a DBR path means get-status is not called and provenance comes from disk, including walking up from a subdirectory; a /Workspace path with no .git still uses the API, covering inline git info, a remoteless folder with no origin URL, and a plain directory with no git info at all (empty provenance, no error); plus hasDotGit itself.

acceptance/bundle/git-info: covers bundle.git end to end. The bundle root carries a hand-built .git, which is readable both locally and on the FUSE mount of a DBR session, so the test runs with one expected output in both environments (Local, Cloud, RunsOnDbr). It asserts full provenance from disk, then removes .git and asserts provenance degrades to empty without failing.

This PR was written by Claude Code.

@github-actions

github-actions Bot commented Jun 24, 2026

Copy link
Copy Markdown
Contributor

Approval status: pending

/acceptance/bundle/ - needs approval

5 files changed
Suggested: @pietern
Also eligible: @shreyas-goenka, @denik, @andrewnester, @anton-107, @janniklasrose, @lennartkats-db

/libs/git/ - needs approval

Files: libs/git/info.go, libs/git/info_test.go
Suggested: @Divyansh-db
Also eligible: @simonfaltum, @renaudhartert-db, @hectorcast-db, @parthban-db, @tanmay-db, @tejaskochar-db, @mihaimitrea-db, @chrisst, @rauchy

Any maintainer (@andrewnester, @anton-107, @denik, @pietern, @shreyas-goenka, @simonfaltum, @renaudhartert-db, @janniklasrose, @lennartkats-db) can approve all areas.
See OWNERS for ownership rules.

@eng-dev-ecosystem-bot

eng-dev-ecosystem-bot commented Jun 24, 2026

Copy link
Copy Markdown
Collaborator

Integration test report

Commit: 0ff1054

Run: 30658982026

Env 🟨​KNOWN 💚​RECOVERED 🙈​SKIP ✅​pass 🙈​skip Time
🟨​ aws linux 3 1 4 316 1067 6:38
🟨​ aws windows 3 1 4 318 1065 6:12
🟨​ azure linux 3 1 4 316 1066 7:33
🟨​ azure windows 3 1 4 318 1064 7:58
💚​ gcp linux 1 5 316 1067 4:40
💚​ gcp windows 1 5 318 1065 6:26
8 interesting tests: 4 SKIP, 3 KNOWN, 1 RECOVERED
Test Name aws linux aws windows azure linux azure windows gcp linux gcp windows
💚​ TestAccept 💚​R 💚​R 💚​R 💚​R 💚​R 💚​R
🙈​ TestAccept/bundle/invariant/no_drift 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S
🙈​ TestAccept/bundle/resources/vector_search_endpoints/drift/recreated_same_name 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S
🙈​ TestAccept/bundle/resources/vector_search_indexes/recreate/embedding_dimension 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S
🙈​ TestAccept/ssh/connection 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S
🟨​ TestFetchRepositoryInfoAPI_FromRepo 🟨​K 🟨​K 🟨​K 🟨​K 🙈​S 🙈​S
🟨​ TestFetchRepositoryInfoAPI_FromRepo/root 🟨​K 🟨​K 🟨​K 🟨​K
🟨​ TestFetchRepositoryInfoAPI_FromRepo/subdir 🟨​K 🟨​K 🟨​K 🟨​K
Top 3 slowest tests (at least 2 minutes):
duration env testname
5:18 gcp windows TestAccept
4:49 azure windows TestAccept
3:07 aws windows TestAccept

Comment thread libs/git/info.go Outdated
result.CurrentBranch = gi.Branch
result.WorktreeRoot = fixedPath
} else {
if gi == nil {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

what happens in the new Git folders case? Does the CLI successfully read GitInfo from the local .git? Can we add some acceptance test coverage for all three cases (new git, classic repo, and vanilla). You can mock the API endpoints.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

On DBR this code never read locally, see this guard

if strings.HasPrefix(path, "/Workspace/") && dbr.RunsOnRuntime(ctx) {

That also make it harder to test with acceptance tests as we can't properly mock the environment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I added some unit tests

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

With new git folders API returns only gitInfo.ID

See example

🔴 workspace/get-status doesn't return git provenance for git-in-data-plane folders

  Same repo (github.com/databricks/bundle-examples), same path, two workspaces — different
  result.

  ① AWS staging — git-in-DP folder (object_type: DIRECTORY)

  Request:
  GET /api/2.0/workspace/get-status
        ?path=/Workspace/Users/<user_name>/bundle-examples
        &return_git_info=true
  Response:
  {
    "object_type": "DIRECTORY",
    "git_info": {
      "id":   2884540697170475,
      "path": "/Users/<user_name>/bundle-examples"
    }
  }
  ❌ missing branch, head_commit_id, url, provider

  …yet the data does exist — same id, Repos API:
  GET /api/2.0/repos/2884540697170475
  {
    "branch":         "main",
    "head_commit_id": "d53214e177cd372afa03bfc044be9bb94103ba9a",
    "url":            "https://github.com/databricks/bundle-examples.git",
    "provider":       "gitHub"
  }
  ✅ full provenance

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

There must be a way to read the commit ID? From the .git folders directly maybe as we do locally?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This can be a followup to this PR - but capturing Git metadata from Git folders is an important usecase? Since DABs in the workspace is supported there?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This can be a followup to this PR - but capturing Git metadata from Git folders is an important usecase? Since DABs in the workspace is supported there?

It's important — and this PR already covers it, so it doesn't need to be a followup. To clarify the scope:

  • This only affects bundles deployed from the workspace. Local and CI/CD deploys are unaffected — they read .git directly
  • We already supported two object types: classic Repos and Git folders. Both return the full git_info inline from Workspace get-status API, so they work correctly today
  • The gap is a new Private Preview feature, Git in Dataplane. Objects created with that flag don't return a full git_info from get-status — only git_info.id (the repo id) — and there's no .git directory to read on the Dataplane either
  • This PR handles that case: it takes the id and calls the Repos API (GET /api/2.0/repos/{id}) to recover branch/commit/url. So Git metadata ends up captured for all of them

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I'll check if it's possible to add acceptance test using RunOnDbr

@ilyakuz-db
ilyakuz-db temporarily deployed to test-trigger-is July 2, 2026 10:46 — with GitHub Actions Inactive
@ilyakuz-db
ilyakuz-db temporarily deployed to test-trigger-is July 2, 2026 10:46 — with GitHub Actions Inactive
@ilyakuz-db ilyakuz-db changed the title Fix missing git info for bundles deployed from in-workspace Git folders Fix missing git info for bundles deployed from the new type of in-workspace Git folder Jul 2, 2026
@ilyakuz-db
ilyakuz-db force-pushed the fix-git-info-new-git-folders branch 2 times, most recently from 1768cae to f10136d Compare July 31, 2026 19:10
The new type of in-workspace Git folder returns only id+path from
get-status, so bundles deployed from one recorded empty git provenance.
These folders expose a readable .git on the /Workspace FUSE mount, so
FetchRepositoryInfo now reads provenance from disk when a .git is
reachable and falls back to the existing get-status path otherwise,
which still covers classic Repos and older Git folders.

Co-authored-by: Isaac
@ilyakuz-db
ilyakuz-db force-pushed the fix-git-info-new-git-folders branch from f10136d to 0ff1054 Compare July 31, 2026 19:23
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