Skip to content

Conversation

aaronburtle
Copy link
Contributor

Why make this change?

Closes #2716

What is this change?

When we create the entity cache options, we start with a new object and then later set the values for the fields. Because of this, the bool UserProvidedTtlOptions must explicitly be set when we later set these values or it will forever remain false. When it is false it is not written back out into the configuration file.

How was this tested?

Manually used the update command in the CLI to verify the field is written out.

Sample Request(s)

  • Example REST and/or GraphQL request to demonstrate modifications
  • Example of CLI usage to demonstrate modifications

@Copilot Copilot AI review requested due to automatic review settings June 11, 2025 07:22
@aaronburtle aaronburtle self-assigned this Jun 11, 2025
@aaronburtle aaronburtle added the bug Something isn't working label Jun 11, 2025
@aaronburtle aaronburtle added this to the Backlog milestone Jun 11, 2025
@aaronburtle
Copy link
Contributor Author

/azp run

Copy link

Azure Pipelines successfully started running 6 pipeline(s).

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

Adds tracking for whether a user explicitly provided a cache TTL option when running the update command so that this flag is correctly written back to the configuration.

  • Introduces isCacheTtlUserProvided to record if --cache.ttl was specified
  • Updates return statements to include UserProvidedTtlOptions based on that flag
Comments suppressed due to low confidence (2)

src/Cli/Utils.cs:846

  • [nitpick] Consider renaming isCacheTtlUserProvided to match the property name (e.g., userProvidedTtlOptions) for consistency with EntityCacheOptions.UserProvidedTtlOptions.
bool isCacheTtlUserProvided = false;

src/Cli/Utils.cs:859

  • Add unit tests for scenarios when only --cache.ttl is provided, when only --cache.enabled is provided, and when both are provided to verify UserProvidedTtlOptions is set correctly.
if (cacheTtl is not null)

@aaronburtle aaronburtle changed the title Write CacheTtl to entity when update command is used and CacheTtl is provided Write CacheTtl to entity when add/update command is used and CacheTtl is provided Jun 11, 2025
Copy link
Contributor

@RubenCerna2079 RubenCerna2079 left a comment

Choose a reason for hiding this comment

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

LGTM

…re/data-api-builder into dev/aaronburtle/CacheTtlUpdateBugFix
@aaronburtle
Copy link
Contributor Author

/azp run

Copy link

Azure Pipelines successfully started running 6 pipeline(s).

Copy link
Contributor

@anushakolan anushakolan left a comment

Choose a reason for hiding this comment

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

From the context of this PR, this looks good to me.

However, I would wait for other reviews from the team who have better context of this change.

@aaronburtle aaronburtle enabled auto-merge (squash) June 11, 2025 21:02
@aaronburtle aaronburtle merged commit 97c9b4c into main Jun 11, 2025
11 checks passed
@aaronburtle aaronburtle deleted the dev/aaronburtle/CacheTtlUpdateBugFix branch June 11, 2025 21:51
@github-project-automation github-project-automation bot moved this from Todo to Done in Data API builder Jun 11, 2025
RubenCerna2079 pushed a commit that referenced this pull request Jun 11, 2025
… is provided (#2717)

## Why make this change?

Closes #2716

## What is this change?

When we create the entity cache options, we start with a new object and
then later set the values for the fields. Because of this, the `bool`
`UserProvidedTtlOptions` must explicitly be set when we later set these
values or it will forever remain `false`. When it is false it is not
written back out into the configuration file.

## How was this tested?

Manually used the update command in the CLI to verify the field is
written out.

## Sample Request(s)

- Example REST and/or GraphQL request to demonstrate modifications
- Example of CLI usage to demonstrate modifications
RubenCerna2079 added a commit that referenced this pull request Jun 12, 2025
## Why make this change?

When we create the entity cache options, we start with a new object and
then later set the values for the fields. Because of this, the `bool`
`UserProvidedTtlOptions` must explicitly be set when we later set these
values or it will forever remain `false`. When it is false it is not
written back out into the configuration file.

## What is this change?

Fixes bug found in release candidate for 1.5
Cherry-picked PR:
- #2717 

## How was this tested?

## Sample Request(s)

Co-authored-by: aaronburtle <93220300+aaronburtle@users.noreply.github.com>
@aaronburtle aaronburtle restored the dev/aaronburtle/CacheTtlUpdateBugFix branch June 20, 2025 22:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

[Bug]: CacheTtl not correctly writing to config through CLI

3 participants