Skip to content

Comments

✨ add bump-nuget script for simplified package version updates#19

Merged
gimlichael merged 1 commit intomainfrom
automation/bug-fixing
Feb 20, 2026
Merged

✨ add bump-nuget script for simplified package version updates#19
gimlichael merged 1 commit intomainfrom
automation/bug-fixing

Conversation

@gimlichael
Copy link
Member

No description provided.

Copilot AI review requested due to automatic review settings February 20, 2026 14:55
@gimlichael gimlichael merged commit 127726b into main Feb 20, 2026
1 of 6 checks passed
@coderabbitai
Copy link

coderabbitai bot commented Feb 20, 2026

Warning

Rate limit exceeded

@gimlichael has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 0 minutes and 37 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch automation/bug-fixing

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@gimlichael gimlichael deleted the automation/bug-fixing branch February 20, 2026 14:55
Copy link

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

This PR adds a new Python script to automate NuGet package version updates during service updates. The script selectively bumps only packages published by a triggering source repository (like Cuemon, Savvyio, or other Codebelt packages), leaving third-party packages unchanged.

Changes:

  • Added bump-nuget.py script that reads environment variables to determine which packages to update
  • Implements source-aware package filtering using a prefix-based mapping system
  • Updates Directory.Packages.props file in-place with new package versions

r"<PackageVersion\b"
r'(?=[^>]*\bInclude="([^"]+)")'
r'(?=[^>]*\bVersion="([^"]+)")'
r"[^>]*>",
Copy link

Copilot AI Feb 20, 2026

Choose a reason for hiding this comment

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

The regex pattern uses positive lookahead assertions to capture the Include and Version attributes. However, the pattern doesn't enforce the closing /> or </PackageVersion>. While the pattern captures up to >, it should be more specific to handle self-closing tags properly. Consider using r"<PackageVersion\b(?=[^>]*\bInclude=\"([^\"]+)\")(?=[^>]*\bVersion=\"([^\"]+)\")[^>]*/>" to specifically match self-closing tags, which is the standard format in Directory.Packages.props files.

Suggested change
r"[^>]*>",
r"[^>]*/>",

Copilot uses AI. Check for mistakes.
Comment on lines +126 to +127
with open("Directory.Packages.props", "w") as f:
f.write(new_content)
Copy link

Copilot AI Feb 20, 2026

Choose a reason for hiding this comment

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

The script writes to Directory.Packages.props without creating a backup or using atomic write operations. If the write operation fails partway through (e.g., disk full, interrupted process), the file could be corrupted. Consider using a safer pattern: write to a temporary file first, then rename it to replace the original (atomic operation on most filesystems), or at least create a backup before writing.

Copilot uses AI. Check for mistakes.
Comment on lines +126 to +127
with open("Directory.Packages.props", "w") as f:
f.write(new_content)
Copy link

Copilot AI Feb 20, 2026

Choose a reason for hiding this comment

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

The error handling for FileNotFoundError is good, but other exceptions during file operations (like PermissionError, IOError when writing) are not caught. Consider adding exception handling around the file write operation on lines 126-127 to provide a more helpful error message if the write fails.

Suggested change
with open("Directory.Packages.props", "w") as f:
f.write(new_content)
try:
with open("Directory.Packages.props", "w") as f:
f.write(new_content)
except (PermissionError, OSError) as exc:
print(f"Error: Failed to write Directory.Packages.props: {exc}")
sys.exit(1)

Copilot uses AI. Check for mistakes.
with open("Directory.Packages.props", "w") as f:
f.write(new_content)

return 0 if changes else 0 # Return 0 even if no changes (not an error)
Copy link

Copilot AI Feb 20, 2026

Choose a reason for hiding this comment

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

The return statement on line 129 contains redundant logic. The expression 0 if changes else 0 always evaluates to 0 regardless of whether there are changes or not. If the intention is to return 0 in all cases (as the comment suggests), simplify this to return 0.

Suggested change
return 0 if changes else 0 # Return 0 even if no changes (not an error)
return 0 # Return 0 even if no changes (not an error)

Copilot uses AI. Check for mistakes.
Comment on lines +96 to +97
return m.group(0).replace(
f'Version="{current}"', f'Version="{target_version}"'
Copy link

Copilot AI Feb 20, 2026

Choose a reason for hiding this comment

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

The version replacement logic on lines 96-97 has a potential bug. It uses m.group(0).replace() which will replace ALL occurrences of the pattern within the matched string. If the old version number appears elsewhere in the matched element (e.g., in an attribute name or comment), it could be incorrectly replaced. Consider using a more targeted replacement that specifically replaces the Version attribute value, or reconstruct the entire match string with the new version.

Suggested change
return m.group(0).replace(
f'Version="{current}"', f'Version="{target_version}"'
return re.sub(
r'\bVersion="[^"]+"',
f'Version="{target_version}"',
m.group(0),
count=1,

Copilot uses AI. Check for mistakes.
Comment on lines +20 to +21
import re
import os
Copy link

Copilot AI Feb 20, 2026

Choose a reason for hiding this comment

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

The imports should follow PEP 8 conventions by grouping standard library imports separately from third-party imports (though all imports here are standard library). However, the from typing import statement should typically come after the regular imports. Consider reordering to: import os, import re, import sys, then from typing import Dict, List for consistency with Python conventions.

Suggested change
import re
import os
import os
import re

Copilot uses AI. Check for mistakes.
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.

1 participant