fix(composer-update): name dev-locked intermediates so the chain can move - #50
Merged
Merged
Conversation
…move find_direct_ancestors walked from a flagged transitive up to its direct-dep ancestor and returned only that ancestor. Any package crossed on the way was traversed and discarded — including packages locked to a dev-* reference. Composer will not move a dev-locked package during a partial update unless it is named explicitly. So when the flagged package sits under one, listing only the direct dep leaves the dev-locked intermediate pinned at its recorded commit and the whole update fails on a conflict that names neither package. maptilat hit exactly this. composer/composer was flagged for CVE-2026-59946; its direct ancestor is wp-cli/wp-cli-bundle; but the intermediate wp-cli/wp-cli sat on dev-main, so every attempt died with: wp-cli/wp-cli dev-main requires wp-cli/php-cli-tools ~0.13.0 -> found wp-cli/php-cli-tools[v0.13.0] but these were not loaded, likely because it conflicts with another require. The scanner reported the CVE daily for weeks with no fixable PR to offer, because the widen step could never resolve. Naming wp-cli/wp-cli fixed it by hand; this makes that automatic. update.sh now precomputes the dev-locked set from composer.lock into /tmp/composer-update-devlocked.txt, and find_direct_ancestors emits any intermediate found in it. The intermediate is NOT terminal — the walk still continues to the direct dep, which is also needed. The target itself is never emitted (build_pkg_arg already supplies it, with its constraint). Behaviour is unchanged when the file is absent or empty, so a plain dependency-update run is unaffected. Same family as the roots/wordpress-no-content self.version case already documented in expand_args_for: the arg list has to name every package that must be free to move. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
oxyc
pushed a commit
that referenced
this pull request
Jul 30, 2026
This branch carried
uses: generoi/github-actions/setup@perf/npm-no-audit
which is #53's verification branch, picked up from master when this branch was
cut. #53 has since merged, so the ref is both unnecessary and wrong: leaving it
would point every consumer of the shared test workflow at a feature branch
instead of the release tag.
Restored from master. Nothing else in this branch touches test.yml — the actual
change here is confined to composer-update/tests/lib.sh.
master and the v1/v2 tags were checked and both already carry @v1, so this
never reached downstream.
Second instance of this pattern; the first was a "tmp: point internal setup ref
at this branch for verification" commit carrying setup@fix/drop-vendor-cache,
caught and reverted before #50 was opened.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
oxyc
added a commit
that referenced
this pull request
Jul 30, 2026
* perf(setup): disable npm audit and fund in CI
npm install is the largest remaining cost in these jobs, and it is almost
entirely the audit — a network round trip over the whole dependency tree on
every run, even when node_modules was restored intact:
snellmanrecipes up to date, audited 1716 packages in 48s
beamex up to date, audited 1880 packages in 60s
kaskipuu up to date, audited 1930 packages in 1m
Locally on a 1250-package tree: 9s with audit, 1s without.
Set via npm config rather than CLI flags so it covers every npm invocation,
including the ones inside projects' composer build scripts, which is where
these installs actually happen.
Dependency vulnerabilities are covered by the nightly vulnerability scan, which
gates and opens PRs. npm's install-time audit summary gates nothing.
The internal setup ref is temporarily pointed at this branch to verify; that is
reverted before merge.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
* fix(tests): verify the semver cache works, not just that it exists
Three of six composer-update test files were red on master. All three had the
same cause, and none of the symptoms pointed at it.
ensure_semver_vendor caches a composer/semver vendor dir and guarded it with
if [ ! -f "$cache/vendor/autoload.php" ]; then ... build ... fi
Existence is too weak. An interrupted `composer require` leaves autoload.php
and vendor/composer/ behind WITHOUT vendor/composer/ClassLoader.php — the local
cache here had exactly that shape, with composer/semver present but the
autoloader's own class file missing. The guard was satisfied, so the cache was
never rebuilt: every run copied a broken autoloader into the test project, the
PHP helpers fatally errored on the missing ClassLoader, and their non-JSON
output reached jq as
jq: parse error: Invalid numeric literal at line 2, column 8
which reads like a bug in the helper's JSON, not a missing dependency. The
partial cache is also sticky — once in that state it stays broken across every
future run.
Now the guard actually exercises the cache: require the autoloader and check
Composer\Semver\Semver resolves. If it does not, the cache is deleted and
rebuilt from scratch rather than built on top of a partial tree, and the
loud-failure path reports a *working* bootstrap could not be produced.
Suite goes from 3 of 6 files failing to 6 of 6 passing, with no change to any
assertion or to the scripts under test.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
* fix(ci): restore setup@v1 — the temporary ref belonged to #53
This branch carried
uses: generoi/github-actions/setup@perf/npm-no-audit
which is #53's verification branch, picked up from master when this branch was
cut. #53 has since merged, so the ref is both unnecessary and wrong: leaving it
would point every consumer of the shared test workflow at a feature branch
instead of the release tag.
Restored from master. Nothing else in this branch touches test.yml — the actual
change here is confined to composer-update/tests/lib.sh.
master and the v1/v2 tags were checked and both already carry @v1, so this
never reached downstream.
Second instance of this pattern; the first was a "tmp: point internal setup ref
at this branch for verification" commit carrying setup@fix/drop-vendor-cache,
caught and reverted before #50 was opened.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: test <test@example.com>
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
Co-authored-by: genero-bot <dev@genero.fi>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The gap
find_direct_ancestorswalks from a flagged transitive up to its direct-dep ancestor and returns only that ancestor. Anything crossed on the way is traversed and thrown away — including packages locked to adev-*reference.Composer will not move a dev-locked package during a partial update unless it is named explicitly. So when the flagged package sits underneath one, listing only the direct dep leaves the intermediate pinned at its recorded commit, and the update fails on a conflict that names neither package.
Where it bit
maptilat.composer/composerwas flagged for CVE-2026-59946. Its direct ancestor iswp-cli/wp-cli-bundle, so the scanner ran:But the intermediate
wp-cli/wp-clisat ondev-mainand wasn't listed, so it stayed pinned:The scan failed on this every day for weeks with no fixable PR to offer — the widen step could never resolve. Adding
wp-cli/wp-clito the arg list fixed it immediately when done by hand (generoi/maptilat#52). This makes that automatic.The change
update.shprecomputes the dev-locked set fromcomposer.lock:find_direct_ancestorsemits any intermediate found in it. Two details that matter:build_pkg_argalready supplies it, with its min-safe constraint attached.Behaviour is unchanged when the file is absent or empty, so plain dependency-update runs (no
vulns_json) are unaffected.Same family as the
roots/wordpress-no-contentself.versioncase already documented inexpand_args_for: the arg list has to name every package that must be free to move.Tests
Four new assertions in
lib-functions.test.sh, modelling the maptilat topology exactly:Note on the suite
composer-update/tests/run.shreports 3 of 6 files failing both with and without this change — I verified against cleanmaster. Those are pre-existing (jq: parse errorand avendor/composer/ClassLoader.phpbootstrap failure in the semver helper tests), unrelated to this, and I have not touched them.lib-functions.test.shpasses in full.🤖 Generated with Claude Code