Repository navigation
Conversation
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. Summary by CodeRabbit
WalkthroughManifest access and URL validation scripts now expand version variables in eligible manifest properties. Auto-update logic detects version templates, selects URLs for hash calculation, and preserves templated values during updates. ChangesManifest version variables
Priority: ⬇️ Low Merge Risk: 🟡 Moderate · up to Manifests using the new main-URL template cannot pass bucket validation. Update the schema before merging. 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Advanced
Run ID: 6443d388-3880-4973-9c02-bbbd232f41c4
📒 Files selected for processing (6)
bin/checkhashes.ps1bin/checkurls.ps1lib/autoupdate.ps1lib/core.ps1lib/manifest.ps1test/Scoop-Manifest.Tests.ps1
Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review.
There was a problem hiding this comment.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to GitHub limitations.
🟡 Minor · Pass checkver custom matches to Test-VersionTemplate. · autoupdate.ps1:496-500
lib/autoupdate.ps1:496-500
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick winPass checkver custom matches to
Test-VersionTemplate.
bin/checkver.ps1passes named matches toInvoke-AutoUpdate, butTest-VersionTemplatebuilds substitutions without those matches. A raw$match<Key>token therefore remains unchanged, so AutoUpdate can replace the raw property or URL with the concreteautoupdatevalue instead of preserving the template. Pass the existing substitution table to the detector.Suggested fix
- $urlSource = if (Test-VersionTemplate $Manifest.url $Version) { $Manifest.url } else { $Manifest.autoupdate.url } + $urlSource = if (Test-VersionTemplate $Manifest.url $Version $Substitutions) { $Manifest.url } else { $Manifest.autoupdate.url } ... - $urlSource = if (Test-VersionTemplate $Manifest.architecture.$arch.url $Version) { $Manifest.architecture.$arch.url } else { arch_specific 'url' $Manifest.autoupdate $arch } + $urlSource = if (Test-VersionTemplate $Manifest.architecture.$arch.url $Version $Substitutions) { $Manifest.architecture.$arch.url } else { arch_specific 'url' $Manifest.autoupdate $arch } ... - if (Test-VersionTemplate $Manifest.$currentProperty $Version) { continue } + if (Test-VersionTemplate $Manifest.$currentProperty $Version $Substitutions) { continue } ... - if ($Manifest.architecture.$arch.$currentProperty -and ($Manifest.autoupdate.architecture.$arch.$currentProperty -or $Manifest.autoupdate.$currentProperty) -and !(Test-VersionTemplate $Manifest.architecture.$arch.$currentProperty $Version)) { + if ($Manifest.architecture.$arch.$currentProperty -and ($Manifest.autoupdate.architecture.$arch.$currentProperty -or $Manifest.autoupdate.$currentProperty) -and !(Test-VersionTemplate $Manifest.architecture.$arch.$currentProperty $Version $Substitutions)) { ... -function Test-VersionTemplate($Value, [String] $Version) { - $substitutions = Get-VersionSubstitution $Version - (ConvertTo-Json -InputObject (substitute $Value $substitutions) -Depth 5 -Compress) -ne (ConvertTo-Json -InputObject $Value -Depth 5 -Compress) +function Test-VersionTemplate($Value, [String] $Version, [Hashtable] $Substitutions) { + if ($null -eq $Substitutions) { + $Substitutions = Get-VersionSubstitution $Version + } + (ConvertTo-Json -InputObject (substitute $Value $Substitutions) -Depth 5 -Compress) -ne (ConvertTo-Json -InputObject $Value -Depth 5 -Compress) }
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Advanced
Run ID: 5e7d6877-19e5-4689-b57a-052591801332
📒 Files selected for processing (3)
lib/autoupdate.ps1lib/manifest.ps1test/Scoop-Manifest.Tests.ps1
🚧 Files skipped from review as they are similar to previous changes (2)
- test/Scoop-Manifest.Tests.ps1
- lib/autoupdate.ps1
Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review.
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to GitHub limitations.
🟠 Major · Allow version templates in main URLs. · manifest.ps1:120-136
lib/manifest.ps1:120-136
🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick winAllow version templates in main URLs.
schema.jsonrejects$in the mainurldefinition. The import-bucket validator parses each manifest file directly and validates it beforeGet-Manifestexpands$version. Manifests using the new URL template therefore fail the supported validation workflow.Remove the dollar-sign rejection from both
uriOrArrayOfUrisbranches.Suggested fix
"format": "uri", - "not": { - "pattern": "(\\$)" - }, "type": "string" ... "format": "uri", - "not": { - "pattern": "(\\$)" - }, "type": "string"
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Advanced
Run ID: c281b2c1-ac83-4614-bc81-e7a08ce5df06
📒 Files selected for processing (2)
lib/manifest.ps1test/Scoop-Manifest.Tests.ps1
🚧 Files skipped from review as they are similar to previous changes (2)
- test/Scoop-Manifest.Tests.ps1
- lib/manifest.ps1
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.
|
The actual download URL is autoupdate by |
|
Update: Back from vacation, I will try and update the PR this weekend |
# Conflicts: # lib/manifest.ps1 # test/Scoop-Manifest.Tests.ps1
| } | ||
| } | ||
|
|
||
| if (!$Raw) { $manifest = Expand-ManifestVariable $manifest } |
There was a problem hiding this comment.
Downloads still use literal templates
Get-Manifest expands version templates, but scoop update reads through manifest instead. Its download step requests the literal $version URL, so an app that installs with the new syntax cannot update. Version-pinned scoop download also reads generated manifests with parse_json, although this PR now preserves their URL templates. Expand manifests on these download paths too, while keeping autoupdate inputs raw.
| $_.Value = $_.Value.PSObject.Copy() | ||
| $_.Value.PSObject.Properties | ForEach-Object { $_.Value = Expand-ManifestVariable $_.Value $substitutions } | ||
| } else { | ||
| $_.Value = substitute $_.Value $substitutions |
There was a problem hiding this comment.
Single-entry arrays lose their shape
Applying substitute to every field changes single-entry nested arrays even without variables. For example, shortcuts: [["app.exe", "App"]] becomes ["app.exe", "App"]. The shortcut code then treats each string as a separate shortcut rather than one target/name pair. Single-entry bin aliases and persist mappings have the same problem.
This also makes Test-VersionTemplate mistake a one-item literal URL array for a template, leaving its old URL during autoupdate. Preserve array boundaries during expansion and template checks.
| } elseif ($Manifest.$currentProperty -and $Manifest.autoupdate.$currentProperty) { | ||
| # Update other property (global) | ||
| # Templated properties are expanded on read, keep them as-is | ||
| if (Test-VersionTemplate $Manifest.$currentProperty $Version) { continue } |
There was a problem hiding this comment.
Updates can mix release versions
Finding one template skips the entire property, including literal siblings that still need autoupdate. Given url: ["https://example.com/app-$version.zip", "https://example.com/helper-1.0.zip"], updating to 2.0 leaves the helper at 1.0 even when autoupdate.url supplies helper-$version.zip. The new hash branch then hashes that old helper too, so the manifest can silently install files from two releases. Preserve templates per array entry or object field, and update the remaining values from autoupdate.
Description
Scoop currently supports version substitution for
autoupdate.url. In my opinion it also valuable for other fields. Consider the abbreviated manifest:{ "homepage": "https://github.com/idleberg/my-app", "version": "1.2.3", "url": "https://github.com/idleberg/my-app/releases/download/v1.2.3/my-app-1.2.3-windows.zip", "autoupdate": { "url": "https://github.com/idleberg/dent-desktop/releases/download/v$version/my-app-$version-windows.zip" } }The version is specified at three places. Allowing the use of version substitution, editing a manifest is less prone to errors. So a manifest would only specify the version once:
{ "homepage": "https://github.com/idleberg/my-app", "version": "1.2.3", "url": "https://github.com/idleberg/my-app/releases/download/v$version/my-app-$version-windows.zip", "autoupdate": { "url": "https://github.com/idleberg/dent-desktop/releases/download/v$version/my-app-$version-windows.zip" } }Motivation and Context
It solves a personal problem, dealing with such matters is difficult for a neurodivergent person. Others might appreciate it to.
I have written PowerShell before and used an agent for assistance. I read all the code and made edits, the changes seems reasonable. If using AI is a deal-breaker, I understand – hence the full disclosure.
How Has This Been Tested?
Checklist:
developbranch.Fix the missing download expansion, single-entry array changes, and stale mixed properties before merging.
Findings
Summary
Adds version-variable expansion to manifest reads and URL checks. Autoupdate keeps template fields and hashes their expanded URLs.
Diagram
%%{init: {'theme': 'neutral'}}%% flowchart TD A[Raw manifest] --> B[Get-Manifest] B --> C[Expand version variables] C --> D[Install] A --> E[manifest or parse_json] E --> F[Update or pinned download] F --> G[Literal template URL] A --> H[Autoupdate] H --> I[Keep properties containing templates] I --> J[Literal siblings remain unchanged]Reviews (1) · Last reviewed commit: "Merge commit 'e6aa3b36' into feat/manife..." · Reviewed by Greptile