Fix log config inputs not allowing for zero#579
Merged
Conversation
Contributor
Author
|
@sourcery-ai review |
Reviewer's guide (collapsed on small PRs)Reviewer's GuideAdjusts general log settings validation and UI to allow zero values for several numeric fields while preventing an invalid combination for archive settings when archiving is enabled. Sequence diagram for updated log archive validation when zero values are allowedsequenceDiagram
actor User
participant LogSettingsForm
participant GeneralSettingsComponent
User->>LogSettingsForm: Enter values for archiveRetainedCount and archiveTimeLimitHours
LogSettingsForm->>GeneralSettingsComponent: Update logArchiveRetainedCount
GeneralSettingsComponent->>GeneralSettingsComponent: compute logArchiveRetainedError()
alt retainedCount < 0
GeneralSettingsComponent-->>LogSettingsForm: error Minimum value is 0
else retainedCount > 100
GeneralSettingsComponent-->>LogSettingsForm: error Maximum value is 100
else archiving enabled AND retainedCount == 0 AND archiveTimeLimitHours == 0
GeneralSettingsComponent-->>LogSettingsForm: error Retained count and time limit cannot both be 0 when archiving is enabled
else
GeneralSettingsComponent-->>LogSettingsForm: no error
end
LogSettingsForm->>GeneralSettingsComponent: Update logArchiveTimeLimitHours
GeneralSettingsComponent->>GeneralSettingsComponent: compute logArchiveTimeLimitError()
alt timeLimit < 0
GeneralSettingsComponent-->>LogSettingsForm: error Minimum value is 0
else timeLimit > 1440
GeneralSettingsComponent-->>LogSettingsForm: error Maximum value is 1440 hours (60 days)
else archiving enabled AND timeLimit == 0 AND archiveRetainedCount == 0
GeneralSettingsComponent-->>LogSettingsForm: error Retained count and time limit cannot both be 0 when archiving is enabled
else
GeneralSettingsComponent-->>LogSettingsForm: no error
end
LogSettingsForm-->>User: Show updated validation messages and allow zero where valid
File-Level Changes
Possibly linked issues
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Hey - I've left some high level feedback:
- The cross-field validation that
logArchiveRetainedCountandlogArchiveTimeLimitHourscannot both be 0 when archiving is enabled is duplicated in two computed error functions; consider extracting this into a shared helper or a single computed to avoid divergence and simplify future changes.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- The cross-field validation that `logArchiveRetainedCount` and `logArchiveTimeLimitHours` cannot both be 0 when archiving is enabled is duplicated in two computed error functions; consider extracting this into a shared helper or a single computed to avoid divergence and simplify future changes.Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Relates to #569
Summary by Sourcery
Allow zero values for log configuration limits while enforcing sensible validation rules when archiving is enabled.
Bug Fixes:
Enhancements: