Skip to content

V10.0.4/ci automation#24

Merged
gimlichael merged 2 commits into
mainfrom
v10.0.4/ci-automation
Feb 28, 2026
Merged

V10.0.4/ci automation#24
gimlichael merged 2 commits into
mainfrom
v10.0.4/ci-automation

Conversation

@gimlichael

@gimlichael gimlichael commented Feb 28, 2026

Copy link
Copy Markdown
Member

This pull request enhances the .github/scripts/bump-nuget.py script to more robustly manage package version updates for Codebelt-related projects. The script now updates all Codebelt packages: those from the triggering source are set to the specified version, while all other Codebelt packages are updated to their latest stable version from NuGet. Additionally, new Codebelt packages are supported, and the script output is clarified. There is also a minor update to the Microsoft.NET.Test.Sdk package version in Directory.Packages.props.

Script enhancements for package version management:

  • The script now updates all Codebelt-related packages: triggered source packages are set to the specified version, and all other Codebelt packages are updated to the latest stable version from NuGet. Third-party packages remain unchanged. [1] [2] [3] [4] [5]
  • Added support for new Codebelt packages in SOURCE_PACKAGE_MAP, including Codebelt.Extensions.Carter, Codebelt.Extensions.AspNetCore.Newtonsoft.Json, Codebelt.Extensions.AspNetCore.Text.Yaml, and Codebelt.SharedKernel.

Minor dependency update:

  • Updated Microsoft.NET.Test.Sdk version from 18.0.1 to 18.3.0 in Directory.Packages.props.

Summary by CodeRabbit

Release Notes

  • Chores
    • Enhanced automatic dependency update system with NuGet-based version management for centrally managed packages, including improved error handling and logging
    • Updated testing framework dependency to the latest stable version for improved compatibility and bug fixes

@gimlichael gimlichael self-assigned this Feb 28, 2026
Copilot AI review requested due to automatic review settings February 28, 2026 01:23
@coderabbitai

coderabbitai Bot commented Feb 28, 2026

Copy link
Copy Markdown
📝 Walkthrough

Walkthrough

The PR enhances the bump-nuget.py script to automatically update Codebelt packages via NuGet API lookups, adding helper functions to detect Codebelt packages and fetch latest stable versions. It also updates Microsoft.NET.Test.Sdk to version 18.3.0 in Directory.Packages.props.

Changes

Cohort / File(s) Summary
NuGet Update Script
.github/scripts/bump-nuget.py
Added is_codebelt_package() and get_latest_nuget_version() helper functions with caching. Reworked main logic to read Directory.Packages.props, update triggered packages to exact versions, and automatically fetch and apply latest stable NuGet versions for all Codebelt packages. Enhanced error handling and adjusted console output messaging.
Package Management
Directory.Packages.props
Updated Microsoft.NET.Test.Sdk version from 18.0.1 to 18.3.0.

Sequence Diagram

sequenceDiagram
    participant Script as Bump Script
    participant FS as File System
    participant NuGet as NuGet API
    participant Props as Directory.Packages.props

    Script->>FS: Read Directory.Packages.props
    FS-->>Script: Package list with versions
    
    loop For each package
        Script->>Script: Check if Codebelt package
        alt Is Codebelt Package
            Script->>NuGet: Fetch latest stable version
            NuGet-->>Script: Version info (cached)
            Script->>Script: Compare versions
            alt Version newer
                Script->>Props: Update package version
                Props-->>Script: Confirmation
            end
        else Triggered Package
            Script->>Props: Update to TRIGGER_VERSION
            Props-->>Script: Confirmation
        else Third-party
            Script->>Script: Log as skipped
        end
    end
    
    Script-->>Script: Return exit code 0
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~22 minutes

Possibly related PRs

  • V9.0.3/package maintenance #11: Modifies Directory.Packages.props package versions including Microsoft.NET.Test.Sdk, indicating coordinated dependency updates across repositories.

Poem

🐰 Hopping through NuGet feeds so bright,
Packages updated with pure delight!
Codebelt flows with versions so new,
Automation hops—there's always more to do! ✨

