Skip to content

feat(item): enhance update item to handle ItemDisplayNameNotAvailableYet when display name is reserved for 5 min #501

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

badeamarjieh
Copy link
Member

@badeamarjieh badeamarjieh commented Jun 14, 2025

📥 Pull Request

❓ What are you trying to address

  • Upon Create or Update Item, item display name could be reserved for up to 5 minutes. In this case, the http call returns with error code ItemDisplayNameNotAvailableYet
  • This PR handles the above case by applying a retry update mechanism.

Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR enhances the update item functionality by introducing a retry mechanism to handle cases where an item's display name is reserved (returning the "ItemDisplayNameNotAvailableYet" error). Key changes include replacing direct calls to UpdateItem with RetryUpdateItem across several resource files and adding new retry functions and configurations in helpers.go.

Reviewed Changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
internal/pkg/fabricitem/resource_item_properties.go Replaces direct UpdateItem call with RetryUpdateItem
internal/pkg/fabricitem/resource_item_definition_properties.go Replaces direct UpdateItem call with RetryUpdateItem
internal/pkg/fabricitem/resource_item_definition.go Replaces direct UpdateItem call with RetryUpdateItem
internal/pkg/fabricitem/resource_item_config_properties.go Replaces direct UpdateItem call with RetryUpdateItem
internal/pkg/fabricitem/resource_item_config_definition_properties.go Replaces direct UpdateItem call with RetryUpdateItem
internal/pkg/fabricitem/resource_item.go Replaces direct UpdateItem call with RetryUpdateItem
internal/pkg/fabricitem/helpers.go Adds retry logic functions and configuration for handling update errors

Copy link
Member Author

@badeamarjieh badeamarjieh left a comment

Choose a reason for hiding this comment

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

add tests

Copy link

github-actions bot commented Jun 14, 2025

Code Coverage

