Skip to content

Conversation

z-Fng
Copy link

@z-Fng z-Fng commented Aug 28, 2025

Motivation and Context

Even 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:

  • fix(core|manifest): Avoid error messages when searching non-existent 'deprecated' directory.

Checklist:

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

Summary by CodeRabbit

  • Bug Fixes

    • Eliminates noisy error messages when checking for a non-existent deprecated directory during app status and manifest lookups.
    • Prevents interruptions when deprecated manifests are missing, resulting in cleaner output and smoother workflows.
  • Documentation

    • Updated changelog to note the fix for suppressed errors when searching a non-existent deprecated directory.

Copy link

coderabbitai bot commented Aug 28, 2025

Walkthrough

Suppresses 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

Cohort / File(s) Summary
Docs: Changelog entry
CHANGELOG.md
Added Unreleased note documenting suppressed errors when searching missing deprecated directory.
Deprecated directory error suppression (core)
lib/core.ps1
In app_status, recursive Get-ChildItem for deprecated entries now uses -ErrorAction Ignore to avoid non-terminating errors.
Deprecated directory error suppression (manifest)
lib/manifest.ps1
In Get-Manifest fallback to deprecated path, Get-ChildItem now uses -ErrorAction Ignore to avoid errors when files/dir are absent.

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
Loading
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
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Assessment against linked issues

Objective Addressed Explanation
Suppress errors when accessing missing deprecated folder for info/list/update flows (#6467)
Ensure manifest lookup tolerates absent deprecated files when bucket is removed (#6467)
Avoid emitting error messages during recursive search in deprecated directory (#6467)

Poem

I hop through buckets, quiet as night,
No squeaks from “deprecated” in my sight.
With gentle paws, I toggle Ignore,
Errors hush—no clatter, no roar.
Now lists and infos glide with grace—
A tidy warren, a peaceful place. 🐇✨

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
  • Create PR with unit tests
  • Post copyable unit tests in a comment

🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbit in a new review comment at the desired location with your query.
  • PR comments: Tag @coderabbit in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbit gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbit read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR/Issue comments)

Type @coderabbit help to get the list of available commands.

Other keywords and placeholders

  • Add @coderabbit ignore or @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbit summary or @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbit or @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

@coderabbitai coderabbitai bot left a 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.

📥 Commits

Reviewing files that changed from the base of the PR and between 04b7ce7 and d28d460.

📒 Files selected for processing (3)
  • CHANGELOG.md (1 hunks)
  • lib/core.ps1 (1 hunks)
  • lib/manifest.ps1 (1 hunks)

@z-Fng z-Fng changed the title fix(core|manifest): Avoid error messages when searching non-existent 'deprecated' directory fix(core|manifest): Avoid error when searching non-existent 'deprecated' directory Aug 29, 2025
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