Skip to content

Automation/bug fixing#55

Merged
gimlichael merged 2 commits intomainfrom
automation/bug-fixing
Feb 18, 2026
Merged

Automation/bug fixing#55
gimlichael merged 2 commits intomainfrom
automation/bug-fixing

Conversation

@gimlichael
Copy link
Member

@gimlichael gimlichael commented Feb 18, 2026

This pull request simplifies and restricts the NuGet package version bumping process in the service update workflow. The new approach ensures that only packages published by the triggering Codebelt-related source repository are updated, while third-party packages (such as Microsoft.Extensions.* and BenchmarkDotNet) are excluded from automatic updates. Additionally, automated Docker image version bumps have been removed from the workflow.

Key changes include:

NuGet package bumping simplification:

  • .github/scripts/bump-nuget.py: Rewritten to only update packages published by the triggering source repo (e.g., Codebelt, Cuemon, Savvyio), using the provided TRIGGER_VERSION. Third-party packages are explicitly skipped, and the script no longer queries the NuGet API for the latest version of non-Codebelt packages. Error handling and result reporting are improved.

Workflow and documentation updates:

  • .github/workflows/service-update.yml: Removed automated Docker image version bumps for test runners and NGINX Alpine, with a note explaining the rationale and a TODO for smarter image selection in the future.
  • .github/workflows/service-update.yml: Updated the pull request body template to clarify that only Codebelt/Cuemon package versions are bumped automatically, and added a note that third-party packages should be updated via Dependabot or manually.

Summary by CodeRabbit

  • Chores
    • Enhanced package version update logic with source-based filtering.
    • Disabled automatic Docker image updates; manual intervention now required for third-party dependencies.

@gimlichael gimlichael self-assigned this Feb 18, 2026
Copilot AI review requested due to automatic review settings February 18, 2026 21:08
@coderabbitai
Copy link

coderabbitai bot commented Feb 18, 2026

Caution

Review failed

The pull request is closed.

📝 Walkthrough

Walkthrough

Refactored NuGet package versioning to use trigger-based updates instead of fetching latest versions, while removing automatic Docker image bumps from the CI workflow. The new approach selectively updates packages matching the trigger source and applies changes only when explicitly triggered.

Changes

Cohort / File(s) Summary
NuGet Automation
.github/scripts/bump-nuget.py
Replaced NuGet API fetch and triggered version resolution with a trigger-focused predicate (is_triggered_package). Added main() function with CLI-like flow, environment variable validation, and selective package updates based on source mapping. Updated version handling to strip leading 'v' from TRIGGER_VERSION and improved change diagnostics.
Workflow Updates
.github/workflows/service-update.yml
Removed automatic Docker image bump steps (test runner and NGINX Alpine). Updated PR body to reflect NuGet-only updates and added notes clarifying that third-party packages require manual or Dependabot-based updates.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~28 minutes

Possibly related PRs

  • Docfx/context7 chat #54 — Directly overlaps in package-version resolution logic refactoring, replacing nuget_latest/triggered_version patterns with trigger-based predicates
  • V10.0.3/service update #40 — Related through Directory.Packages.props updates controlled by the bump-nuget script

Suggested labels

codex

Poem

🐰 Triggers now guide our NuGet dance,
No wild API calls by chance,
Docker steps fade to memory's glow,
Focused bumps steal the show!
Simpler paths, more control's the gain, 🎉

✨ Finishing Touches
  • 📝 Generate docstrings
🧪 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 merged commit 0fdd279 into main Feb 18, 2026
7 of 10 checks passed
@gimlichael gimlichael deleted the automation/bug-fixing branch February 18, 2026 21:08
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 simplifies the service update automation by restricting NuGet package version bumping to only packages published by Codebelt-related source repositories. The previous approach of querying NuGet API for latest versions of all packages has been removed, and third-party packages (Microsoft.Extensions.*, BenchmarkDotNet, etc.) are now explicitly excluded from automatic updates. Additionally, automated Docker image version bumps have been removed due to issues with incorrect variant selection.

Changes:

  • Rewrote .github/scripts/bump-nuget.py to only update packages from the triggering source repository using the provided TRIGGER_VERSION, removing all NuGet API queries for third-party packages
  • Removed Docker image version bumping logic from the workflow (test runner and NGINX Alpine)
  • Updated PR body template to clarify that only Codebelt/Cuemon packages are auto-updated and third-party packages should be updated via Dependabot or manually

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 5 comments.

