mirror of
https://github.com/floci-io/floci.git
synced 2026-11-26 23:29:28 -05:00
storeVersion (the one write path storePackageVersionAsset/copyPackageVersionAsset/ storeRetainedVersionAsset all go through) always sent dist-tags.latest pointed at whichever version it was writing, so copying or retaining any other version, even an old one, silently moved what an unpinned npm install resolves to. Confirmed live against the pinned Verdaccio image that this was never actually needed: a PUT that omits dist-tags entirely leaves an existing package's own dist-tags.latest untouched, while a package's genuinely first-ever version still gets it set by Verdaccio's own default (there is nothing yet to preserve). So this write simply stops sending the field at all, rather than needing its own "is this the right version to call latest" decision. Corrected two test comments that had over-generalized this as "no retention write can ever suppress it" to the narrower, now-verified truth: only a package's very first-ever version is forced. Also confirmed live, specifically because CopyPackageVersions' own overwrite path deletes a conflicting version before recreating it (clearing dist-tags.latest if it pointed there): Verdaccio auto-recomputes latest from whatever versions remain once it's cleared, rather than leaving the package tagless, so this write's own change plays correctly with that existing delete-time behavior. Added a live regression test for exactly that interaction (overwriting the current latest version while a sibling version exists must neither lose latest nor wrongly hand it back to the version just overwritten).