Skip to content

Conversation

@BinToss
Copy link

@BinToss BinToss commented Jun 20, 2025

Description

Prepend the name of the $bucketDir to Get-GitChangedFile's Include pattern to narrow the pattern to include only bucket manifests (i.e. include "./bucket/*.json" instead of "./**/*.json").

Previously, when $ENV:CI is $true, the "Manifest validates against the schema" test would test all changed JSON files in the repo (e.g. ".vscode/settings.json"). Get-GitChangedFile's Path parameter seemed to have been used to specify the bucket directory, but Get-GitChangedFile only uses it for finding a repo root.

Motivation and Context

Fixes #6394

How Has This Been Tested?

Local debug runs of "Scoop-Bucket.Tests.ps1" with $env:CI set to $true.
Additionally, . ./test/bin/test.ps1 succeeds locally in PowerShell 7.5.1 and Windows PowerShell 5.1.22621.4391

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
    • Fixes CI import-bucket behavior by tightening the file include pattern, improving test accuracy and CI reliability.
  • Tests
    • Restricts manifest discovery in CI to bucket-specific subpaths while leaving local test discovery unchanged.
  • Chores
    • Adds a new Bug Fixes entry to the top of the Unreleased changelog.

@BinToss
Copy link
Author

BinToss commented Jun 29, 2025

In the meantime, I'm patching it in my ci.yml. See BinToss/scoop-bucket@f1cc5a7

@coderabbitai
Copy link

coderabbitai bot commented Aug 29, 2025

Walkthrough

Restricts CI manifest discovery in test/Import-Bucket-Tests.ps1 to JSON files under the bucket subpath when env:CI is true, and adds an Unreleased Bug Fix entry to CHANGELOG.md noting the Include-pattern fix (commit 93b9bae).

Changes

Cohort / File(s) Summary of Changes
CI manifest selection logic
test/Import-Bucket-Tests.ps1
In CI (env:CI = $true) changed Get-GitChangedFile -Include from *.json to "$((Get-Item $bucketDir).Name)/*.json" so only JSON under the bucket subpath are returned; non-CI behavior unchanged.
Changelog updates
CHANGELOG.md
Added an Unreleased Bug Fix entry: "import-bucket-tests: fix Get-GitChangedFile Include pattern for CI" referencing commit 93b9bae and added top-level "Changelog" header and blank line.

Sequence Diagram(s)

sequenceDiagram
    autonumber
    actor CI as CI Runner
    participant Tests as Import-Bucket-Tests.ps1
    participant Git as Get-GitChangedFile

    CI->>Tests: Run tests (env:CI = true)
    note right of Tests: Determine changed manifests
    rect rgba(200,235,255,0.3)
    Tests->>Git: Get-GitChangedFile -Path $bucketDir\n-Include "$((Get-Item $bucketDir).Name)/*.json"\n-Commit $env:BHCommitHash
    Git-->>Tests: JSON files under bucket subpath
    end
    Tests->>Tests: Validate manifests against schema
    Tests-->>CI: Report results
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Assessment against linked issues

Objective Addressed Explanation
Limit CI schema test to package manifests only by scoping Include to bucket subpath (#6394)

Poem

I thump and tidy every trail,
CI hops neat without derail.
Only bucket manifests now play,
No stray JSON leads astray.
A carroted changelog lights the way. 🥕🐇


📜 Recent 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 926da30 and 0c5fe26.

📒 Files selected for processing (2)
  • CHANGELOG.md (2 hunks)
  • test/Import-Bucket-Tests.ps1 (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
  • test/Import-Bucket-Tests.ps1
  • CHANGELOG.md
✨ 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: 0

🧹 Nitpick comments (2)
CHANGELOG.md (1)

9-9: Changelog entry looks good; consider casing consistency.

Optional: other Bug Fixes entries often start with “Fix …”. If you want consistency, change “fix” → “Fix”.

- - **import-bucket-tests:** fix `Get-GitChangedFile` `Include` pattern for CI ([93b9bae](https://github.com/ScoopInstaller/Scoop/commit/93b9bae33a88ccde6590c4df3f589f47c58a527e))
+ - **import-bucket-tests:** Fix `Get-GitChangedFile` `Include` pattern for CI ([93b9bae](https://github.com/ScoopInstaller/Scoop/commit/93b9bae33a88ccde6590c4df3f589f47c58a527e))
test/Import-Bucket-Tests.ps1 (1)

19-19: Good fix: scopes to bucket JSONs in CI.

Prepending the bucket directory name to the Include pattern should stop non-manifest JSONs (e.g., .vscode/settings.json) from being validated in CI.

If manifests might live in subfolders in some buckets, consider also matching one nested level:

-            $manifestFiles = @(Get-GitChangedFile -Path $bucketDir -Include "$((Get-Item $bucketDir).Name)/*.json" -Commit $env:BHCommitHash)
+            $bucketName = (Split-Path -Leaf $bucketDir)
+            $manifestFiles = @(Get-GitChangedFile -Path $bucketDir -Include @("$bucketName/*.json", "$bucketName/*/*.json") -Commit $env:BHCommitHash)

Please confirm whether any official buckets place manifests in subdirectories. If not, keeping only "$bucketName/*.json" is fine and simplest.

📜 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 926da30.

📒 Files selected for processing (2)
  • CHANGELOG.md (1 hunks)
  • test/Import-Bucket-Tests.ps1 (1 hunks)

…for CI

Prepending the name of the `$bucketDir` to the `Get-GitChangedFile` `Include` pattern narrows the pattern to only include bucket manifests.
Previously, when `$ENV:CI` is `$true`, the "Manifest validates against the schema" test would test _all_ changed JSON files in the repo (e.g. ".vscode/settings.json").
`Get-GitChangedFile`'s `Path` parameter seemed to have been used to specify the bucket directory, but `Get-GitChangedFile` only uses it for finding a repo root.
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