Skip to content

fix(composer): take each package's registry from composer.lock - #170

Merged
sweepies merged 3 commits into
mainfrom
feat/composer-origins
Nov 3, 2026
Merged

sweepies merged 3 commits into
mainfrom
feat/composer-origins

Conversation

@sweepies

@sweepies sweepies commented Nov 3, 2026 •

Copy link
Copy Markdown
Owner

Second per-ecosystem fix from the registry audit, after Bundler (#168). Composer looked every package up on Packagist, so a package from a private Composer repository could be looked up there, where its name may be someone else's.

Design

composer.json cannot say which repository holds a package: Composer asks each repository in order. So the Count does not predict it. It uses Composer's own record in composer.lock, through the shared crate::origins rule:

  • Each locked package's notification-url. Composer stamps it from the repository's notify-batch. Packagist's is https://packagist.org/downloads/, which I checked against a real composer update on boat.
    • Packagist's mark means Packagist.
    • Any other registry's mark fails the lookup, since private Composer repositories aren't read yet.
  • Path, VCS, inline package and artifact packages carry no mark and are listed as skipped.
  • A package the lock doesn't record comes from Packagist only when composer.json configures no repository besides Packagist and leaves Packagist on. Otherwise the lookup fails, asking for composer.lock to be committed.
  • Unreadable input fails every lookup. composer.json is read as strict JSON, as Composer reads it, so a file with comments counts as unreadable. A lock that isn't the expected shape counts the same.
  • composer.lock is always read when Composer is enabled, whatever files and exclude say.

Assumption: a private repository's packages don't carry Packagist's notification URL. A repository would have to advertise Packagist's notify-batch, which would also report every private install to packagist.org.

A stale lock is still resolved with the real composer.json in the update stage.

The ambiguous-lookup error now says "several registries" instead of "several indexes", since it covers gems and PHP packages too.

Docs: sources.md (package registries), managers.md, compatibility.md, departures.md.

View guided diff Turn on auto-fix

Composer read Packagist for every package, so a package from a private
Composer repository could be looked up on Packagist, where its name may be
someone else's. Each package now follows crate::origins:

- composer.lock decides: Composer marks a package from a Composer registry
  with that registry's notification-url. Packagist's mark means Packagist;
  another registry's fails the lookup until private Composer repositories
  are read. Path, VCS, inline and artifact packages carry no mark and are
  listed as skipped.
- A package the lock does not record comes from Packagist only when
  composer.json configures no other repository and leaves Packagist on.
- composer.json is read as strict JSON, as Composer reads it; one with
  comments, or a lock the Count cannot read, fails every lookup.

The ambiguous-lookup error now says "several registries", since it covers
gems and PHP packages as well as Python.
@deepsource-io

deepsource-io Bot commented Nov 3, 2026 •

Copy link
Copy Markdown

DeepSource Code Review

We reviewed changes in 4e5ccff...b7f89a0 on this pull request. Below is the summary for the review, and you can see the individual issues we found as inline review comments.

See full review on DeepSource ↗

PR Report Card

Overall Grade   Security  

Reliability  

Complexity  

Hygiene  

Code Review Summary

Analyzer Status Updated (UTC) Details
Rust Nov 3, 2026 11:45p.m. Review ↗
JavaScript Nov 3, 2026 11:45p.m. Review ↗
Shell Nov 3, 2026 11:45p.m. Review ↗

Important

AI Review is run only on demand for your team. We're only showing results of static analysis review right now. To trigger AI Review, comment @deepsourcebot review on this thread.

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Nov 3, 2026 •

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
count-patchula 716b77a Commit Preview URL

Branch Preview URL
Nov 03 2026, 11:37 PM

@context7

context7 Bot commented Nov 3, 2026 •

Copy link
Copy Markdown

Docs7 for sweepies/count-patchula

Result Status Action
Deployment ➖ Not used —
Content review ➖ Did not run. This site has no agent runs available this month. Wait for the monthly reset or check your Docs7 plan. —

Commit b7f89a0

- Inline package repositories' packages are skipped, whatever their data
  claims, and so are artifacts (a dist URL that is a local file).
- Packagist named with only, exclude or canonical counts as another
  repository, as do the merge plugin and a Composer plugin in the lock,
  since plugins can add repositories; unrecorded packages then fail.
- config.lock false ignores composer.lock, as Composer does.
- A null packages-dev, as composer update --no-dev writes, is no package.
- The manifest is matched by its file name, and the skip reason names
  every repository kind it covers.
Real Composer stamps every Packagist package with it, and the Count now
takes a package without one as not from Packagist.
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.

1 participant