Skip to content

Closes #1289: fix build-zip.sh failing on dev dependency restore - #1294

Merged
remyperona merged 2 commits into
developfrom
fix/1289-build-zip-composer-installer
Oct 21, 2026
Merged

remyperona merged 2 commits into
developfrom
fix/1289-build-zip-composer-installer

Conversation

@remyperona

@remyperona remyperona commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

Description

Closes #1289

bin/build-zip.sh builds the zip, then fails at its last step ("Restoring dev dependencies") with exit code 255. Because of that, the automation-plugin-version-manager (APVM) cannot finish an Imagify build, and its CI fails. The zip itself was never affected. Only the script's exit status was.

This PR caps mnsami/composer-custom-directory-installer (a dev-only dependency) at ^2.0 <2.3, which makes the script exit 0 again. PHP 7.4 resolves to 2.0.0, the only release that still supports it, and PHP 8.1+ resolves to 2.2.1.

Type of change

  • Bug fix (non-breaking change which fixes an issue).
  • New feature (non-breaking change which adds functionality).
  • Enhancement (non-breaking change which improves an existing functionality).
  • Breaking change (fix or feature that would cause existing functionality to not work as before).
  • Sub-task of #(issue number)
  • Chore
  • Release

Detailed scenario

What was tested

Manual tests, each in a fresh git clone (no composer.lock, no vendor/), Composer 2.7.7, PHP 8.2.30 unless the row says otherwise:

Scenario Strauss mnsami resolved Result
develop, with the local bin/strauss.phar from Jan 2026 0.26.3 2.3.0 exit 0 (the bug needs a recent Strauss)
develop, with Strauss downloaded fresh (as in the issue) 0.31.1 2.3.0 exit 255, TypeError (bug reproduced)
This branch, full ./bin/build-zip.sh 0.31.1 2.2.1 exit 0, imagify.zip built (3.1 MB, 1255 files)
This branch, composer install --no-dev then composer install, PHP 8.2.30 0.31.1 2.2.1 exit 0 / exit 0
This branch, composer install --no-dev then composer install, PHP 7.4.30 0.31.1 2.0.0 exit 0 / exit 0

How to test

  1. Clone the repo fresh and check out this branch. Make sure there is no bin/strauss.phar, so the latest Strauss gets downloaded.
  2. Run ./bin/build-zip.sh; echo "exit=$?".
  3. Expect exit=0 and generatedpackages/imagify.zip.
  4. To compare, do the same on develop: it ends with Script php bin/strauss.phar handling the prefix-namespaces event returned with error code 255.

Affected Features & Quality Assurance Scope

Only the build and dev tooling: composer install / composer update with dev dependencies, and bin/build-zip.sh. The shipped plugin is not affected, because the package is in require-dev and is not installed by --no-dev builds.

Technical description

Documentation

mnsami/composer-custom-directory-installer 2.3.0 changed the type hint on PackageUtils::getPackageInstallPath() from Composer\Composer to Composer\PartialComposer. Strauss 0.31.x, which the prefix-namespaces script downloads as latest, loads the installed Composer plugins through its own prefixed copy of Composer during its dump-autoload step. It passes in BrianHenryIE\Strauss\Composer\Composer, and that object fails the new type hint:

Fatal error: Uncaught TypeError: Composer\CustomDirectoryInstaller\PackageUtils::getPackageInstallPath():
Argument #2 ($composer) must be of type Composer\PartialComposer,
BrianHenryIE\Strauss\Composer\Composer given

So any fresh install that includes dev dependencies fails. In build-zip.sh, that is the final composer install. Versions 2.0.0–2.2.1 still type-hint Composer\Composer, which works with Strauss's instance. A plain ~2.2.1 pin is not enough: mnsami 2.1.0+ requires PHP >= 8.1, so it can't be installed on the PHP 7.4 legacy CI leg. ^2.0 <2.3 lets each PHP version pick a working release.

The line Class WPMedia\PluginFamily\PostInstall is not autoloadable from the issue is a separate, non-fatal warning. It appears in passing runs too, because Strauss has already prefixed wp-media/plugin-family in place when the second install runs. This PR does not change it.

