-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
fix(core|manifest): Avoid error when searching non-existent 'deprecated' directory #6471
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Conversation
…'deprecated' directory
WalkthroughSuppresses errors when probing for a non-existent deprecated directory by adding -ErrorAction Ignore to filesystem lookups in core.ps1 and manifest.ps1; documents the change in CHANGELOG.md. No public APIs altered. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
actor User
participant ScoopCmd as Scoop Command
participant Core as core.ps1 (app_status)
participant FS as Filesystem
User->>ScoopCmd: info/list/update
ScoopCmd->>Core: app_status(app)
Core->>FS: Get-ChildItem deprecated/** (ErrorAction=Ignore)
alt deprecated entries found
FS-->>Core: Matches
Core-->>ScoopCmd: status with deprecated paths
else none or dir missing
FS-->>Core: No matches / suppressed errors
Core-->>ScoopCmd: status without deprecated paths
end
sequenceDiagram
autonumber
participant Cmd as Scoop Operation
participant Manifest as manifest.ps1 (Get-Manifest)
participant FS as Filesystem
Cmd->>Manifest: Get-Manifest(app)
alt manifest in bucket
Manifest->>FS: Resolve bucket manifest
FS-->>Manifest: Path
Manifest-->>Cmd: Parsed manifest
else not found
Manifest->>FS: Search deprecated/** (ErrorAction=Ignore)
alt found
FS-->>Manifest: Path
Manifest-->>Cmd: Parsed deprecated manifest
else missing
FS-->>Manifest: No matches / suppressed errors
Manifest-->>Cmd: Null/continue without error
end
end
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Assessment against linked issues
Poem
Tip 🔌 Remote MCP (Model Context Protocol) integration is now available!Pro plan users can now connect to remote MCP servers from the Integrations page. Connect with popular remote MCPs such as Notion and Linear to add more context to your reviews and chats. ✨ Finishing Touches🧪 Generate unit tests
🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. CodeRabbit Commands (Invoked using PR/Issue comments)Type Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
🧹 Nitpick comments (2)
lib/core.ps1 (1)
557-559
: Good suppression; optionally guard the probe and tighten the query.Pre-checking the path avoids a needless provider error, and -File ensures only files are returned. Join-Path improves portability/readability.
- $deprecated_dir = (Find-BucketDirectory -Name $install_info.bucket -Root) + "\deprecated" - $status.deprecated = (Get-ChildItem $deprecated_dir -Filter "$(sanitary_path $app).json" -Recurse -ErrorAction Ignore).FullName + $deprecated_dir = Join-Path (Find-BucketDirectory -Name $install_info.bucket -Root) 'deprecated' + $status.deprecated = if (Test-Path $deprecated_dir) { + Get-ChildItem -Path $deprecated_dir ` + -Filter "$(sanitary_path $app).json" -Recurse -File -ErrorAction Ignore ` + | Select-Object -ExpandProperty FullName + }lib/manifest.ps1 (1)
71-73
: Mirror the guard and pass a single path to parse_json.Avoids parsing with an array and skips probing when the folder is absent. Keeps error output suppressed.
- $manifest = manifest $app $bucket - if (!$manifest) { - $deprecated_dir = (Find-BucketDirectory -Name $bucket -Root) + '\deprecated' - $manifest = parse_json (Get-ChildItem $deprecated_dir -Filter "$(sanitary_path $app).json" -Recurse -ErrorAction Ignore).FullName - } + $manifest = manifest $app $bucket + if (!$manifest) { + $deprecated_dir = Join-Path (Find-BucketDirectory -Name $bucket -Root) 'deprecated' + $deprecated_manifest = if (Test-Path $deprecated_dir) { + Get-ChildItem -Path $deprecated_dir ` + -Filter "$(sanitary_path $app).json" -Recurse -File -ErrorAction Ignore ` + | Select-Object -First 1 -ExpandProperty FullName + } + $manifest = parse_json $deprecated_manifest + }If you want, I can draft a small Pester test ensuring:
- No errors are emitted when the bucket has been removed and only the deprecated lookup runs.
- Get-Manifest returns $null cleanly in that case.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
💡 Knowledge Base configuration:
- MCP integration is disabled by default for public repositories
- Jira integration is disabled by default for public repositories
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (3)
CHANGELOG.md
(1 hunks)lib/core.ps1
(1 hunks)lib/manifest.ps1
(1 hunks)
Motivation and Context
scoop-info|list|update
: Error attempting to access the 'deprecated' folder in deleted bucket #6467Even though the bucket of an installed app has been removed, Scoop will still try to access the 'deprecated' folder of this bucket.
Description
This PR makes the following changes:
Checklist:
develop
branch.Summary by CodeRabbit
Bug Fixes
Documentation