fix: improve apps deploy error when APP_NAME is missing#5113
Merged
Conversation
2 tasks
The old error "accepts 1 arg(s), received 0" was unclear. The new message explains that APP_NAME is required, shows usage, mentions the databricks.yml alternative, and suggests an app name inferred from the current directory. Co-authored-by: Isaac Signed-off-by: James Broadhead <jamesbroadhead@gmail.com>
Co-authored-by: Isaac Signed-off-by: James Broadhead <jamesbroadhead@gmail.com>
Cover normal cases (app.yml, app.yaml, no config) and edge cases (deleted cwd) to verify graceful degradation. Co-authored-by: Isaac Signed-off-by: James Broadhead <jamesbroadhead@gmail.com>
Co-authored-by: Isaac Signed-off-by: James Broadhead <jamesbroadhead@gmail.com>
- Check os.WriteFile error return values - Use t.Chdir() instead of manual os.Chdir + cleanup - Remove unnecessary testChdir helper Co-authored-by: Isaac Signed-off-by: James Broadhead <jamesbroadhead@gmail.com>
The shared zero-arg validator used by deploy/start/stop/delete printed a hardcoded "databricks apps deploy <hint>" suggestion and a generic "<command>" placeholder in the usage line, so users running `apps stop` without an APP_NAME were nudged toward `apps deploy` instead. - Thread the cobra command into missingAppNameError and render both the Usage line and the "Did you mean?" hint from cmd.CommandPath(). - Extend bundle_helpers_test.go with table-driven coverage that exercises deploy/start/stop/delete and asserts the hint matches the verb. - inferAppNameHint now requires app.yml/app.yaml to be a regular file, so a directory of that name no longer produces a bogus hint. - Regenerate the no-bundle-no-args acceptance fixture for the new message. Co-authored-by: Isaac
Contributor
Author
|
👋 @pietern @fjakobs — Claude here on James's behalf. Rebased onto current Ready for review whenever you've got a moment. (comment posted by Claude) |
c654348 to
6c3d347
Compare
Reuse the shared missing-name validation for logs and render each command's documented positional argument name.
simonfaltum
approved these changes
May 20, 2026
Member
simonfaltum
left a comment
There was a problem hiding this comment.
Reviewed the apps missing-name error changes and pushed a small follow-up to keep logs on the shared validation path and align NAME vs APP_NAME in the error text. Scoped validation passed locally: go test ./cmd/apps/... and ./task checks. No completed CI failures at approval time; a few longer-running jobs are still pending.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
accepts 1 arg(s), received 0error with a clear message explaining thatAPP_NAMEis requireddatabricks.ymlauto-detect alternative, and suggest an app name inferred from the current directory nameTest plan
go test ./cmd/apps/ -run TestMakeArgsOptionalpassesgo build ./cmd/apps/succeedsThis pull request was AI-assisted by Isaac.