Skip to content

Conversation

@z-Fng
Copy link
Member

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

Description

Motivation and Context

Closes

The scoop download command has the following problems

  1. Download incorrectly marked as successful despite hash mismatch.
  2. If the previous download fails, all subsequent successful download prompts will not be displayed.
  3. Duplicate downloads of the same app.

changes

This PR makes the following changes:

  • fix(scoop-download):
    • Fix download success prompt.
    • Prevent duplicate downloads.

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

  • New Features

    • More accurate per-app success reporting by tracking download/hash failures and suppressing misleading success messages.
  • Bug Fixes

    • Prevents duplicate downloads by deduplicating app inputs.
    • Stops attempting remaining sources after the first hash-check failure for an app, avoiding false positives.
    • Preserves existing error logs and cache cleanup behavior for failed downloads or hash issues.

@coderabbitai
Copy link

coderabbitai bot commented Aug 31, 2025

Walkthrough

Deduplicates app list, introduces a labeled outer loop for per-app control flow, adds a per-app download-failure flag, and changes hash-check failure handling to skip remaining URLs for the current app. Success messages are now gated by the per-app failure flag. Existing error handling remains unchanged.

Changes

Cohort / File(s) Summary
Download flow updates
libexec/scoop-download.ps1
- Add Select-Object -Unique to dedupe $apps
- Label outer per-app loop (app_loop) and use continue app_loop on inner failures
- Introduce $dl_failure to track per-app failures and gate success message
- On first hash-check failure, skip remaining URLs for that app
- Preserve existing error logging/cache purge/SF.net warning behavior

Sequence Diagram(s)

sequenceDiagram
  autonumber
  actor User
  participant SD as scoop-download.ps1
  participant Repo as URL(s)
  participant Cache as Cache/Hasher

  User->>SD: Invoke with app list
  SD->>SD: Deduplicate apps
  loop For each app (app_loop)
    SD->>Repo: Try URL 1..N (download)
    alt Download fails
      SD->>SD: Set dl_failure = true
      SD-->>SD: continue app_loop
    else Download succeeds
      SD->>Cache: Hash check
      alt Hash mismatch/error
        SD->>Cache: Purge invalid cache
        SD->>SD: Log hash error / SF.net warning
        SD-->>SD: continue app_loop
      else Hash OK
        SD->>SD: Mark success for app
      end
    end
    SD->>User: If no dl_failure, print per-app success
  end
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

I thump my paw at tidy loops,
One hop per app—no duped groups.
If hashes sour, I bounce away,
To greener URLs without delay.
Success I nibble, failures I stash—
A prudent bunny, quick to hash. 🐇✨

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 @coderabbitai in a new review comment at the desired location with your query.
  • PR comments: Tag @coderabbitai 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:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai 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 @coderabbitai help to get the list of available commands.

Other keywords and placeholders

  • Add @coderabbitai ignore or @coderabbit ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @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: 3

🧹 Nitpick comments (1)
libexec/scoop-download.ps1 (1)

60-60: Loop label is unnecessary with the proposed inner-loop control.

If you stop using continue app_loop (see suggestions below), drop the label for clarity.

-:app_loop foreach ($curr_app in $apps) {
+foreach ($curr_app in $apps) {
📜 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
  • Linear integration is disabled

You can enable these sources in your CodeRabbit configuration.

📥 Commits

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

📒 Files selected for processing (1)
  • libexec/scoop-download.ps1 (4 hunks)

@z-Fng z-Fng marked this pull request as draft November 5, 2025 08:41
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