Package Line Rate Complexity Health
github.com/microsoft/terraform-provider-fabric/internal/auth 89% 0
github.com/microsoft/terraform-provider-fabric/internal/framework/customtypes 77% 0
github.com/microsoft/terraform-provider-fabric/internal/framework/planmodifiers 74% 0
github.com/microsoft/terraform-provider-fabric/internal/framework/typeutils 64% 0
github.com/microsoft/terraform-provider-fabric/internal/framework/validators 80% 0
github.com/microsoft/terraform-provider-fabric/internal/functions 78% 0
github.com/microsoft/terraform-provider-fabric/internal/pkg/fabricitem 82% 0
github.com/microsoft/terraform-provider-fabric/internal/pkg/tftypeinfo 86% 0
github.com/microsoft/terraform-provider-fabric/internal/pkg/transforms 83% 0
github.com/microsoft/terraform-provider-fabric/internal/pkg/utils 93% 0
github.com/microsoft/terraform-provider-fabric/internal/provider 83% 0
github.com/microsoft/terraform-provider-fabric/internal/provider/client 95% 0
github.com/microsoft/terraform-provider-fabric/internal/provider/config 100% 0
github.com/microsoft/terraform-provider-fabric/internal/provider/utils 69% 0
github.com/microsoft/terraform-provider-fabric/internal/services/activator 100% 0
github.com/microsoft/terraform-provider-fabric/internal/services/capacity 87% 0
github.com/microsoft/terraform-provider-fabric/internal/services/copyjob 100% 0
github.com/microsoft/terraform-provider-fabric/internal/services/dashboard 100% 0
github.com/microsoft/terraform-provider-fabric/internal/services/dataflow 100% 0
github.com/microsoft/terraform-provider-fabric/internal/services/datamart 100% 0
github.com/microsoft/terraform-provider-fabric/internal/services/datapipeline 100% 0
github.com/microsoft/terraform-provider-fabric/internal/services/domain 81% 0
github.com/microsoft/terraform-provider-fabric/internal/services/domainra 49% 0
github.com/microsoft/terraform-provider-fabric/internal/services/domainwa 80% 0
github.com/microsoft/terraform-provider-fabric/internal/services/environment 87% 0
github.com/microsoft/terraform-provider-fabric/internal/services/eventhouse 93% 0
github.com/microsoft/terraform-provider-fabric/internal/services/eventstream 100% 0
github.com/microsoft/terraform-provider-fabric/internal/services/eventstreamsourceconnection 83% 0
github.com/microsoft/terraform-provider-fabric/internal/services/gateway 79% 0
github.com/microsoft/terraform-provider-fabric/internal/services/gatewayra 46% 0
github.com/microsoft/terraform-provider-fabric/internal/services/graphqlapi 100% 0
github.com/microsoft/terraform-provider-fabric/internal/services/kqldashboard 100% 0
github.com/microsoft/terraform-provider-fabric/internal/services/kqldatabase 78% 0
github.com/microsoft/terraform-provider-fabric/internal/services/kqlqueryset 100% 0
github.com/microsoft/terraform-provider-fabric/internal/services/lakehouse 87% 0
github.com/microsoft/terraform-provider-fabric/internal/services/lakehousetable 83% 0
github.com/microsoft/terraform-provider-fabric/internal/services/mirroreddatabase 87% 0
github.com/microsoft/terraform-provider-fabric/internal/services/mirroredwarehouse 100% 0
github.com/microsoft/terraform-provider-fabric/internal/services/mlexperiment 100% 0
github.com/microsoft/terraform-provider-fabric/internal/services/mlmodel 100% 0
github.com/microsoft/terraform-provider-fabric/internal/services/mounteddatafactory 100% 0
github.com/microsoft/terraform-provider-fabric/internal/services/notebook 100% 0
github.com/microsoft/terraform-provider-fabric/internal/services/paginatedreport 100% 0
github.com/microsoft/terraform-provider-fabric/internal/services/report 100% 0
github.com/microsoft/terraform-provider-fabric/internal/services/semanticmodel 100% 0
github.com/microsoft/terraform-provider-fabric/internal/services/sparkcustompool 65% 0
github.com/microsoft/terraform-provider-fabric/internal/services/sparkenvsettings 76% 0
github.com/microsoft/terraform-provider-fabric/internal/services/sparkjobdefinition 92% 0
github.com/microsoft/terraform-provider-fabric/internal/services/sparkwssettings 82% 0
github.com/microsoft/terraform-provider-fabric/internal/services/sqldatabase 92% 0
github.com/microsoft/terraform-provider-fabric/internal/services/sqlendpoint 100% 0
github.com/microsoft/terraform-provider-fabric/internal/services/warehouse 93% 0
github.com/microsoft/terraform-provider-fabric/internal/services/workspace 84% 0
github.com/microsoft/terraform-provider-fabric/internal/services/workspacegit 64% 0
github.com/microsoft/terraform-provider-fabric/internal/services/workspacempe 78% 0
github.com/microsoft/terraform-provider-fabric/internal/services/workspacera 75% 0
Summary 79% (5370 / 6822) 0

Minimum allowed line rate is 40%

@badeamarjieh badeamarjieh linked an issue Jun 15, 2025 that may be closed by this pull request
1 task
var respUpdate fabcore.ItemsClientUpdateItemResponse
var err error

err = RetryOperation(ctx, DefaultUpdateRetryConfig(), func() error {
Copy link
Collaborator

@OrBaubergMicrosoft OrBaubergMicrosoft Jun 17, 2025

Choose a reason for hiding this comment

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

IMO updating inside of the retry operation is a bit odd,
why not pulling the update to be done before the retry function call, and enter it only if there is an error

Copy link
Member Author

Choose a reason for hiding this comment

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

Inside the retry function I'd need to call update again, so that's duplicate code.

Copy link
Member Author

Choose a reason for hiding this comment

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

alternatively, I can call the outer function "CreateItem" or "UpdateItem" and the internal implementation can reflect the retry mechanism, WDYT?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
skip-changelog Skip changelog entry
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[bug] Cannot recreate resource
2 participants