New dependencies

None. This narrows an existing dev-dependency constraint from ^2.0 to ^2.0 <2.3.

Risks

  • The cap keeps us off mnsami 2.3.x until Strauss or mnsami fix the incompatibility. When we lift it, re-run the fresh-clone build with the latest Strauss.
  • Strauss is still downloaded as latest, so a future Strauss release could break the build in a different way. Pinning the Strauss version is a separate change.

Mandatory Checklist

Code validation

  • I validated all the Acceptance Criteria. If possible, provide screenshots or videos.
  • I triggered all changed lines of code at least once without new errors/warnings/notices.
  • I implemented built-in tests to cover the new/changed code.

Code style

  • I wrote a self-explanatory code about what it does.
  • I protected entry points against unexpected inputs.
  • I did not introduce unnecessary complexity.
  • Output messages (errors, notices, logs) are explicit enough for users to understand the issue and are actionnable.

Unticked items justification

There are no built-in tests because this changes only a Composer version constraint, with no PHP code. The check is the fresh-clone bin/build-zip.sh run described above.

Additional Checks

  • In the case of complex code, I wrote comments to explain it.
  • When possible, I prepared ways to observe the implemented system (logs, data, etc.)
  • I added error handling logic when using functions that could throw errors (HTTP/API request, filesystem, etc.)

🤖 Generated with Claude Code

mnsami/composer-custom-directory-installer 2.3.0 type-hints
PackageUtils::getPackageInstallPath() against Composer\PartialComposer.
Strauss 0.31.x (pulled as "latest" by the prefix-namespaces script) loads
installed Composer plugins through its own prefixed Composer, so it passes
BrianHenryIE\Strauss\Composer\Composer and the call fatals with a
TypeError. Any fresh install with dev dependencies then exits 255, which
breaks the final "restore dev dependencies" step of bin/build-zip.sh.

Pin to ~2.2.1, whose signature accepts the Strauss Composer instance.

Refs #1289

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@codacy-production

codacy-production Bot commented Oct 19, 2026 •

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Coverage ∅ diff coverage

Metric Results
Coverage variation Report missing for c706a951
Diff coverage ✅ ∅ diff coverage (50.00%)

View coverage diff in Codacy

Coverage variation details
Coverable lines Covered lines Coverage
Common ancestor commit (c706a95) Report Missing Report Missing Report Missing
Head commit (471c92a) 20546 1653 8.05%

Coverage variation is the difference between the coverage for the head and common ancestor commits of the pull request branch: <coverage of head commit> - <coverage of common ancestor commit>

Diff coverage details
Coverable lines Covered lines Diff coverage
Pull request (#1294) 0 0 ∅ (not applicable)

Diff coverage is the percentage of lines that are covered by tests out of the coverable lines that the pull request added or modified: <covered lines added or modified>/<coverable lines added or modified> * 100%

1 Codacy didn't receive coverage data for the commit, or there was an error processing the received data. Check your integration for errors and validate that your coverage setup is correct.

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

mnsami/composer-custom-directory-installer 2.1.0+ requires PHP >=8.1,
so the ~2.2.1 pin made dependencies unresolvable on the PHP 7.4 legacy
CI leg. Allow ^2.0 <2.3 instead: PHP 7.4 resolves 2.0.0 and PHP 8.1+
resolves 2.2.1, while 2.3.0 (incompatible with Strauss 0.31.x) stays
excluded.

Refs #1289

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@remyperona remyperona self-assigned this Oct 19, 2026
@remyperona
remyperona marked this pull request as ready for review October 21, 2026 18:52
@remyperona
remyperona added this pull request to the merge queue Oct 21, 2026
Merged via the queue into develop with commit 34da213 Oct 21, 2026
16 checks passed
@remyperona
remyperona deleted the fix/1289-build-zip-composer-installer branch October 21, 2026 18:52
@remyperona remyperona mentioned this pull request Oct 30, 2026
1 task done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bin/build-zip.sh script fails at the end of the process

1 participant