Skip to content

Sync registered model aliases via SetAlias/DeleteAlias in direct mode#4637

Open
varundeepsaini wants to merge 1 commit intodatabricks:mainfrom
varundeepsaini:fix-registered-model-aliases-direct
Open

Sync registered model aliases via SetAlias/DeleteAlias in direct mode#4637
varundeepsaini wants to merge 1 commit intodatabricks:mainfrom
varundeepsaini:fix-registered-model-aliases-direct

Conversation

@varundeepsaini
Copy link
Contributor

Fixes #4012

Summary

  • The Update API ignores the aliases field on registered models, so aliases defined in bundle config were silently not applied in direct deployment mode.
  • Sync aliases after create/update using explicit SetAlias/DeleteAlias API calls.
  • Enable IncludeAliases on read so drift detection picks up alias changes.

Test plan

  • Unit tests for create with aliases, update add/modify/delete aliases, remove all aliases, and no-op when unchanged
  • Existing TestAll/registered_models CRUD test passes


// The Create API does not apply aliases, so we sync them separately.
if err := r.syncAliases(ctx, response.FullName, config.Aliases, nil); err != nil {
return "", nil, fmt.Errorf("failed to sync aliases: %w", err)
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we need to wrap the error? Our errors already printed with context such as API endpoint.

remote, err := r.DoRead(ctx, id)
require.NoError(t, err)

assert.Len(t, remote.Aliases, 2)
Copy link
Contributor

Choose a reason for hiding this comment

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

Can these be rewritten as acceptance test? You can capture requests there, run them against cloud, and also read remote state with databricks CLI.


func (r *ResourceRegisteredModel) DoUpdate(ctx context.Context, id string, config *catalog.CreateRegisteredModelRequest, _ Changes) (*catalog.RegisteredModelInfo, error) {
// Fetch current remote state to determine which aliases to add/remove.
remote, err := r.client.RegisteredModels.Get(ctx, catalog.GetRegisteredModelRequest{
Copy link
Contributor

@denik denik Mar 3, 2026

Choose a reason for hiding this comment

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

As a general guideline, DoUpdate should not read remote state. We already have it in the framework and we can pass it if it's needed. However, in this case we can probably get by reading passed Changes?

@varundeepsaini varundeepsaini force-pushed the fix-registered-model-aliases-direct branch from 034aac0 to cf22e16 Compare March 3, 2026 12:57
@varundeepsaini varundeepsaini force-pushed the fix-registered-model-aliases-direct branch from cf22e16 to 86d4e85 Compare March 3, 2026 12:58
@varundeepsaini varundeepsaini requested a review from denik March 3, 2026 12:58
Signed-off-by: Varun Deep Saini <varun.23bcs10048@ms.sst.scaler.com>
@varundeepsaini varundeepsaini force-pushed the fix-registered-model-aliases-direct branch from 86d4e85 to 1300e29 Compare March 3, 2026 16:52
@github-actions
Copy link

github-actions bot commented Mar 3, 2026

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

Trigger:
go/deco-tests-run/cli

Inputs:

  • PR number: 4637
  • Commit SHA: 1300e294351cf448a4b2a728021e4e4d6e41d1f8

Checks will be approved automatically on success.

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.

registered_model aliases in bundle config not applied to Unity Catalog despite successful deploy

2 participants