Repository navigation
Fix specifier upgrades, prefix edits, and vsce packaging - #12
Merged
Merged
Conversation
Multi-constraint upgrades dropped upper bounds and exclusions, and ~= pins gained extra precision. pyproject updates could edit a longer package that shared a name prefix. Bare, marker-only, and URL dependencies showed a Major update lens. Pin @types/vscode to 1.85.0 and run vsce package in CI. Co-authored-by: cookabc <chuangcius@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes four high-priority issues from the review of
main. Upgrades now change only the lower bound or pin, pyproject edits hit the named package, unversioned and URL dependencies no longer offer an Update lens, andvsce packagesucceeds whileengines.vscodestays^1.85.0.1. Multi-constraint specifiers were rewritten as a single version
Problem. The requirements regex treated commas as part of the version token, and the replacement was always
operator + newVersionfor the first operator it saw.requests>=2.0,<3.0becamerequests>=2.32.3(upper bound dropped).foo!=1.5,>=1.0becamefoo!=1.9(the exclusion was overwritten and the lower bound was lost).django~=4.2became~=4.2.16, which PEP 440 narrows from<5to<4.3.Fix.
planLineUpdate/buildVersionReplacementinsrc/utils/dependencyUtils.tsrewrite only bumpable constraints (>=,>,==,===,~=,^).<,<=, and!=are left in place.>is written as>=at the resolved version so that version is actually allowed.~=is truncated to the original release precision, and a no-op (~=4.2already covers4.2.16) is not offered as an update. The single-package command and Update All both go through this planner, and risk analysis uses the floor/pin (1.0in!=2.0,>=1.0) rather than the exclusion.Tests (
src/test/unit/upgradeCorrectness.test.ts):bumps the lower bound and keeps the upper boundbumps the lower bound and keeps exclusionsdoes not treat an exclusion as the current version for risk analysispreserves compatible-release precisionturns an exclusive lower bound into an inclusive one at the new versionrewrites a TOML exclusion without inverting it2. A shared name prefix edited the wrong pyproject dependency
Problem.
parsePyProjectDocumentsetstartColumnwithline.indexOf(packageName). On["pytest-cov>=4.0", "pytest>=7.0"],pytestmatched the start ofpytest-cov, so the upgrade rewrote pytest-cov.Fix.
findDependencySpaninsrc/core/pyprojectParser.tslocates the package inside its own quoted requirement (with a name-boundary fallback). The column span stops at that requirement, so a later shorter name is not inside the longer one's range.Tests:
updates pytest and not pytest-cov when they share a lineupdates pytest-cov when the shorter name comes first3. Unversioned and URL dependencies showed a Major Update lens
Problem. A requirement with no version still compared an empty current version (
0.0.0) to the latest release and offered a Major update. Confirmingrequests ; python_version >= "3.8"rewrote the marker topython_version >=2.32.3because version extraction searched past;. Barerequestsshowed the warning and then did nothing.pkg @ https://...got the same useless Update lens.Fix. Version search stops at
;and#(and at the closing quote of the current TOML string) and ignores a PEP 508@reference.classifyVersionLensreturnshiddenwhen there is no version constraint, andprovideCodeLensesdoes not create a version lens for those dependencies (the PyPI link remains). The update command returns before the Major dialog when there is nothing safe to change.Tests:
does not rewrite a marker when the requirement has no versiondoes not rewrite a bare package namedoes not rewrite a PEP 508 direct referencekeeps a versioned requirement's environment markeroffers an update for a real lower bound inside a markerdoes not create an update lens for bare, marker-only, or URL requirementsdoes not create an update lens for unversioned pyproject dependencies4.
vsce packagefailed on the engines / types mismatchProblem.
@types/vscodewas^1.140.0whileengines.vscodeis^1.85.0.npx @vscode/vsce packagerejects a types minor newer than the engine, sopublish.ymlcould not package.Fix.
@types/vscodeis pinned to1.85.0(the engine floor).engines.vscodestays^1.85.0.AGENTS.mdnow records that pin. CI runsnpx @vscode/vsce packageafter the tests.Verification
npm run compilenpm test(132 passing)npm run lintnpx @vscode/vsce package