Own the autoload map through ComposerAutoloadMapReader - #641
Merged
Merged
Conversation
A single service now reads the Composer autoload map and re-reads it on vendor/composer changes. Both disk backends hold the reader instead of a snapshot and rebuild their derived indexes when the map instance changes, so a composer install reaches lookup, enumeration and search on the next query rather than being trapped in a map copied at boot. The invalidation composite routes vendor/composer paths past the maps cache decorator's per-path accounting through a wholesale flush, since every remembered lookup can point at pre-install data. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #641 +/- ##
=========================================
Coverage 99.65% 99.65%
- Complexity 1901 1913 +12
=========================================
Files 133 134 +1
Lines 4905 4940 +35
=========================================
+ Hits 4888 4923 +35
Misses 17 17 ☔ View full report in Codecov by Harness. |
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Firehed
marked this pull request as ready for review
September 26, 2026 17:02
Adds unit tests for the flush() method on the maps cache decorator, the composer-file branch of the invalidation composite, and the map-change branch of ComposerMapBackend's invalidate. Integration coverage stays, but those tests are #[CoversNothing] so their execution did not attribute line coverage to the classes under test. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
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.
Summary
One service now owns reading the Composer autoload map.
ComposerAutoloadMapReaderreads the map on first use and re-reads it when any file undervendor/composer/changes — the one invalidatable for that path.Both disk backends (
AutoloadFilesBackendandComposerMapBackend) hold the reader instead of a map snapshot and rebuild their derived indexes when the map instance changes.Previously, the map was read once at boot into a value passed by construction to both backends, and a
composer installthat regenerated the autoload files could not reach either backend's derived state.Now a regeneration reaches lookup, enumeration and search on the next query.
The invalidation composite routes
vendor/composer/paths through a wholesale flush of the maps cache decorator, since its per-path accounting cannot describe the blast radius of a whole-map change.Test plan
composer test(phpstan, deptrac, phpunit, phpcs) greenComposerAutoloadMapReadercover current/invalidate/fromMap and the vendor/composer prefix matchautoload_psr4.phpandautoload_files.phpeach reach both lookup and enumeration on the next query🤖 Generated with Claude Code