File Description
.github/scripts/bump-nuget.py Complete rewrite to simplify package bumping logic - now only updates packages published by the triggering source repo (e.g., Codebelt, Cuemon, Savvyio) using the provided TRIGGER_VERSION; removed NuGet API queries; improved error handling and result reporting
.github/workflows/service-update.yml Removed automated Docker image version bumps for test runners and NGINX Alpine with explanatory comment; updated PR body template to reflect that only Codebelt/Cuemon packages are auto-bumped and third-party packages require Dependabot or manual updates

Comment on lines +103 to +109
pattern = re.compile(
r"<PackageVersion\b"
r'(?=[^>]*\bInclude="([^"]+)")'
r'(?=[^>]*\bVersion="([^"]+)")'
r"[^>]*>",
re.DOTALL,
)
Copy link

Copilot AI Feb 18, 2026

Choose a reason for hiding this comment

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

The regex pattern correctly uses re.DOTALL to match multiline PackageVersion elements, but it will match ALL PackageVersion elements regardless of ItemGroup conditions (e.g., those within Condition="$(TargetFramework.StartsWith('net9'))" blocks). This means if a Cuemon package appears in multiple conditional ItemGroups with different versions for different target frameworks, they will ALL be updated to the same TRIGGER_VERSION. This may be intentional per the script's documentation ("Does NOT parse TFM conditions"), but could lead to issues if different TFMs should have different package versions. Consider documenting this behavior more explicitly or adding a warning if conditional ItemGroups are detected.

Copilot uses AI. Check for mistakes.
print(f" TRIGGER_SOURCE={TRIGGER_SOURCE}")
print(f" TRIGGER_VERSION={TRIGGER_VERSION}")
sys.exit(1)

Copy link

Copilot AI Feb 18, 2026

Choose a reason for hiding this comment

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

When TRIGGER_SOURCE is provided but doesn't exist in SOURCE_PACKAGE_MAP, the function is_triggered_package will return False for all packages (since prefixes will be an empty list from .get(TRIGGER_SOURCE, [])). This means the script will skip all packages and produce no changes. While this is safe, it would be better to add validation at the start of main() to check if TRIGGER_SOURCE exists in SOURCE_PACKAGE_MAP and exit with a clear error message if not. This would help catch configuration errors early.

Suggested change
if TRIGGER_SOURCE not in SOURCE_PACKAGE_MAP:
print(
f"Error: Unknown TRIGGER_SOURCE '{TRIGGER_SOURCE}'. "
f"Expected one of: {', '.join(SOURCE_PACKAGE_MAP.keys())}"
)
sys.exit(1)

Copilot uses AI. Check for mistakes.
.docfx/Dockerfile.docfx && echo "Bumped NGINX to $LATEST"
# Note: Docker image bumps removed in favor of manual updates
# The automated selection was picking wrong variants (e.g., mono-* instead of standard)
# TODO: Move to hosted service for smarter image selection
Copy link

Copilot AI Feb 18, 2026

Choose a reason for hiding this comment

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

The comment says "smarter image selection" but doesn't specify what "smarter" means. Consider being more specific about what improvements are needed, such as "image selection that filters by architecture and excludes variant tags like mono-*" or "automated selection with maintainer-defined filter rules". This will help whoever implements the hosted service understand the requirements.

Suggested change
# TODO: Move to hosted service for smarter image selection
# TODO: Move to a hosted service that selects Docker images by architecture, excludes mono-* and other unwanted variants, and applies maintainer-defined filter rules for tag selection.

Copilot uses AI. Check for mistakes.
current = m.group(2)
# Strip 'v' prefix if present in version
target_version = TRIGGER_VERSION.lstrip("v")

Copy link

Copilot AI Feb 18, 2026

Choose a reason for hiding this comment

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

Consider adding validation for TRIGGER_VERSION format to ensure it follows semantic versioning (e.g., "1.2.3" or "1.2.3-beta"). Invalid version strings could be written to Directory.Packages.props, potentially breaking builds. A simple regex check like re.match(r'^\d+\.\d+\.\d+(-[\w.]+)?$', target_version) would catch obvious mistakes early.

Suggested change
# Validate that the target version looks like a semantic version (e.g. 1.2.3 or 1.2.3-beta)
if not re.match(r"^\d+\.\d+\.\d+(-[\w.]+)?$", target_version):
print(f"Error: Invalid TRIGGER_VERSION format: {TRIGGER_VERSION!r}")
print(" Expected a semantic version like '1.2.3' or '1.2.3-beta'.")
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 18, 2026

Choose a reason for hiding this comment

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

The return statement is redundant since both branches return 0. This could be simplified to just 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.
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

Comments