Skip to content

x-add-version --overwrite-version: update the version scheme - #2153

Merged
Billy O'Neal (BillyONeal) merged 6 commits into
microsoft:mainfrom
Kiptoo-Deus:fix-overwrite-version-scheme
Nov 13, 2026
Merged

Billy O'Neal (BillyONeal) merged 6 commits into
microsoft:mainfrom
Kiptoo-Deus:fix-overwrite-version-scheme

Conversation

@Kiptoo-Deus

Copy link
Copy Markdown
Contributor

Fixes #2106.

update_version_db_file matched an existing entry by version text and port-version only, so it never compared the version scheme:

  • If the git tree also matched, it returned "not updated" straight away. This is the state in the issue: the versions file has the right git tree but still says "version" while the port declares "version-semver", and x-add-version --overwrite-version prints No files were updated.
  • If the git tree had changed, --overwrite-version replaced only git_tree and kept the old scheme.

In both cases x-ci-verify-versions then reports the scheme mismatch and suggests vcpkg x-add-version <port> --overwrite-version, which doesn't fix it.

Now the recorded scheme is compared as well. A scheme change without --overwrite-version is an error (reusing the VersionSchemeMismatch1/VersionSchemeMismatch2 text from x-ci-verify-versions, so there are no new messages), and with --overwrite-version the scheme is rewritten together with the git tree. A changed git tree without --overwrite-version still gives the existing error.

Added end-to-end tests in versions.ps1 with a new squid port, covering both cases: a committed scheme change (git tree changed), and a versions file with the correct git tree but a stale "version" scheme. Each must fail without --overwrite-version and record "version-semver" with it.

I don't have PowerShell on this machine, so I ran the same steps with the built vcpkg from zsh on macOS (arm64) against a scratch git repository. Every step gives the expected result with this change. On main, the stale-scheme case exits 0 without --overwrite-version, and with it still leaves "version": "1.0.0" in the file. Before the fix, x-ci-verify-versions failed on the result; after it, it passes. clang-format 20.1.8 makes no changes.

When only the version scheme of a port changed (for example from
"version" to "version-semver"), --overwrite-version kept the old scheme
in the versions file, and if the git tree already matched it reported
that nothing needed to be updated. x-ci-verify-versions then kept
suggesting --overwrite-version to fix the mismatch.

Compare the recorded scheme as well: without --overwrite-version a scheme
change is reported as an error, and with it the scheme is rewritten
together with the git tree.

Fixes microsoft#2106
Copilot AI balanced review requested due to automatic review settings September 29, 2026 09:50

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot review overview

🟡 Changes recommended

The --all --overwrite-version shortcut bypasses scheme repair, and the option help remains outdated.

Review effort: Balanced
Findings: 1 Medium severity · 1 Low severity

Open (2)
What changed in this PR

Updates x-add-version --overwrite-version to detect and rewrite version schemes alongside git trees.

Changes:

  • Compares recorded and declared version schemes.
  • Adds end-to-end coverage for changed and stale schemes.
File Description
src/​vcpkg/​commands.add-version.cpp Detects and updates scheme mismatches.
azure-pipelines/​end-to-end-tests-dir/​versions.ps1 Tests scheme mismatch handling.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread src/vcpkg/commands.add-version.cpp Resolved
Comment thread src/vcpkg/commands.add-version.cpp Resolved
Copilot AI balanced review requested due to automatic review settings October 28, 2026 21:25

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

Windows CRLF output fails the LF-only manifest check, masking the intended scheme-mismatch test and causing the overwrite step to fail and halt the versions suite.

3 open issues

Review effort: Balanced

1. Remove meaningless CurrentTest assignments
2. Fix help text comment
3. Fix newlines handling in the test

@BillyONeal Billy O'Neal (BillyONeal) left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Would you consider merging Kiptoo-Deus#1 ? That will fix the other two copilot things.

overwrite-version-scheme code review nitpicks
Copilot AI balanced review requested due to automatic review settings October 29, 2026 05:53

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟢 Approval recommended

No active review issues were identified for the version-scheme overwrite change.

No open issues 🎉

3 resolved since last review

Review effort: Balanced

Billy O'Neal (BillyONeal) added a commit that referenced this pull request Nov 2, 2026
An optimization I added in #2050 is complained about by @copilot in
#2153 ; it points out that the "version tree shortcut" is unsound. If
the version is wrong, but the tree is correct, we don't check it.

With this revert it's down to about 6x faster rather than 10x faster
(vs. before #2050 ) in my testing.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings November 2, 2026 20:44

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟢 Approval recommended

No active review issues are reported for the change allowing --overwrite-version to repair version-scheme mismatches.

No open issues 🎉

Review effort: Balanced

…-scheme

Fixed conflicts where $CurrentTest assignments were restored.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings November 13, 2026 00:39

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟢 Approval recommended

No active review issues block the change to repair existing version-entry schemes.

No open issues 🎉

1 resolved since last review

Review effort: Balanced

@BillyONeal
Billy O'Neal (BillyONeal) merged commit e60df61 into microsoft:main Nov 13, 2026
7 checks passed
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.

--overwrite-version ignores change of version type

5 participants