Skip to content

Implement update strategy for path-type initial packages in Installer#19

Merged
roble merged 3 commits into
mainfrom
dev
Jun 7, 2026
Merged

Implement update strategy for path-type initial packages in Installer#19
roble merged 3 commits into
mainfrom
dev

Conversation

@roble

@roble roble commented Jun 7, 2026

Copy link
Copy Markdown
Collaborator

This pull request improves the handling of package updates in the installer, specifically addressing scenarios where the initial package is of type path. The main change ensures that when upgrading from a path-type package, the installer properly manages repository tracking without attempting to re-download files that may not exist. Additionally, comprehensive tests are added to verify the new behavior and to ensure correct delegation logic.

Installer logic improvements:

  • Updated the update() method in Installer.php to manually track repository changes when the initial package is of type path, avoiding unnecessary downloads and ensuring correct package removal and addition in the repository.

Test coverage enhancements:

  • Added downloadBaseInvoked and delegateRepoTrackingInvoked flags to TestableInstaller in ModuleInstallerTest.php to verify whether download and delegation methods are called during updates.
  • Added test_update_skips_base_download_and_delegates_repo_manually_when_initial_is_path_type to confirm that updating from a path package skips the download and manually manages repository tracking.
  • Added test_update_downloads_base_and_delegates_repo_to_parent_when_initial_is_not_path_type to confirm that for non-path packages, the base download and parent repository tracking are invoked as expected.

Copilot AI review requested due to automatic review settings June 7, 2026 16:41
@roble roble merged commit 7f6e273 into main Jun 7, 2026
3 checks passed

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR adjusts Installer::update() to correctly handle upgrades where the currently installed package ($initial) has distType === 'path', avoiding Composer’s PathDownloader against an old path source that may no longer exist, and adds targeted tests to verify the new branching behavior.

Changes:

  • Add a success-path guard in Installer::update() to manually update the installed repository when upgrading from a path dist-type package (skipping parent::update() repo tracking delegation).
  • Extend TestableInstaller with invocation flags to assert whether base-download and repo-tracking delegation paths are used.
  • Add two unit tests covering the “initial is path” vs “initial is not path” update flows.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
src/Installer.php Adds manual installed-repo tracking when upgrading from distType=path to avoid invoking PathDownloader via parent::update().
tests/ModuleInstallerTest.php Adds invocation flags and two tests to assert the correct update branch behavior for path vs non-path initial packages.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

// update() merge-strategy guard for path-type initial packages
// -------------------------------------------------------------------------

public function test_update_skips_base_download_and_delegates_repo_manually_when_initial_is_path_type(): void
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.

2 participants