aboutsummaryrefslogtreecommitdiffhomepage
path: root/crates/mozart-registry/src/repository
diff options
context:
space:
mode:
authornsfisis <nsfisis@gmail.com>2026-05-02 17:01:54 +0900
committernsfisis <nsfisis@gmail.com>2026-05-02 17:01:54 +0900
commit5b767cdd832d39816ee4c2dbf94274c0130dd572 (patch)
treeafee502ede75fc561da807652c9f472fc1554ff5 /crates/mozart-registry/src/repository
parentc1733d88510b7afb88f7a17849de514365e42c84 (diff)
downloadphp-mozart-5b767cdd832d39816ee4c2dbf94274c0130dd572.tar.gz
php-mozart-5b767cdd832d39816ee4c2dbf94274c0130dd572.tar.zst
php-mozart-5b767cdd832d39816ee4c2dbf94274c0130dd572.zip
refactor(registry): route Packagist queries through RepositorySet
Replace direct packagist::fetch_package_versions calls in resolver::resolve (seed + transitive loops) and lockfile::generate_lock_file with repo_set.load_packages calls. PackagistRepository now propagates errors instead of swallowing them, so the seed loop's strictness and the transitive loop's local-leniency are both preserved exactly. VCS and inline-package repositories are still preloaded directly into the pool builder for now, with their names tracked in skip lists so we don't double-load them through the trait. Migrating them through RepositorySet is a follow-up - vcs_to_pool_inputs and packagist_to_pool_inputs differ in dev-branch handling that needs to be unified first. All 136 enabled installer fixtures + 114 mozart-registry tests + 541 mozart lib tests remain green; clippy clean. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Diffstat (limited to 'crates/mozart-registry/src/repository')
-rw-r--r--crates/mozart-registry/src/repository/packagist_repo.rs24
1 files changed, 12 insertions, 12 deletions
diff --git a/crates/mozart-registry/src/repository/packagist_repo.rs b/crates/mozart-registry/src/repository/packagist_repo.rs
index 17208c1..a3bbf40 100644
--- a/crates/mozart-registry/src/repository/packagist_repo.rs
+++ b/crates/mozart-registry/src/repository/packagist_repo.rs
@@ -32,19 +32,19 @@ impl Repository for PackagistRepository {
async fn load_packages(&self, queries: &[PackageQuery<'_>]) -> anyhow::Result<LoadResult> {
let mut result = LoadResult::default();
for query in queries {
- // Mirror the existing transitive-loop tolerance: a 404 / network
- // failure for one name is not fatal — it just means this repo
- // contributes nothing for that name. `RepositorySet` falls
- // through, and the solver fails later if no repo knows it.
+ // Errors propagate to the caller. Composer's
+ // `ComposerRepository::loadAsyncPackages` distinguishes 404
+ // (empty result, no error) from transport failures (exception);
+ // Mozart's underlying `fetch_package_versions` doesn't yet make
+ // that distinction, so for now both surface as `Err` and the
+ // caller decides whether the loop wants to continue (transitive
+ // exploration) or abort (seed-time fetch failure).
let versions =
- match packagist::fetch_package_versions(query.name, &self.cache).await {
- Ok(v) => v,
- Err(_) => continue,
- };
- // `fetch_package_versions` returning Ok counts as "this repo
- // authoritatively knows the name", even if the version list is
- // empty (matches Composer `ArrayRepository::loadPackages` which
- // adds the name to `namesFound` regardless of constraint match).
+ packagist::fetch_package_versions(query.name, &self.cache).await?;
+ // A successful fetch counts as "this repo authoritatively knows
+ // the name", even if the version list is empty — mirrors
+ // Composer's `ArrayRepository::loadPackages` which adds the
+ // name to `namesFound` regardless of constraint match.
result.names_found.push(query.name.to_string());
for version in versions {
result.packages.push(NamedPackagistVersion {