mirror of
https://github.com/floci-io/floci.git
synced 2026-11-22 21:50:46 -05:00
Repositories can already declare up to 10 same-domain upstream repositories via CreateRepository/UpdateRepository, but nothing ever consulted that list: a native package-manager request for a version missing locally 404ed even when an upstream had it, and CopyPackageVersions's includeFromUpstream flag was accepted on the wire but documented as a no-op. Adds a shared, cycle-safe breadth-first resolver over the upstreams graph (UpstreamRepositoryResolver), reused by validateUpstreams (now rejecting transitive cycles, not just direct self-reference, with an independent uncapped reachability check so a cycle whose closing edge sits beyond the resolution search cap still gets caught), by four new per-format importers (Maven/npm/pypi/NuGet) wired into each native controller's existing "local miss" hook, and by CopyPackageVersions's includeFromUpstream flag for both generic and container-backed formats. Widens the existing external-connection claim/fence/origin machinery with a RetentionOriginKind (EXTERNAL_CONNECTION vs UPSTREAM_REPOSITORY) so the same mechanism now also backs same-domain retention, and wires the previously unused INTERNAL_UPSTREAM package-group restriction type through isUpstreamRetentionBlocked the same way EXTERNAL_UPSTREAM already was. Each upstream-repository importer brackets every candidate it reads with the same beginUse/endUse lease DeleteRepository's own cleanup already respects, so a concurrent delete of a candidate can't race a read of it; resolves a version from its real staged byte count rather than an optional, sometimes -1 Content-Length header; and, for Maven, continues past a candidate whose own metadata names nothing eligible instead of stopping the whole search there, and allows SNAPSHOT versions through the metadata merge the same way the asset path already does. pypi's candidate selection also now checks for the exact requested filename, not just a version match, and never swallows a sidecar read failure silently. A generic version's upstream-origin claim is now cleared on delete, republish, or a later direct overwrite copy, so it never keeps reporting a stale source. npm's "treat a retained version as the package default" guard now also catches an upstream-repository claim, not just an external-connection one.