Skip to content

serving-endpoints: accept NAME as argument or in --json for create and update-config - #7665

Open
anshul0713 wants to merge 2 commits into
mainfrom
anshul0713/serving-endpoints-name-with-json
Open

anshul0713 wants to merge 2 commits into
mainfrom
anshul0713/serving-endpoints-name-with-json

Conversation

@anshul0713

@anshul0713 anshul0713 commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

Changes

  • serving-endpoints create NAME --json ... now works: the argument becomes the endpoint name. If the JSON also has a different "name", the command fails instead of picking one. create --json '{"name": ...}' with no argument works as before.
  • serving-endpoints update-config --json '{"name": "my-endpoint", ...}' now works without the argument: the name is taken from the JSON and removed from the body, since the update body has no name field. update-config NAME --json ... works as before.
  • Both commands' --help now say that with --json, NAME can be the argument or "name" in the JSON.

Why

The two commands had opposite rules, and each one's error only came after a failed call:

  • create says create NAME in its usage, but rejects the argument when --json is set: when --json flag is specified, no positional arguments are allowed. Provide 'name' in your JSON input.
  • update-config requires the argument and warns unknown field: name when the name is in the body.

In agent trials of serving-endpoint journeys, 3 of the 6 trials that created an endpoint hit this: agents applied one command's rule to the other and needed a failed call for each.

This PR fixes it for these two commands with an override. The same pattern exists in other generated commands, so the generator could make this behavior general later.

Backward compatibility

  • Every invocation that worked before sends the same request and prints the same output.
  • The new behavior only covers invocations that used to fail: create NAME --json and update-config --json with no NAME.
  • update-config --json with no name at all fails with the same accepts 1 arg(s), received 0 error as before, and without --json NAME is still required for both commands.

Notes

These overrides wrap the generated RunE. #7659 (wait progress) replaces RunE for the same two commands, so this file is named to sort after overrides.go: overrides run in file init() order. The file has a comment saying so.

Tests

  • Unit tests for reading and removing "name" from --json, including that large numbers survive and invalid or missing names leave the body unchanged.
  • New acceptance test acceptance/cmd/workspace/serving-endpoints/name-with-json covering each combination, including the recorded request bodies (no name in the update body).
  • Existing serving-endpoint bundle acceptance tests pass unchanged.
  • Checked against a staging workspace: create NAME --no-wait --json ... and update-config --no-wait --json '{"name": ...}' both reached the API with the right endpoint.
  • ./task lint passes.

This pull request and its description were written by Isaac.

…d update-config

