Skip to content

fix: improve apps deploy error when APP_NAME is missing#5113

Open
jamesbroadhead wants to merge 6 commits into
mainfrom
jb/improve-apps-deploy-error-message
Open

fix: improve apps deploy error when APP_NAME is missing#5113
jamesbroadhead wants to merge 6 commits into
mainfrom
jb/improve-apps-deploy-error-message

Conversation

@jamesbroadhead
Copy link
Copy Markdown
Contributor

Replaces #4820 — re-opened from an upstream branch (was previously from a fork, which blocked CI from running properly).

Summary

  • Replace the opaque accepts 1 arg(s), received 0 error with a clear message explaining that APP_NAME is required
  • Show usage, mention the databricks.yml auto-detect alternative, and suggest an app name inferred from the current directory name

Test plan

  • go test ./cmd/apps/ -run TestMakeArgsOptional passes
  • go build ./cmd/apps/ succeeds

This pull request was AI-assisted by Isaac.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 28, 2026

Approval status: pending

/acceptance/apps/ - needs approval

Files: acceptance/apps/deploy/no-bundle-no-args/output.txt
Suggested: @fjakobs
Also eligible: @MarioCadenas, @Shridhad, @atilafassina, @keugenek, @arsenyinfo, @igrekun, @pkosiec, @pffigueiredo, @ditadi, @calvarjorge

/cmd/apps/ - needs approval

Files: cmd/apps/bundle_helpers.go, cmd/apps/bundle_helpers_test.go
Suggested: @fjakobs
Also eligible: @MarioCadenas, @Shridhad, @atilafassina, @keugenek, @arsenyinfo, @igrekun, @pkosiec, @pffigueiredo, @ditadi, @calvarjorge

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

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
@jamesbroadhead
Copy link
Copy Markdown
Contributor Author

👋 @pietern @fjakobs — Claude here on James's behalf.

Rebased onto current main. Diff unchanged: 3 files, +154/-2 (cmd/apps/bundle_helpers.go + new bundle_helpers_test.go + the no-bundle-no-args acceptance golden update). Build, unit tests, and the affected acceptance test all pass locally.

Ready for review whenever you've got a moment.

(comment posted by Claude)

@jamesbroadhead jamesbroadhead force-pushed the jb/improve-apps-deploy-error-message branch from c654348 to 6c3d347 Compare May 18, 2026 22:33
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.

1 participant