Repository navigation
feat(cli): oa check --fetch warms the proxies; show what pulls a dependency in - #483
Merged
M0Rf30 merged 2 commits intoNov 13, 2026
Merged
Conversation
…ndency in On a fresh proxy every answer is unknown until the package manager has fetched each package once. --fetch requests each distinct package's metadata through the repository first (composer p2 documents, npm packuments), at most 8 at a time, so the proxies behind it, also through a group, fetch and cache it; a request that does not answer 200 is counted and reported, not fatal. The lockfile parsers record which locked packages require each dependency (composer "require", npm dependencies/optional/peer of the packages map with aliases resolved, lockfileVersion 1 "requires"). The table gets a REQUIRED BY column ((direct) when only the project requires it) and --format json a required_by list. The availability request now carries only package and version. The upgrade notes get a new Unreleased section: the openartifact#480 note had landed under 0.24.0, which it is not part of. Co-Authored-By: Claude Opus 5.5 <[email protected]>
M0Rf30
reviewed
Nov 13, 2026
M0Rf30
left a comment
Collaborator
There was a problem hiding this comment.
Reviewed the full diff; CI is green and it merges cleanly. Nothing blocking, a few things worth fixing:
(direct)claims more than it knows. It means "no locked package requires it": neithercomposer.jsonnor the rootpackage.jsondependencies are read. A package the project requires directly that another locked package also requires never shows(direct)(the fixture has this:acme/console→RequiredBy: [acme/test-runner]). Either reword the docs/help ("(direct)when the project requires it") or note the column can be incomplete.- Orphaned doc comment in
pkg/lockfile/npm.go: the old// npmV1 walks the dependency tree…lines now sit abovenpmV1Requirers, merged into its comment, andnpmV1has no doc comment. - Composer
dev-*versions:--fetchonly requestsp2/<name>.json, neverp2/<name>~dev.json, so a lockeddev-mainpackage staysunknownafter warming. - Test nits (
cmd_check_test.go):TestCheckRequiredBy:strings.Contains(body, "dev")fails on any package name containing "dev"; decode the body and check its keys instead.TestCheckFetch: thesrv2 := newCheckServer(...)block got split one argument per line by the formatter; plain statements would read better.
…v documents - REQUIRED BY shows "-" when no locked package requires a dependency. A lockfile does not record the project's own requirements, so "(direct)" claimed more than it knows; the help and docs say a dependency listed with requirers may be direct as well. - --fetch requests p2/<name>~dev.json for a locked Composer branch (dev-main, 1.x-dev), the document that lists it, so it no longer stays unknown after warming. - npmV1 has its doc comment back; it had merged into npmV1Requirers'. - Tests: the request body is decoded and its keys checked instead of a substring match, the REQUIRED BY cell is read by column, and metadataPath has its own table test. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Contributor
Author
|
Thanks for the review, all addressed in feac33c:
|
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.
Two things I ran into using
oa checkon a real Laravel project (132 locked packages, a fresh Packagist proxy behind a group).--fetchOn a fresh proxy every answer is
unknownuntil each package has been fetched once.--fetchfirst requests each distinct package's metadata through the repository, the way the package manager would:p2/<name>.json, or npm's packument (a scoped name as@scope%2fname).heldby the check.This doesn't change the server's rule that the availability check never asks the upstream: the warming goes through the normal serving path, on request.
"Required by"
A held indirect dependency didn't say where it came from. The parsers now record which locked packages require each dependency:
require; platform requirements never match a locked name.dependencies,optionalDependenciesandpeerDependenciesof the installed packages. An alias is looked up both by its folder (the key the requirer uses) and by the package it installs.requires, withnpm:aliases resolved.The table gets a
REQUIRED BYcolumn:(direct), or up to three names and "+N more".--format jsonaddsrequired_by. The availability request now carries onlypackageandversion; before, it also sentdev.Real run
getaways-agents, a fresh server built from this branch, a Packagist proxy (72 h minimum age, a block rule ondoctrine/cache) behind a group:The run took 2.8 s; exit status 1. The one non-200 was
doctrine/cache(404, every version curated).Also: upgrade notes
The note from #480 had landed under 0.24.0, but #480 merged after the release and isn't in it (the released
upgrading.mddoesn't contain it). This PR adds an Unreleased section and moves that note there, next to this PR's note.Tests
pkg/lockfile:RequiredBycovers a shared dependency, a dev dependency, an npm peer, an npm alias (folder vs. package name) and v1 aliases;Each fuzzer ran 15 s.
oa checkagainst a fake server:TestCheckRequiredBy: the column,(direct), the JSON field, and a request body withoutrequired_byordev;TestCheckFetch: a GET per distinct package before the check, the failure count, no GET without--fetch, and npm scoped paths.Checks
golangci-lint run ./...passes.go test -short -racepasses forinternal/oacli,pkg/lockfileandtests/.make docs-check(CLI reference regenerated) andmake deadcodepass.🤖 Generated with Claude Code