Skip to content

Conversation

Rose-Northey
Copy link
Contributor

@Rose-Northey Rose-Northey commented Sep 10, 2025

Background

In preparation for adding a "strategy" attribute, a refactor of the lifecycle retention policies was done.

Validation logic previously centered around "should_keep_forever" which will be made deprecated. Validation logic is now centered around "quantity_to_keep"

[sc-121144]

Results

Defaults from the schema were removed as these were overridden by other parts of the code and had no effect on the behaviour.

@Rose-Northey Rose-Northey changed the title Fnm/refactor and fix lifecycle retention policies refactor lifecycle retention policies around quantity_to_keep Sep 10, 2025
@Rose-Northey Rose-Northey marked this pull request as ready for review September 10, 2025 21:04
@Rose-Northey Rose-Northey requested a review from a team September 11, 2025 23:57
// do not throw an error for backwards compatability.
} else {
resp.Diagnostics.AddAttributeError(
// replaces a confusing state change to "unit = Items" error at the api
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm guessing this is to deal with the case sensitive API error response for "Items", but the error message is not related to this at all, which is confusing. Could you explain what you mean here by this comment?

Copy link
Contributor Author

@Rose-Northey Rose-Northey Sep 17, 2025

Choose a reason for hiding this comment

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

When the user puts days in when the strategy isn't set to count, the server will return "unexpected result, unit was Days but is now Items" because the server returns items no matter what when a forever or default strategy is set.

It won't error when people use "items" even though items isn't needed so I thought it would be good to not break instances that are doing this (even though its an unnecessary field)

I was told to use (stringvalidator.OneOfCaseInsensitive("Days", "Items")) in the schema instead of letting the validation logic be in the external validator so that's why lines 233 and 234 are deleted below

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.

3 participants