refactor: validate backup retention days on SQL DB#249
Draft
v-alexmoraru wants to merge 1 commit into
Draft
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Adds SQLDatabase-specific validation for the properties.backupRetentionDays field when using the fs set command, including a dedicated error message and test coverage.
Changes:
- Added
validate_sql_database_propertyto enforcebackupRetentionDaysinteger range validation. - Integrated SQLDatabase property validation into
fs setexecution for SQLDatabase items. - Added constants and an error message helper, plus unit tests for valid/invalid inputs.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/test_utils/test_fab_cmd_set_utils.py | Adds unit tests covering SQLDatabase backupRetentionDays validation scenarios. |
| src/fabric_cli/utils/fab_cmd_set_utils.py | Implements SQLDatabase-specific validator for backupRetentionDays. |
| src/fabric_cli/errors/common.py | Adds a dedicated error message for invalid backupRetentionDays. |
| src/fabric_cli/core/fab_constant.py | Introduces SQLDatabase validation constants (min/max days and property key). |
| src/fabric_cli/commands/fs/set/fab_fs_set_item.py | Hooks SQLDatabase property validation into the set command execution path. |
Comment on lines
+107
to
+115
| # Try to parse as JSON first (handles numeric input) | ||
| try: | ||
| value = json.loads(input_value) | ||
| except (TypeError, json.JSONDecodeError): | ||
| value = input_value | ||
|
|
||
| # Ensure it's an integer | ||
| if not isinstance(value, int) or isinstance(value, bool): | ||
| raise ValueError("Not an integer") |
Comment on lines
+213
to
+217
| def test_validate_sql_database_property_backup_retention_days_valid_int_success(): | ||
| from fabric_cli.utils.fab_cmd_set_utils import validate_sql_database_property | ||
|
|
||
| # Valid integer within range should not raise | ||
| validate_sql_database_property("properties.backupRetentionDays", "7") |
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.
No description provided.