Skip to content

Conversation

@jeremymeng
Copy link
Member

@jeremymeng jeremymeng commented Sep 23, 2025

that reports errors if changes are made to a package's src/ directory but the
package version has not been incremented.

We want to ensure that product changes happen in a new version that is different
from the last published version. This PR adds a check that ensure that we bump
versions when making source changes.

…on tool

- Added detailed README with usage examples and integration instructions
- Formatted code with prettier
- Tool validates packages with src/ changes have version bumps
- Uses npm registry to check last published stable/beta versions
- Exits with code 1 if violations found for CI/CD integration
Copilot AI review requested due to automatic review settings September 23, 2025 18:04
Copy link
Contributor

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 introduces a new versioning validation tool to ensure packages with source code changes in their src/ directories have appropriate version bumps in pull requests. The tool helps maintain proper versioning by automating validation in CI/CD pipelines.

Key changes:

  • Adds a new CLI tool that compares current package versions against published versions to detect missing version bumps
  • Integrates the validation into the Azure Pipelines analyze step to run automatically on pull requests
  • Removes unused dependency from package.json to clean up dependencies

Reviewed Changes

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

File Description
eng/tools/versioning/validatePullRequestVersion.md Complete documentation for the new versioning validation tool
eng/tools/versioning/validatePullRequestVersion.js Main implementation of the version validation CLI tool
eng/tools/versioning/package.json Removes unused yargs-parser dependency
eng/pipelines/templates/steps/analyze.yml Integrates versioning validation into CI pipeline
Files not reviewed (1)
  • eng/tools/versioning/package-lock.json: Language not supported

},
"base-ref": {
type: "string",
default: "HEAD^1",
Copy link

Copilot AI Sep 23, 2025

Choose a reason for hiding this comment

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

The default base reference 'HEAD^1' conflicts with the documentation which shows 'origin/main' as the default. This inconsistency could cause confusion and unexpected behavior. Consider updating the default to match the documented behavior or updating the documentation to reflect the actual default.

Suggested change
default: "HEAD^1",
default: "origin/main",

Copilot uses AI. Check for mistakes.
Comment on lines +83 to +84
const packageSrcPattern = `${packagePath}/src/`;
return normalizedFile.startsWith(packageSrcPattern);
Copy link

Copilot AI Sep 23, 2025

Choose a reason for hiding this comment

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

The string comparison for detecting src/ changes could match unintended paths. For example, a file 'sdk/package/src-backup/file.js' would match the pattern 'sdk/package/src/'. Consider using a more precise pattern that ensures the src directory is followed by a path separator or end of string.

Suggested change
const packageSrcPattern = `${packagePath}/src/`;
return normalizedFile.startsWith(packageSrcPattern);
// Match only files directly under the src directory, not src-backup or similar
const packageSrcRegex = new RegExp(`^${packagePath.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')}/src(?:/|$)`);
return packageSrcRegex.test(normalizedFile);

Copilot uses AI. Check for mistakes.
displayName: "Install versioning tool dependencies"
- script: |
node validatePullRequestVersion.js
Copy link

Copilot AI Sep 23, 2025

Choose a reason for hiding this comment

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

The versioning validation runs without any command-line arguments, relying entirely on defaults. Since this is in a CI environment, it would be more explicit and maintainable to specify the base reference (e.g., '--base-ref origin/main') to ensure consistent behavior regardless of local git state.

Suggested change
node validatePullRequestVersion.js
node validatePullRequestVersion.js --base-ref origin/main

Copilot uses AI. Check for mistakes.
@jeremymeng jeremymeng requested review from a team, MaryGao, qiaozha and timovv as code owners September 23, 2025 19:56
@jeremymeng jeremymeng changed the title [EngSys] add versioning validation [EngSys] add versioning pull request validation Sep 30, 2025
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