`create NAME` rejected NAME as an argument when --json was set ("no
positional arguments are allowed"), while `update-config` required the
argument and warned that "name" in --json is an unknown field. Users and
agents applied one command's rule to the other and got an error either
way. Both commands now take the name in either place. If create gets two
different names it fails rather than picking one; if update-config gets
no name at all it fails with the same error as before.

Co-authored-by: Isaac <no-reply@databricks.com>
Signed-off-by: Anshul Gupta <anshul.gupta@databricks.com>
@anshul0713
anshul0713 requested a review from a team as a code owner November 16, 2026 07:29
@anshul0713
anshul0713 requested a review from pietern November 16, 2026 07:29
Co-authored-by: Isaac <no-reply@databricks.com>
Signed-off-by: Anshul Gupta <anshul.gupta@databricks.com>
@github-actions

Copy link
Copy Markdown
Contributor

Commit: a9aec827d | Workflow run

Regression test report

Selected 1 changed tests (limit=20, 0 not selected)

1 tests: regression=1 unreleased=0 coverage=0 failing=0
test branch main (620ea05) latest (v1.26.0)
TestAccept/cmd/workspace/serving-endpoints/name-with-json ✅ ❌ ❌
TestAccept/cmd/workspace/serving-endpoints/name-with-json: branch ✅ | main (620ea05) ❌ | latest (v1.26.0) ❌

main (620ea05):

acceptance_test.go:1374: Diff:
        --- cmd/workspace/serving-endpoints/name-with-json/output.txt
        +++ /tmp/TestAcceptcmdworkspaceserving-endpointsname-with-json1853506310/002/output.txt
        @@ -2,143 +2,6 @@
         === create: NAME as the argument together with --json
         
         >>> [CLI] serving-endpoints create my-endpoint --no-wait --json {"description": "from arg"}
        -{"name":"my-endpoint","description":"from arg"}
        +Error: when --json flag is specified, no positional arguments are allowed. Provide 'name' in your JSON input
         
        -=== create: NAME inside --json still works
        -
        ->>> [CLI] serving-endpoints create --no-wait --json {"name": "other-endpoint"}
        -{"name":"other-endpoint"}
        -
        -=== create: the same name in both places is fine
        -
        ->>> [CLI] serving-endpoints create third-endpoint --no-wait --json {"name": "third-endpoint"}
        -{"name":"third-endpoint"}
        -
        -=== create: different names are rejected
        -
        ->>> musterr [CLI] serving-endpoints create my-endpoint --json {"name": "something-else"}
        -Error: the endpoint name "my-endpoint" doesn't match "name" "something-else" in --json; pass it in one place only
        -
        -=== update-config: NAME from --json when the argument is omitted
        -
        ->>> [CLI] serving-endpoints update-config --no-wait --json {"name": "my-endpoint", "served_entities": [{"entity_name": "main.default.m", "entity_version": "1", "workload_size": "Small"}]}
        -{"name":"my-endpoint"}
        -
        -=== update-config: the argument still works
        -
        ->>> [CLI] serving-endpoints update-config my-endpoint --no-wait --json {"served_entities": [{"entity_name": "main.default.m", "entity_version": "2", "workload_size": "Small"}]}
        -{"name":"my-endpoint"}
        -
        -=== update-config: no name anywhere
        -
        ->>> musterr [CLI] serving-endpoints update-config --json {"served_entities": []}
        -Error: accepts 1 arg(s), received 0
        -
        -Usage:
        -  databricks serving-endpoints update-config NAME [flags]
        -
        -Flags:
        -  -h, --help               help for update-config
        -      --json JSON          either inline JSON string or @path/to/file.json with request body (default JSON (0 bytes))
        -      --no-wait            do not wait to reach NOT_UPDATING state
        -      --timeout duration   maximum amount of time to reach NOT_UPDATING state (default 20m0s)
        -
        -Global Flags:
        -      --debug            enable debug logging
        -  -o, --output type      output type: text or json (default text)
        -  -p, --profile string   ~/.databrickscfg profile
        -  -t, --target string    bundle target to use (if applicable)
        -
        -
        -=== Without --json, NAME is still required
        -
        ->>> musterr [CLI] serving-endpoints create
        -Error: accepts 1 arg(s), received 0
        -
        -Usage:
        -  databricks serving-endpoints create NAME [flags]
        -
        -Flags:
        -      --budget-policy-id string   The budget policy to be applied to the serving endpoint.
        -      --description string        The description of the serving endpoint.
        -  -h, --help                      help for create
        -      --json JSON                 either inline JSON string or @path/to/file.json with request body (default JSON (0 bytes))
        -      --no-wait                   do not wait to reach NOT_UPDATING state
        -      --route-optimized           Enable route optimization for the serving endpoint.
        -      --timeout duration          maximum amount of time to reach NOT_UPDATING state (default 20m0s)
        -
        -Global Flags:
        -      --debug            enable debug logging
        -  -o, --output type      output type: text or json (default text)
        -  -p, --profile string   ~/.databrickscfg profile
        -  -t, --target string    bundle target to use (if applicable)
        -
        -
        ->>> musterr [CLI] serving-endpoints update-config
        -Error: accepts 1 arg(s), received 0
        -
        -Usage:
        -  databricks serving-endpoints update-config NAME [flags]
        -
        -Flags:
        -  -h, --help               help for update-config
        -      --json JSON          either inline JSON string or @path/to/file.json with request body (default JSON (0 bytes))
        -      --no-wait            do not wait to reach NOT_UPDATING state
        -      --timeout duration   maximum amount of time to reach NOT_UPDATING state (default 20m0s)
        -
        -Global Flags:
        -      --debug            enable debug logging
        -  -o, --output type      output type: text or json (default text)
        -  -p, --profile string   ~/.databrickscfg profile
        -  -t, --target string    bundle target to use (if applicable)
        -
        -
        ->>> print_requests.py //serving-endpoints
        -{
        -  "method": "POST",
        -  "path": "/api/2.0/serving-endpoints",
        -  "body": {
        -    "description": "from arg",
        -    "name": "my-endpoint"
        -  }
        -}
        -{
        -  "method": "POST",
        -  "path": "/api/2.0/serving-endpoints",
        -  "body": {
        -    "name": "other-endpoint"
        -  }
        -}
        -{
        -  "method": "POST",
        -  "path": "/api/2.0/serving-endpoints",
        -  "body": {
        -    "name": "third-endpoint"
        -  }
        -}
        -{
        -  "method": "PUT",
        -  "path": "/api/2.0/serving-endpoints/my-endpoint/config",
        -  "body": {
        -    "served_entities": [
        -      {
        -        "entity_name": "main.default.m",
        -        "entity_version": "1",
        -        "workload_size": "Small"
        -      }
        -    ]
        -  }
        -}
        -{
        -  "method": "PUT",
        -  "path": "/api/2.0/serving-endpoints/my-endpoint/config",
        -  "body": {
        -    "served_entities": [
        -      {
        -        "entity_name": "main.default.m",
        -        "entity_version": "2",
        -        "workload_size": "Small"
        -      }
        -    ]
        -  }
        -}
        +Exit code: 1
        
FAIL

latest (v1.26.0): same output as main (620ea05)

@eng-dev-ecosystem-bot

Copy link
Copy Markdown
Collaborator

✅ Integration test report

Commit: 24a74c2

Run: 43824491798

Env 💚​RECOVERED ✅​pass 🙈​skip Time
💚​ aws linux-2core-8gb 1 270 16 3:34
💚​ aws-windows-latest-4core-16gb 1 272 14 3:31
💚​ azure linux-2core-8gb 1 269 16 3:28
💚​ azure-windows-latest-4core-16gb 1 271 14 3:31
💚​ gcp linux-2core-8gb 1 270 16 3:55
💚​ gcp-windows-latest-4core-16gb 1 272 14 3:29
Test Name aws linux-2core-8gb aws-windows-latest-4core-16gb azure linux-2core-8gb azure-windows-latest-4core-16gb gcp linux-2core-8gb gcp-windows-latest-4core-16gb
💚​ TestAccept 💚​R 💚​R 💚​R 💚​R 💚​R 💚​R
Top 3 slowest tests (at least 2 minutes):
duration env testname
3:27 azure-windows-latest-4core-16gb TestAccept
3:26 aws-windows-latest-4core-16gb TestAccept
3:25 gcp-windows-latest-4core-16gb TestAccept

This branch has not been deployed

No deployments
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