Skip to content

Fix repos get/update/delete for Git-CLI-enabled folders - #6122

Open
GrantIsEaton wants to merge 3 commits into
databricks:mainfrom
GrantIsEaton:fix-repos-git-cli-folders
Open

Fix repos get/update/delete for Git-CLI-enabled folders#6122
GrantIsEaton wants to merge 3 commits into
databricks:mainfrom
GrantIsEaton:fix-repos-git-cli-folders

Conversation

@GrantIsEaton

Copy link
Copy Markdown

Changes

databricks repos get/update/delete <path> resolves the path argument to a repo ID via the workspace get-status API in repoArgumentToRepoID, then required the returned ObjectType to be exactly REPO. This drops that client-side object-type gate and uses the resolved object ID directly.

Why

Since the Git CLI rollout, Git-CLI-enabled folders are materialized as plain DIRECTORY nodes rather than REPO nodes. As a result get-status now returns ObjectType: DIRECTORY for them, and the strict != REPO check rejected valid repos with:

Error: object at path "/Workspace/Users/.../Testrepo" is not a repo

even though the underlying get repo / update repo / delete repo REST APIs still resolve those object IDs fine. The repos API is the authority on whether the target is a repo, so gating on the object type client-side is both redundant and now incorrect for Git CLI folders.

This was reported by a customer whose repos update/get broke on 2026-07-27 after the Git CLI rollout, and confirmed by the repos API owner ("remove the REPO type enforcement... whether it's a repo is enforced at the API layer anyways").

Tests

  • Updated acceptance/workspace/repos/get_errors to reflect that a non-repo path is no longer rejected client-side; the repos API returns not-found instead.
  • The testserver get-status fake now reports repos as DIRECTORY nodes (mirroring the post-rollout backend), so the existing path-based repos acceptance tests (delete_by_path, update) exercise the fix. Confirmed these fail with the old object-type gate restored and pass with it removed.

This pull request and its description were written by Isaac.

repoArgumentToRepoID resolved a path via workspace get-status and then
required ObjectType == REPO. Since the Git CLI rollout, Git-CLI-enabled
folders are materialized as plain DIRECTORY nodes, so get-status returns
DIRECTORY and the gate rejected them with `object at path "..." is not a
repo` even though the repos API still resolves their object ID as a repo.

Drop the client-side object-type gate and let the repos API be the
authority, per the repos API owner's guidance. The testserver now reports
repos as DIRECTORY nodes so the path-based repos tests guard the fix.

Co-authored-by: Isaac
@github-actions

Copy link
Copy Markdown
Contributor

Waiting for approval

Based on git history, these people are best suited to review:

  • @pietern -- recent work in libs/testserver/, cmd/workspace/repos/, .nextchanges/cli/
  • @radakam -- recent work in libs/testserver/, acceptance/workspace/repos/get_errors/
  • @janniklasrose -- recent work in libs/testserver/, .nextchanges/cli/, acceptance/workspace/repos/get_errors/

Eligible reviewers: @andrewnester, @anton-107, @denik, @lennartkats-db, @renaudhartert-db, @shreyas-goenka, @simonfaltum

Suggestions based on git history. See OWNERS for ownership rules.

Comment thread libs/testserver/fake_workspace.go Outdated
Comment on lines +421 to +425
info = workspace.ObjectInfo{ObjectType: "REPO", Path: cleaned, ObjectId: repoId}
// Git-CLI-enabled repos are materialized as plain DIRECTORY nodes, not
// REPO nodes, so get-status reports DIRECTORY for them while the repos
// API still resolves the object ID as a repo. This mirrors the backend
// behavior that repoArgumentToRepoID must tolerate.
info = workspace.ObjectInfo{ObjectType: "DIRECTORY", Path: cleaned, ObjectId: repoId}

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

yes but control plane git folders still use the Repo object type so i think we should be able to test both behaviors and not just one

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Good call — updated get-status so control-plane repos under /Repos still report REPO and only Git-CLI folders elsewhere report DIRECTORY. Added acceptance test git_cli_folder to cover the DIRECTORY path while the existing /Repos tests keep exercising REPO. (b6988cc)

Comment thread cmd/workspace/repos/overrides.go Outdated
Comment on lines +169 to +175
// If the argument cannot be parsed as a repo ID, look it up by path.
//
// We deliberately don't check oi.ObjectType here. Git-CLI-enabled folders
// are materialized as plain DIRECTORY nodes rather than REPO nodes, but the
// repos API still accepts their object ID as a repo ID. The repos API is the
// authority on whether the target is a repo, so gating on the object type
// here would reject valid Git CLI folders.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

I dont think we need to state all of this what is it helping?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Trimmed it down to three lines. (b6988cc)

@@ -0,0 +1 @@
Fixed `databricks repos get/update/delete` failing with `object at path "..." is not a repo` for Git-CLI-enabled folders, which the workspace API now reports as directories rather than repos.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

we should make note that the git cli enabled folders are a preview that can be enabled / disabled and alternatively the user can mitigate by turning off the feature

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Added a note that Git CLI is a preview and can be turned off in the workspace admin previews settings as an alternative mitigation. (b6988cc)

- testserver get-status now reports control-plane repos (under /Repos) as
  REPO and Git-CLI folders elsewhere as DIRECTORY, so both behaviors are
  covered rather than forcing every repo to DIRECTORY.
- Add acceptance test git_cli_folder covering path-based get/update/delete
  against a DIRECTORY-typed Git CLI folder; the /Repos tests keep exercising
  the REPO type.
- Trim the explanatory comment in repoArgumentToRepoID.
- Note in the changelog that Git CLI is a toggleable preview and can be
  turned off as a mitigation.

Co-authored-by: Isaac
The case existed to exercise the client-side `!= REPO` gate. With that gate
gone, it only tested that an arbitrary directory id isn't a registered repo,
which is not a behavior this change is about. The positive REPO and DIRECTORY
path-resolution tests cover the fix.

Co-authored-by: Isaac
@github-actions

Copy link
Copy Markdown
Contributor

An authorized user can trigger integration tests manually by following the instructions below:

Trigger:
go/deco-tests-run/cli

Inputs:

  • PR number: 6122
  • Commit SHA: cfb1677f3be8cc70dc6ccae646233a5c3431f81b

Checks will be approved automatically on success.

Comment on lines +1 to +4
{
"method": "GET",
"path": "/.well-known/databricks-config"
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Do we need this request?

Comment on lines +421 to +427
// Control-plane repos (under /Repos) report the REPO object type, while
// Git-CLI-enabled folders elsewhere are materialized as plain DIRECTORY
// nodes. Both resolve to a valid repo ID via the repos API.
objectType := workspace.ObjectTypeRepo
if !strings.HasPrefix(cleaned, "/Repos/") {
objectType = workspace.ObjectTypeDirectory
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

This is a weird fake.

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.

2 participants