Skip to content

Conversation

@vaind
Copy link
Contributor

@vaind vaind commented Oct 9, 2025

Summary

Fixes a bug where the OriginalTag parameter was not passed to the post-update script on the second run of update-dependency.ps1 in the updater action.

Problem

When the updater creates a new PR and runs the update-dependency script a second time (at the "After new PR: redo the update" step), it only passed the -Tag parameter but not the -OriginalTag parameter. This violated the script's validation requirement that when Tag is set, OriginalTag must also be provided (see update-dependency.ps1:258).

Solution

  • Updated action.yml:291 to pass -OriginalTag '${{ steps.target.outputs.originalTag }}' on the second run
  • Added unit test to verify the script works correctly when both Tag and OriginalTag are explicitly provided
  • Added validation test to ensure the script fails appropriately when Tag is provided without OriginalTag

Test Plan

  • All 34 existing unit tests pass
  • New test validates explicit Tag/OriginalTag parameter passing
  • Validation test confirms proper error handling

🤖 Generated with Claude Code

vaind and others added 4 commits October 9, 2025 09:07
When the updater creates a new PR and runs the update-dependency script
a second time, it was not passing the OriginalTag parameter. This caused
the script to fail validation since Tag requires OriginalTag to be set.

Changes:
- Updated action.yml to pass OriginalTag on second script execution
- Added unit test for explicit Tag/OriginalTag parameters
- Added validation test to ensure Tag fails without OriginalTag

All 34 tests pass.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
@vaind vaind merged commit 71d223e into main Oct 9, 2025
15 checks passed
Comment on lines 16 to 23
[string] $GhTitlePattern = '',
# Specific version - if passed, no discovery is performed and the version is set directly
[string] $Tag = '',
# Version that the dependency was on before the update - should be only passed if $Tag is set. Necessary for PostUpdateScript.
[string] $OriginalTag = '',
# Optional post-update script to run after successful dependency update
# The script receives the original and new version as arguments
[string] $PostUpdateScript = ''
Copy link
Contributor

Choose a reason for hiding this comment

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

Potential bug: The script uses lowercase variables $tag and $originalTag, but the parameters are defined as $Tag and $OriginalTag, leading to incorrect behavior.
  • Description: In the execution path where Tag and OriginalTag are explicitly provided, the script attempts to use lowercase variables $tag and $originalTag. However, these variables are not defined in this scope; the correct, case-sensitive parameters are $Tag and $OriginalTag. Because PowerShell treats undefined variables as empty strings, the call to DependencyConfig 'set-version' $tag will incorrectly update the dependency file with an empty version. Additionally, the post-update script will be called with empty parameters, causing the dependency update process to fail or produce incorrect results. This bug occurs specifically in the new scenario introduced by the code change.

  • Suggested fix: Correct the variable names used in the core functionality to match the case of the defined parameters. Change $tag to $Tag and $originalTag to $OriginalTag where they are used to call DependencyConfig and the post-update script.
    severity: 0.85, confidence: 0.98

Did we get this right? 👍 / 👎 to inform future reviews.

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