Skip to content

Omit excluded packages in target installed.json#250

Open
BrianHenryIE wants to merge 11 commits intomasterfrom
issue-249
Open

Omit excluded packages in target installed.json#250
BrianHenryIE wants to merge 11 commits intomasterfrom
issue-249

Conversation

@BrianHenryIE
Copy link
Owner

Fix #249

@gemini-code-assist
Copy link

Summary of Changes

Hello @BrianHenryIE, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request enhances the installed.json cleanup process by ensuring that packages explicitly marked for exclusion are no longer included in the prefixed installed.json file. This prevents warnings related to non-existent package directories for excluded dependencies and improves the accuracy of the generated installed.json for prefixed vendors.

Highlights

  • Installed JSON Cleanup: Excluded packages are now properly removed from the vendor-prefixed/composer/installed.json file, preventing unnecessary entries and potential warnings.
  • Issue Resolution: Addresses and resolves issue Package directory unexpectedly DOES NOT exist #249, which reported warnings due to unexpected package directories for excluded packages.
  • Test Coverage: A new integration test has been added to ensure that excluded packages are correctly omitted from the prefixed installed.json and that no related warnings are generated.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Changelog
  • src/Pipeline/Cleanup/InstalledJson.php
    • Implemented logic to remove packages from installed.json if they are in the exclude_from_copy list.
  • tests/Issues/StraussIssue249Test.php
    • Added a new integration test to verify that excluded packages are correctly omitted from the prefixed installed.json.
    • Ensured the test asserts the absence of the excluded package in the prefixed installed.json and the absence of related warnings.
Activity
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request aims to omit excluded packages from the target installed.json. The implementation correctly removes the packages from the target installed.json, and a new integration test verifies this behavior. However, the change introduces a potential issue where excluded packages would also be removed from the source vendor/composer/installed.json when package deletion is enabled, which is incorrect. I've suggested a fix to ensure packages are only removed from the target installed.json. Additionally, I've suggested renaming the new test method for clarity.

Comment on lines +128 to +131
if (in_array($package['name'], $this->config->getExcludePackagesFromCopy(), true)) {
unset($installedJsonArray['packages'][$key]);
continue;
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

This change correctly removes excluded packages, but it will do so for both the target installed.json and the source vendor/composer/installed.json (when delete_vendor_packages is enabled). Excluded packages should remain in the source vendor/composer/installed.json because they are not being moved or prefixed.

The removal should only happen when processing the installed.json for the target directory. You can achieve this by checking if the $path argument matches the target directory.

            if ($path === $this->config->getTargetDirectory() && in_array($package['name'], $this->config->getExcludePackagesFromCopy(), true)) {
                unset($installedJsonArray['packages'][$key]);
                continue;
            }

class StraussIssue249Test extends IntegrationTestCase
{

public function test_return_type_double_prefixed(): void

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The test method name test_return_type_double_prefixed does not seem to reflect what this test is verifying. The test checks that excluded packages are omitted from the target installed.json. A more descriptive name would improve maintainability. For example: test_excluded_packages_are_omitted_from_target_installed_json.

    public function test_excluded_packages_are_omitted_from_target_installed_json(): void

@github-actions
Copy link

github-actions bot commented Feb 19, 2026

Project Code Coverage
project coverage report 41% @ e83aa2f

Code Coverage

Generated: Fri, Feb 20, 2026, 7:24:50 UTC.

Lines Functions and Methods Classes and Traits
Total 🟧🟧🟧🟧🟧⬜⬜⬜⬜⬜ 58.26% (127 / 218) 🟥🟥🟥⬜⬜⬜⬜⬜⬜⬜ 36.36% (4 / 11) ⬜⬜⬜⬜⬜⬜⬜⬜⬜⬜ 0.00% (0 / 1)
InstalledJson.php 🟧🟧🟧🟧🟧⬜⬜⬜⬜⬜ 58.26% (127 / 218) 🟥🟥🟥⬜⬜⬜⬜⬜⬜⬜ 36.36% (4 / 11) ⬜⬜⬜⬜⬜⬜⬜⬜⬜⬜ 0.00% (0 / 1)

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.

Package directory unexpectedly DOES NOT exist

1 participant

Comments