🚥 Pre-merge checks | ✅ 1 | ❌ 2

❌ Failed checks (1 warning, 1 inconclusive)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 60.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Title check ❓ Inconclusive The title 'V10.0.4/ci automation' is vague and does not clearly describe the primary changes. It uses generic framing (version/branch notation and 'automation') without conveying what was actually changed. Revise the title to be more specific about the main changes, such as 'Enhance NuGet package version management for Codebelt packages' or 'Update CI automation to manage Codebelt and third-party package versions'.
✅ Passed checks (1 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch v10.0.4/ci-automation

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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
.github/scripts/bump-nuget.py (1)

100-107: ⚠️ Potential issue | 🟠 Major

Validate TRIGGER_SOURCE against known keys before processing.

On Line 100, non-empty values are validated, but an unsupported TRIGGER_SOURCE is still accepted. That can silently skip the intended triggered-package bump and produce unintended update behavior.

Proposed fix
 def main():
     if not TRIGGER_SOURCE or not TRIGGER_VERSION:
         print(
             "Error: TRIGGER_SOURCE and TRIGGER_VERSION environment variables required"
         )
         print(f"  TRIGGER_SOURCE={TRIGGER_SOURCE}")
         print(f"  TRIGGER_VERSION={TRIGGER_VERSION}")
         sys.exit(1)
+    if TRIGGER_SOURCE not in SOURCE_PACKAGE_MAP:
+        print(f"Error: Unsupported TRIGGER_SOURCE '{TRIGGER_SOURCE}'")
+        print(f"Valid sources: {', '.join(sorted(SOURCE_PACKAGE_MAP.keys()))}")
+        sys.exit(1)
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.github/scripts/bump-nuget.py around lines 100 - 107, Add validation after
the existing TRIGGER_SOURCE/TRIGGER_VERSION presence check to ensure
TRIGGER_SOURCE is one of the supported keys; update the block around the
existing if not TRIGGER_SOURCE or not TRIGGER_VERSION: check TRIGGER_SOURCE
against the known allowed list (e.g., a constant list/tuple of valid trigger
keys used elsewhere in this script) and if it is not present, print a clear
error showing the invalid TRIGGER_SOURCE and exit with sys.exit(1). Reference
TRIGGER_SOURCE and TRIGGER_VERSION in the same conditional area and ensure the
error message explicitly states the allowed values so unsupported keys are
rejected before any bump processing occurs.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In @.github/scripts/bump-nuget.py:
- Around line 91-93: The except block that catches Exception and sets result =
None for package_name swallows lookup failures; update it to record the failure
(e.g., set a failure flag or append package_name to a failures list) or re-raise
after logging so the error isn't treated as success, and ensure the top-level
exit logic (currently always exiting successfully) checks that failure flag/list
and calls sys.exit(1) when any NuGet lookups failed; update the code paths
around result, package_name, and the fetch function (e.g., fetch_latest_version)
so a failed lookup causes a non-zero exit instead of silently passing.

---

Outside diff comments:
In @.github/scripts/bump-nuget.py:
- Around line 100-107: Add validation after the existing
TRIGGER_SOURCE/TRIGGER_VERSION presence check to ensure TRIGGER_SOURCE is one of
the supported keys; update the block around the existing if not TRIGGER_SOURCE
or not TRIGGER_VERSION: check TRIGGER_SOURCE against the known allowed list
(e.g., a constant list/tuple of valid trigger keys used elsewhere in this
script) and if it is not present, print a clear error showing the invalid
TRIGGER_SOURCE and exit with sys.exit(1). Reference TRIGGER_SOURCE and
TRIGGER_VERSION in the same conditional area and ensure the error message
explicitly states the allowed values so unsupported keys are rejected before any
bump processing occurs.

ℹ️ Review info

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 946a51e and 7d0835e.

📒 Files selected for processing (2)
  • .github/scripts/bump-nuget.py
  • Directory.Packages.props

Comment on lines +91 to +93
except Exception as exc:
print(f" Warning: Could not fetch latest version for {package_name}: {exc}")
result = None

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

NuGet lookup failures are currently treated as successful runs.

On Lines 91–93, lookup errors are downgraded to warnings; on Line 176, the script always exits with success. This can hide failed package resolution and let CI pass with stale versions.

Proposed fix
 _nuget_version_cache: Dict[str, Optional[str]] = {}
+_nuget_lookup_failures: List[str] = []

 def get_latest_nuget_version(package_name: str) -> Optional[str]:
@@
     except Exception as exc:
         print(f"  Warning: Could not fetch latest version for {package_name}: {exc}")
+        _nuget_lookup_failures.append(package_name)
         result = None
@@
-    return 0 if changes else 0  # Return 0 even if no changes (not an error)
+    if _nuget_lookup_failures:
+        print()
+        print(
+            f"Error: Failed to resolve NuGet versions for {len(set(_nuget_lookup_failures))} package(s)."
+        )
+        return 1
+    return 0

Also applies to: 176-176

🧰 Tools
🪛 Ruff (0.15.2)

[warning] 91-91: Do not catch blind exception: Exception

(BLE001)

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.github/scripts/bump-nuget.py around lines 91 - 93, The except block that
catches Exception and sets result = None for package_name swallows lookup
failures; update it to record the failure (e.g., set a failure flag or append
package_name to a failures list) or re-raise after logging so the error isn't
treated as success, and ensure the top-level exit logic (currently always
exiting successfully) checks that failure flag/list and calls sys.exit(1) when
any NuGet lookups failed; update the code paths around result, package_name, and
the fetch function (e.g., fetch_latest_version) so a failed lookup causes a
non-zero exit instead of silently passing.

Copilot AI left a comment

Copy link
Copy Markdown

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 updates the CI automation used for “service update” workflows by improving the NuGet bumping script to update all Codebelt-related packages (triggered source set to the provided version; other Codebelt packages updated to latest stable from NuGet) and by bumping a test dependency version in central package management.

Changes:

  • Enhance .github/scripts/bump-nuget.py to update non-triggered Codebelt packages to the latest stable NuGet versions, with caching and clearer output.
  • Expand SOURCE_PACKAGE_MAP to include additional Codebelt packages (e.g., Carter, ASP.NET Core Newtonsoft.Json/Yaml, SharedKernel).
  • Update Microsoft.NET.Test.Sdk from 18.0.1 to 18.3.0 in Directory.Packages.props.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
.github/scripts/bump-nuget.py Updates version bumping logic to handle all Codebelt packages (triggered vs. latest-from-NuGet) and adds new supported package prefixes.
Directory.Packages.props Minor central dependency version bump for the test SDK.
Comments suppressed due to low confidence (1)

.github/scripts/bump-nuget.py:103

  • Consider validating that TRIGGER_SOURCE is one of the known keys in SOURCE_PACKAGE_MAP. As-is, an unexpected/typoed TRIGGER_SOURCE will silently disable the “triggered packages set to TRIGGER_VERSION” behavior and may instead bump matching Codebelt packages to whatever NuGet reports as latest.
def main():
    if not TRIGGER_SOURCE or not TRIGGER_VERSION:
        print(
            "Error: TRIGGER_SOURCE and TRIGGER_VERSION environment variables required"
        )

Comment on lines +91 to +95
except Exception as exc:
print(f" Warning: Could not fetch latest version for {package_name}: {exc}")
result = None

_nuget_version_cache[package_name] = result

Copilot AI Feb 28, 2026

Copy link

Choose a reason for hiding this comment

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

On NuGet lookup failure, the exception path sets result=None and the caller silently keeps the existing package version. This can lead to confusing runs (e.g., no updates applied even though an update exists). Consider tracking lookup failures and surfacing them in the summary (or optionally failing the run for unresolved Codebelt packages).

Copilot uses AI. Check for mistakes.
@sonarqubecloud

Copy link
Copy Markdown

@gimlichael gimlichael merged commit f9d88cf into main Feb 28, 2026
25 checks passed
@gimlichael gimlichael deleted the v10.0.4/ci-automation branch February 28, 2026 01:31
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