Skip to content

refactor: validate backup retention days on SQL DB#249

Draft
v-alexmoraru wants to merge 1 commit into
microsoft:mainfrom
v-alexmoraru:v-alexmoraru/add-backup-retention-days-sql
Draft

refactor: validate backup retention days on SQL DB#249
v-alexmoraru wants to merge 1 commit into
microsoft:mainfrom
v-alexmoraru:v-alexmoraru/add-backup-retention-days-sql

Conversation

@v-alexmoraru

Copy link
Copy Markdown
Member

No description provided.

Copilot AI review requested due to automatic review settings June 11, 2026 10:47
@v-alexmoraru v-alexmoraru requested a review from a team as a code owner June 11, 2026 10:47
@v-alexmoraru v-alexmoraru marked this pull request as draft June 11, 2026 10:48

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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_property to enforce backupRetentionDays integer range validation.
  • Integrated SQLDatabase property validation into fs set execution 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")
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.

2 participants