Skip to content

fix(manifest): match historical versions exactly - #6831

Open
LUX-ETVERITAS wants to merge 1 commit into
ScoopInstaller:developfrom
LUX-ETVERITAS:fix/6822-historical-manifest-version-prefix
Open

LUX-ETVERITAS wants to merge 1 commit into
ScoopInstaller:developfrom
LUX-ETVERITAS:fix/6822-historical-manifest-version-prefix

Conversation

@LUX-ETVERITAS

@LUX-ETVERITAS LUX-ETVERITAS commented Nov 16, 2026 •

Copy link
Copy Markdown

Description

Fixes #6822.

scoop install <app>@<version> and scoop download <app>@<version> fail to load a historical manifest when the requested version is a prefix of a later release (for example 5.20 vs 5.20.1). Scoop prints No historical manifest found and falls back to autoupdate.

Root cause

Find-HistoricalManifestInGit builds a pickaxe pattern without a right boundary:

$pattern = 'version.: .' + [regex]::Escape($requestedVersion)

so a request for 5.20 also matches "version": "5.20.1". Combined with -n 1, the newest matching commit is the bump away from a later release, and only that commit and its parent are inspected.

Fix

  • Add a POSIX-compatible right boundary: ([^0-9A-Za-z._+-]|$). A lookahead would be cleaner, but git log -G uses a POSIX regex, so (?![.\d]) fails with invalid regex.
  • Start with the newest commit (-n 1), then widen the window to 20, 100, and finally the full history only when the exact version is not in the current batch. The common case still stops after one commit; the -S fallback uses the same batching.
  • Add Pester coverage for the widening behaviour and for the pattern boundary.

Testing

  • Invoke-Pester test/Scoop-Manifest.Tests.ps1: 34 passed, 0 failed (Pester 6.0.0).
  • Real temporary git repository: 5.20, 5.20.1, and 5.20.2 resolve; 5.2 and 5.18 return $null.
  • Verified the git pattern on Windows PowerShell 5.1 and PowerShell 7.
  • PSScriptAnalyzer is clean on both changed files.

Checklist

  • I have read the Contributing Guide.
  • I have ensured that I am targeting the develop branch.
  • I have updated the tests accordingly.
  • I have added an entry in the CHANGELOG.

This patch was prepared with AI assistance (OpenCode) and tested locally.

RetriggerView in GreptileConfidence Score: 5/5

The PR appears safe to merge; both previous findings are addressed.

Summary

Fixes historical version lookup so a request such as 5.20 does not also match 5.20.1.

  • Historical version requests now find the exact manifest.

Reviews (3) · Last reviewed commit: "fix(manifest): match historical versions..." · Reviewed by Greptile

Comment thread lib/manifest.ps1 Resolved
Comment thread test/Scoop-Manifest.Tests.ps1 Resolved
LUX-ETVERITAS added a commit to LUX-ETVERITAS/Scoop that referenced this pull request Nov 16, 2026
@LUX-ETVERITAS
LUX-ETVERITAS force-pushed the fix/6822-historical-manifest-version-prefix branch from 462182d to 36fa125 Compare November 16, 2026 03:29
@LUX-ETVERITAS
LUX-ETVERITAS force-pushed the fix/6822-historical-manifest-version-prefix branch from 36fa125 to 0ef19d1 Compare November 16, 2026 03:32
@LUX-ETVERITAS

Copy link
Copy Markdown
Author

Addressed both Greptile findings in 0ef19d1:

  • Lookups now start with -n 1 and widen to 20/100/all only when the exact version is not in the batch, so the common case still stops at one commit. The -S fallback follows the same path.
  • The regression test now makes the first batch contain only 5.20.1/5.20.2 and puts exact 5.20 in the second commit, so the previous single-hit implementation would fail it.

This branch has not been deployed

No deployments
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