Improve error for labs projects that do not provide labs.yml#5559
Improve error for labs projects that do not provide labs.yml#5559janniklasrose wants to merge 1 commit into
Conversation
Most repositories in the databrickslabs GitHub org do not ship a labs.yml manifest and thus cannot be installed via the CLI. Installing one of them (e.g. 'databricks labs install brickster') failed with the cryptic 'Error: remote: read labs.yml from GitHub: not found'. Detect the not-found case and explain that the project is not installable with the CLI, pointing at the repository for instructions. Co-authored-by: Isaac
Waiting for approvalBased on git history, these people are best suited to review:
Eligible reviewers: Suggestions based on git history. See OWNERS for ownership rules. |
|
Commit: cb135fc
24 interesting tests: 15 SKIP, 7 KNOWN, 2 flaky
Top 28 slowest tests (at least 2 minutes):
|
simonfaltum
left a comment
There was a problem hiding this comment.
LGTM. Verified the ErrNotFound chain end to end (errors.Is still works through both wraps) and ran the new test at the PR head. A typoed project name fails earlier at the releases call, so this message cannot fire for nonexistent repos.
Two optional notes inline. Also: this changes user-visible output, so consider a one-liner under ### CLI in NEXT_CHANGELOG.md.
| // (e.g. libraries published to package indexes), so a missing file means the | ||
| // project isn't installable through the CLI, not that the download failed. | ||
| if errors.Is(err, github.ErrNotFound) { | ||
| return nil, fmt.Errorf("databrickslabs/%s@%s does not provide labs.yml (%w); "+ |
There was a problem hiding this comment.
This branch also catches a valid project requested at a version that does not exist, e.g. labs install blueprint@v9.9.9 (right after the "Installing unreleased version" warning). For that case the message is wrong: blueprint does provide labs.yml, the ref is just bad. Consider wording that covers both causes, e.g. labs.yml not found for databrickslabs/%s@%s; either this version does not exist or this project cannot be installed with the Databricks CLI, see ...
| return | ||
| } | ||
| t.Logf("Requested: %s", r.URL.Path) | ||
| t.FailNow() |
There was a problem hiding this comment.
Nit, and it matches the existing pattern in installer_test.go, so fine to leave as is: t.FailNow() from the handler goroutine is documented as illegal (it must run on the test goroutine; here it only kills the handler via runtime.Goexit and the client sees a dropped connection). The idiomatic shape is t.Errorf(...) followed by http.Error(w, "unexpected request", http.StatusInternalServerError). Cleaning up all five occurrences in this file would make a nice separate PR.
Changes
databricks labs install <name>only works for repositories in the databrickslabs GitHub org that ship alabs.ymlmanifest at the repository root. Most repositories in the org do not (they are libraries published to CRAN, PyPI, Maven, etc.), and installing one of them fails with:which gives the user no clue what is wrong.
Detect the not-found case when fetching
labs.ymland return an actionable error instead:This also covers projects without any GitHub release, where the version resolves to the literal ref
latestand the fetch 404s the same way.While PR #5560 limits
databricks labs listto those that are installable, users can still provide a lab name not in that list. Thus, this PR is still relevant for graceful error handling.Tests
New unit test simulating a project whose release tag has no
labs.yml(cmd/labs/project/fetcher_test.go). Verified live:databricks labs install bricksterproduces the message above.This pull request and its description were written by Isaac, an AI coding agent.