24. The npm packument is derived, dist-tags are pointers, and virtual repositories do not merge
Context
npm is the third adapter. Its per-package metadata document, the packument, changes on every publish, and its dist-tags move. OCI and PyPI have nothing like it. The core was also built around the first two protocols in ways npm breaks: package names fold PEP 503 style, and download links are root-relative.
Client behaviour below was captured from npm 10.9.9 on Node 22 against a logging server. pnpm and yarn were not captured; the M9 gate covers them.
Decision
The packument is derived from rows on each read, and never stored. It cannot drift from
what is placed, and dist.* is always Sindri’s. One response serves both the full and the
abbreviated Accept types; npm accepted it for both.
A version’s manifest comes from the tarball, not the request. At publish Sindri reads
package/package.json from the tarball and keeps it in files.metadata, with the computed
integrity and shasum. The publish body’s versions entry only has to agree on name
and version; if it disagrees, the publish gets a 400. Every other client field is ignored,
so what the packument says is what the tarball holds, and manifest confusion has nowhere to
start. Sindri parses tarballs with its own strict grammar, which accepts the forms npm pack
and tar-stream write and refuses the rest, because a second parser that disagrees with an
installer is how manifest confusion returns. A filename with a colon, or ending in a dot or a
space, is refused at publish, since Windows reads it differently, and so is any other spelling
of package.json at depth one or less, in any case or as the NTFS short name PACKAG~1.JSO.
The manifest is stored in jsonb, so publish also refuses nesting past 64 levels, a number
longer than 1000 bytes, and an exponent past ±64. jsonb writes out every digit on read, so
1e1000 would be small to publish and large in every packument after it.
Integrity is checked at write time, and client values never reach a reader. A body
carries one version and one attachment. Sindri hashes the decoded bytes before cas.Put. A
declared dist.integrity or dist.shasum that disagrees is refused and nothing is stored
or placed. A correct one is discarded like any other client value. The blob key stays
sha256. The filename is built from name and version, because the client’s attachment key
contains a slash (@acme/ui-1.0.0.tgz) and its dist.tarball is its own guess. The body is
streamed under PyPI’s 512 MiB bound.
A published version is immutable, even for identical bytes. InsertFileImmutable
treats identical bytes as a no-op, which is right for PyPI but not here, so the publish
transaction refuses any version that exists. The answer is a 409 with an error field,
which npm prints as E409. registry.Publish refuses an npm publish without
ExclusiveVersion, so no caller can opt out.
Dist-tags are pointers to versions, outside the identity model.
dist_tags(package_id, tag, version_id) cascades from both parents. A dist-tag is not a
placement and not a GC root: the files row already is both, and I2 and GC do not change.
It is not a subject and not a lifecycle event, so promotion (I3) does not see it. The
subject is the tarball’s digest, with a new kind npm-tarball.
Tag moves are recorded. Moving latest changes what a plain install gets, so each
change appends to dist_tag_events (repository, package, tag, from and to version, actor,
time). The table is append-only by trigger, and holds no foreign key to the package or
version, so it outlives a delete. A package always has a latest: the first publish sets
it whatever --tag says, npm dist-tag rm latest is refused, and if latest’s version is
deleted, the packument reports the highest non-prerelease version, or the highest prerelease
if that is all there is, until someone sets a tag. DeleteRepository writes no events: its
tags cascade away unrecorded, and the repository’s earlier events remain.
npm deprecate writes one field. The client GETs the packument with ?write=true and
PUTs the whole document back without _attachments, sending deprecated: "" to clear. A
PUT with no attachments therefore reads only versions[*].deprecated, into a new nullable
versions.deprecated. Only "" clears: a listed version whose field is absent or null stays
as it is, so a client holding a stale document cannot erase a message someone added since. An
unknown version is refused, a message with a control character is a 400, and everything else
in the body, dist-tags and dist included, is ignored. It is not recorded, because it cannot
change which bytes an install resolves.
npm names key exactly. normalizePackageName folds @acme/ui to acmeui and merges
foo.bar with foo_bar. Those are different npm packages, so one could take over the
other’s claim. Normalization becomes per protocol. The npm key is the full name, scope
included. Hosted publishes refuse uppercase. Claim lookups compare in lowercase, so a hosted
jsonstream also claims a legacy upstream JSONStream; that over-claims in the safe
direction.
A hosted scope is claimed by its rows. A hosted repository holding any @acme/* name
claims every @acme/* name. The name-claim rule in ARCHITECTURE.md section 4 otherwise
applies unchanged, and claimOwner and walkMembers already have the right shape.
A virtual repository does not merge packuments. The first member that has the package
supplies the whole document, as I5 and PyPI’s ListPyPIFiles already work. A claimed name
never contacts a proxy. Merging is what the roadmap’s warning describes, and removing it
removes the bug rather than guarding against it. This overrides the roadmap’s “merging
packuments across members”.
Proxy packuments are cached as upstream sent them and rewritten per read. They live
under the existing ttl. Each read rewrites dist.tarball to the repository the client
asked for, including a virtual one, so installs stay behind auth.Authorize and placement.
Upstream dist.integrity is verified when a tarball is cached. (Amended in M9 when the
proxy was built; the paragraphs below say what “as upstream sent them” came to.)
A proxy asks for the whole document. (Amended in v1.1.1, SIN-60; M9 asked for the
abbreviated form and rejected this.) Sindri sends Accept: application/json, so the cached
document carries upstream’s time map and readme, and passes time through unchanged.
npm install --before, pnpm’s release-age setting and yarn 4’s npmMinimalAgeGate all read
time, and yarn 4 refuses every version it cannot date. The abbreviated form made all
three fail through a proxy. The costs, accepted:
- Upstream traffic. Every refresh downloads the whole document. Measured on
2026-11-05, full against abbreviated:
typescript15.9 MB against 8.8 MB,@types/node11.2 MB against 2.3 MB,next31.5 MB against 25.7 MB,aws-sdk10.6 MB against 3.8 MB. - Parsing. Each refresh parses the larger document, and each read rewrites it. The largest real document is well inside the 128 MiB read bound.
- Larger responses to clients. A client of a proxy gets the whole document, since one
document answers every
Accepttype. Clients of a hosted repository are unaffected. - Cache size. The cached document is that much larger, per package, under the
existing
ttl.
It restores “as upstream sent them” to its plain meaning, with two exceptions the rewrite
drops: the top-level _attachments, which is a publish payload and can carry tarball bytes,
and each version’s _resolved, which names upstream’s own tarball URL and would point a
client past Sindri. A document upstream sends with no time stays without one: Sindri
never invents a timestamp.
Hosted packuments carry time, and only real times. versions.published_at is set by
the column default when a version is inserted, and migration 00011 adds it as nullable.
Each version’s entry is that time, written as npm does, in UTC with milliseconds.
created and modified are the earliest and latest of those. A version with no time is
left out of the map, and a package with none has no time at all. There is no backfill:
versions published before 1.1.1 have no recorded time, the migration leaves them NULL, and
a guess would be an invented timestamp. Yarn 4.18.1 quarantines a version missing from
time (tested: a row set back to NULL gets YN0016 again), so such a version does not
install on defaults. An operator who wants one to install can pre-approve its scope in yarn
(below), or set its published_at by hand, which is the operator asserting a time Sindri
never observed. A proxy cache entry gets time only when it next refreshes, after its
ttl; with ttl: 0, which is fresh forever, it never does until a non-zero ttl is set.
Yarn 4’s npmPreapprovedPackages exempts an internal scope from the gate. The gate
verifies ["@acme/*"] on yarn 4.18.1; a bare scope name ("@acme") does not match.
The packument is parsed with exact keys and its name must match the request. Go’s
struct decoding is case-insensitive and would read a DIST that npm ignores. A version that
cannot be served safely (a bad version string or filename, a malformed entry) is left out
with any dist-tag naming it. Two versions claiming one filename are a 502, because choosing
between their hashes would depend on map order. Sindri also reads dist.integrity as the
strongest of sha512, sha384, and sha256, falling back to sha1 from the SRI string or
dist.shasum; the blob key stays sha256.
A tarball is fetched only from the upstream’s own host and base path. dist.tarball is
author-supplied, and the fetch carries the upstream’s credential. The scheme and host are
forced to the upstream’s, userinfo and fragment are dropped, and the resolved path must stay
under the upstream’s base path on a segment boundary. Dot segments and encoded separators
are refused in decoded or encoded form, to any depth of encoding, rather than cleaned. A
redirect that leaves the first request’s origin is refused, and credentials stop at any such
redirect for every protocol: net/http alone kept Authorization for the same hostname on
another port. A redirect to the same origin is followed, because registries move tarballs on
their own host, but credentials stop at any hop outside the base path or with an unsafe path.
So an open redirect on a shared host cannot carry them to another tenant’s path, and a
tarball that really needs them there fails rather than authenticates.
A version with neither integrity nor shasum is listed, and its tarball is a 502.
Sindri will not cache bytes it cannot check. The same answer covers a tarball URL off the
upstream.
An uncached proxy stream declares no length. The hash is known only after the last byte,
so a declared Content-Length would frame the response as complete before an integrity
abort could land. Chunked framing makes the abort visible to npm. A placed tarball declares
its length. This refines ADR 14, which still holds for PyPI and OCI: both declare a length
on an unverified stream and rely on the client checking the digest. A placed tarball is served
as it was cached even if upstream later changes that version’s hash, and the client then
fails with EINTEGRITY.
In a virtual repository the first member with the package owns its tarballs. For a proxy member, “has the package” means its packument resolves, and that is checked before any placed copy is read. A tarball the package’s document does not list, or lists and upstream lacks, is a 404 when it is not already placed, and a later member is not asked, including from outside a nested virtual. Otherwise a second proxy could supply a tarball for a version the first member’s document never offered.
FetchNPMTarball fetches the packument before it looks for a placed copy, so the check is
of the file as well as the package: a version upstream has dropped is flagged by the refresh
and answers 404, directly and through a virtual (SIN-54, below).
An upstream 5xx, or a document that fails to parse, fails the walk with a 502. A 404 or a
negative cache entry is a miss and the walk moves on. A 401/403 is a refusal and fails it
too, below. A stale document still
answers from its own member during an outage, so an outage cannot change which member a
name resolves to, and an outage on a proxy does not touch a claimed name, since the proxy is
not contacted. Only hosted members claim: a proxy’s cached packages rows look like hosted
rows, and claimOwner is what keeps them out. Names through a virtual use validReadName,
ASCII only, and a hosted member compares exactly while the claim compares in lowercase. So
JSONStream against a hosted jsonstream is claimed and then a 404.
A 401 or 403 from a proxy member fails the walk with a 502. SIN-55 decided on 2026-11-04
that a refusal fails the walk on all three protocols (ADR 14 has the rule table and the OCI
exceptions): the broken thing is Sindri’s own upstream credential, not the package’s
presence. The risk it closes is real. With members [private-proxy, public-proxy], a broken
credential on the first would otherwise make a private name resolve from the public proxy for
as long as the credential stays broken. A refusal is never negatively cached, so that would
not have been bounded by the negative TTL either. A stale private document keeps answering
from its own member, as it does in an outage, because a refusal is also unavailable. A claim
by a hosted member still holds, so this affects only names that live upstream on a private
registry.
An npm packument is bounded at 128 MiB, and each read parses all of it. PyPI pages and
OCI manifests keep 32 MiB; a packument lists every version and real ones are large
(renovate is 36.6 MB, next 25.7 MB, measured 2026-11-03). Over the bound is a 502 that
neither poisons the cache nor displaces a good stale copy, and the reason is logged with the
repository and package name, never the URL, headers or body. The cost is that every read,
cached or not, loads and parses the whole document, and there is no request coalescing, so
concurrent cold reads of one package each fetch it.
A file upstream has removed stops serving at once. Every refresh that gets an answer
from upstream tells the registry which files the package still lists: a 200 document names
the tarball filenames it lists, and a 404 names none. A placed file the answer does not list
gets files.upstream_gone_at, and a file it lists has the flag cleared, so a file upstream
lists again serves again from the next refresh. A flagged file is invisible to the
adapter-facing reads (the tarball and file reads, the file listing) and to the placement
check, so neither a direct read nor a virtual walk can reach it, and that holds for a
version pulled as malicious as much as for any other. FetchNPMTarball and the PyPI file
read fetch the document before they serve a placed copy, so a stale entry refreshes on a
lockfile-only install that never reads the packument. Only an answer sets the flag: a 5xx, a
401/403 (ErrUpstreamDenied is an outage here) or a document that does not parse says
nothing about the files, and the placed copy still serves. Retention removes a flagged row,
and the version and package rows it empties, once it has been flagged longer than
worker.retention.proxyStaleAfter; the collector reclaims the bytes later. Hosted rows are
never flagged. A document whose versions were dropped as unservable (Dropped) lists only
the versions the parser kept, so a placed file of a dropped version is flagged, which is the
safe direction. A PyPI 200 is believed only if it is this project’s index: a document with no
files list, or whose name normalizes to another project, is refused as unavailable and
flags nothing, as a packument with the wrong name is for npm. A missing name alone is
accepted, and files: [] is a real answer that upstream lists nothing. PyPI walks the same way: a proxy member whose index resolves owns the
answer for its project’s files, so a file it no longer lists is a 404 and a later member
listing the same filename is not asked. A member whose project answers 404 still moves the
walk on.
Rejected: keeping a placed file serving until retention collects it, as this ADR first did. It is the more available choice, but it serves a version upstream pulled for a reason, including malware, for as long as the cache entry is renewed, and a virtual and a direct read disagreed about one file. The accepted cost is that a pinned install breaks after a left-pad style unpublish, until upstream lists the file again. A second cost: a placed file read past its TTL now waits on upstream before it serves, because the refresh decides whether the file is still listed. With an upstream that accepts connections and never answers, each such read could wait the whole upstream timeout (30 seconds by default) before the placed copy serves. SIN-61 added the backoff below.
A failed refresh backs the repository off for 30 seconds, and a fresh read parses nothing
(SIN-61, v1.1.1). The state is a map from repository to the time it may be asked again, held
on remote.Client, in memory and per process, so a restart or another replica costs one
wait. The 30 seconds is a constant, not configuration. Only the upstream not answering at
all starts it: a connection that fails, or a timeout before the response headers arrive,
marked by an error of its own (errUpstreamDown). A 5xx is not a trigger. It is an answer,
and a fast one: it fails that one request as ErrUpstreamUnavailable with a stale copy still
served, exactly as before SIN-61, and costs the next request no more than a healthy
upstream would. The backoff exists to stop reads queueing on a wait, and a 5xx has none. A
timeout counts only while waiting for headers. A body that stalls after a 200 is read
outside the request, fails that read, and starts nothing. ErrUpstreamUnavailable is not
the trigger either, because a 5xx, an oversize or unparsable document and a 401/403 wrap it
too, and one package’s bad document must not turn away every other package of the
repository.
noteRefresh is the whole rule. A successful refresh or a 404 clears the backoff, since
either shows the upstream answering. 401, 403, 429, a 5xx and a document that does not
parse change nothing: they start no backoff and end none. 429 is not a trigger because it is
a fast answer that says the caller is going too fast, not that the upstream is down, and
a fixed 30 second window would be a guess at a Retry-After Sindri does not read; it also
says nothing about the other packages of the repository.
During a backoff, a stale document is read from the cache without contacting upstream,
a placed file serves through the placement check as always (I2), a file already flagged as
gone is a 404, and any other read fails at once as ErrUpstreamUnavailable, so a client
sees the 502 a real outage gives and a virtual walk fails as before, without asking the next
member. On a fresh document the
upstream_gone_at flag is authoritative, since the refresh that stored the document set it.
A placed file, or a flagged one, is then answered from the files rows alone and the
document is not loaded or parsed. A file that is neither placed nor flagged still needs the
document, to find where it lives. Both hold through a virtual repository.
Two costs. A file upstream removes while the repository is backing off keeps serving until a read after the window ends refreshes the document. That is no sooner than 30 seconds after the last failed refresh, and later if no read comes, since nothing refreshes in the background. The read that refreshes restarts the window if it fails too. And “only the first read waits” is true per window, not per concurrent read: reads already in flight when the first failure lands have already started their own wait, and each one’s failure restarts the window.
The estimate for a 500-package lockfile install at 16 concurrent reads against a blackholed upstream, every document past its TTL, is derived, not measured. Without a backoff the reads go in 500 / 16, about 32 rounds that each wait the 30 second timeout: roughly 16 minutes. With it, the first 16 reads are in flight together and all fail at about 30 seconds; the other 484 find the repository backing off and serve their placed copies at once, so the install takes roughly 30 seconds, or about 60 if it is still running when the window ends and one more read has to find out the upstream is still down. A figure that assumed the first read alone waits would be too low by that in-flight round.
A hosted package row survives the deletion of its last file. The claim is the packages
row, so deleting a file removes the version when emptied and keeps the package, hidden from
listings and absent on reads. A virtual still answers 404 for the name and does not ask a
proxy. Publishing to it reuses the row. Deleting the repository releases the claim, but
DeleteRepository refuses a repository that has promotion events, so such a repository’s
claim has no release path today. An accidental publish of @types/foo there blocks
@types/* through that virtual until its members are restructured. It fails closed. This
covers PyPI as well as npm. Rows lost to deletes made before this fix cannot be recovered,
so such a name stays unclaimed until it is published again.
dist.tarball is absolute, from a new top-level publicUrl. ADR 13’s root-relative
links do not work for npm. With a clean cache, install failed with ENOENT on
/npm/team/internal/rel/-/rel-1.0.0.tgz; with a warm cache it succeeded and wrote a
file:../../.. path into package-lock.json. The Host header stays rejected for ADR 13’s
reason. config check requires publicUrl when any npm repository exists, with the https
rule auth.oidc.redirectUrl has. It must be the origin in the client’s registry=: npm
sent no token to a tarball on another host, which Sindri would answer with a 401. A reload
reports that a changed publicUrl needs a restart.
Routes live under /npm/{repository}/ and are parsed from r.URL.EscapedPath(), since
clients send @acme%2fui and a decoded path loses the boundary. - is already a reserved
segment and @ is illegal in a repository name, so neither can occur in one. The leftmost
- segment splits the path:
| Path after the repository | Meaning |
|---|---|
{name}, @scope%2fname, @scope/name | packument GET, publish or deprecate PUT |
{name}/-/{file}.tgz, @scope/name/-/{file}.tgz | tarball |
-/package/{name}/dist-tags[/{tag}] | dist-tag GET, PUT, DELETE |
-/whoami | caller’s subject |
-/v1/login | constant 404 |
-/user/org.couchdb.user:{name} | login |
npm login verifies a credential, and issues nothing. Plain npm login POSTs to
-/v1/login. On a 404 it prompts for a username and password and PUTs them to -/user/...,
then stores the token from the response as _authToken. Sindri takes the password as an
existing OIDC, machine, or bootstrap token, checks it with Chain.Verify, and returns that
same token. The username is ignored, as auth.Credential already ignores it for Basic. A
failure is a 401, and the answer does not vary with the repository, so it cannot probe for
names.
Neither login route can authorize through auth.Authorize, because the client sends no
credential header. They expose no repository data, the credential simply travels in the
body, and each gets a named case in the npm route-walk test. They are the only exception to
security rule 7. The body holds a secret and is never logged (rule 4).
Migration 00008 is additive. It widens the protocol and kind CHECK constraints and
adds the two tables and the column. An older binary ignores all of it, and the rollback path
of running the previous binary does not run Down. Down, if run, keeps repositories, packages,
versions, and files, and restores the old constraints as NOT VALID, so it succeeds with npm
rows present. It does drop dist_tags, dist_tag_events, and versions.deprecated.
The preset stays npm. It is what presets.go and ARCHITECTURE.md already say, and it
matches pypi. The roadmap’s npmjs changes.
Checked against installers (SIN-51)
scripts/npm-tarball-differential.sh installs each tarball shape the parser accepts from a
local file with the npm on PATH (10.9.9 in the recorded run) and pnpm 10.34.9 and yarn 1.22.22,
which the script fetches at those exact versions. Installs use --ignore-scripts in temp
directories. The whole installed package.json is compared, key by key and by exact key, with the
sanitized manifest inspectManifest returned, not only its name, version and description. The
harness is internal/proto/npm/tarball_differential_test.go, behind the differential
build tag. Each tarball holds the real manifest and placeholder files. Shapes a client could misread
also hold a decoy, a second package.json with a different name, version and description,
where the misreading would land: a whole package/package.json entry inside the body of an
entry that could be misframed (the slash-ended, ..-cut and split-character names, the pax
size, tar-stream’s PaxHeader), or a name that a reader ignoring the ustar prefix or a pax
path would take as the manifest. The shapes of real tools’ forms (npm pack, no owner, NUL
typeflag, directories, zero blocks, pax keys, pax with no path) have no decoy: there is
nothing in them for a reader to land on. Where a decoy is installed, a disagreement shows
which document was read. The test fails if a shape’s parser outcome differs from the expected one, if a
client errors outside a named allowlist, or if no negative control shows a client
installing the decoy.
The recorded run had 64 candidate shapes (excluding controls): 44 accepted and compared, 20
refused and so skipped. Of the 132 client rows, all agree and none is a client error. One shape,
7 stray zero bytes after the end marker, was accepted in the earlier run: yarn 1.22.22 cannot
extract such a tarball (“Unexpected end of data”) while npm and pnpm install it. yarn reads no
manifest from it, so it was not manifest confusion, but a package that installs with two clients
and fails with a third is one a publisher cannot reproduce. SIN-59 decided to refuse it at
publish: after the end marker the parser accepts only whole 512-byte blocks of zeros. The shape
is now on the refused list, and the allowlist of tolerated client errors is empty. This applies
to hosted publishes only: publish.go is the one caller of the parser, and a proxied tarball is
stored as the upstream sent it and never passes through it. Five JSON-level shapes (a repeated
name, a repeated version and description, NAME before and after name, and Version
and Description beside the lower-case keys) show that all three clients and Sindri keep the
last value of a repeated key and treat a key that differs in case as a different key. Every agree row installed the
name, version and description the parser read, not the decoy’s.
| Shape | npm | pnpm | yarn |
|---|---|---|---|
| npm pack, pax path | agree | agree | agree |
| npm pack, ustar prefix | agree | agree | agree |
| tar-stream form | agree | agree | agree |
| npm form with no owner | agree | agree | agree |
| NUL typeflag | agree | agree | agree |
| directories with and without a slash | agree | agree | agree |
| manifest after other files | agree | agree | agree |
| extra zero blocks | agree | agree | agree |
| duplicate name key, last wins | agree | agree | agree |
| duplicate version and description keys | agree | agree | agree |
| NAME key before name | agree | agree | agree |
| NAME key after name | agree | agree | agree |
| Version and Description keys beside the lower-case ones | agree | agree | agree |
| manifest split over prefix and name | agree | agree | agree |
| manifest named by a pax path over a short name | agree | agree | agree |
| pax with every allowed key | agree | agree | agree |
| pax with no path | agree | agree | agree |
| pax size repeating the header’s | agree | agree | agree |
| pax path over a name ending in a slash | agree | agree | agree |
| pax path over a name cut after a parent segment | agree | agree | agree |
| pax path over a name cut inside a character | agree | agree | agree |
| ustar prefix naming a nested package.json | agree | agree | agree |
| decoy manifest as a plain second file | agree | agree | agree |
| decoy manifest one directory down | agree | agree | agree |
| decoy manifest two directories down | agree | agree | agree |
| decoy manifest under the NTFS short-name lookalike | agree | agree | agree |
| pax path replacing PaxHeader | agree | agree | agree |
| pax path replacing package/cut-short/ | agree | agree | agree |
| pax path replacing package/cut-short. | agree | agree | agree |
| pax path replacing package/cut-short | agree | agree | agree |
| pax path replacing package/c: | agree | agree | agree |
| pax path replacing package/foo:bar.js | agree | agree | agree |
| pax path replacing package/nested/package.json | agree | agree | agree |
| pax path replacing package/nested/c:/package.json | agree | agree | agree |
| pax path replacing package/c:/nested/package.json | agree | agree | agree |
| pax path replacing //server/share/package/nested/package.json | agree | agree | agree |
| pax path replacing //?/c:/package/nested/package.json | agree | agree | agree |
| pax path replacing ab:/package/nested/package.json | agree | agree | agree |
| pax path replacing package/1:/package.json | agree | agree | agree |
| pax path replacing package/package.jso | agree | agree | agree |
| pax path replacing package/package.json.js | agree | agree | agree |
| pax path replacing package/nested/PACKAG~1.JSO | agree | agree | agree |
| pax path replacing package/PACKAG~1.JSON | agree | agree | agree |
| pax path replacing package/README~1.JSO | agree | agree | agree |
Negative controls check that the comparison can see a disagreement. They are shapes the parser refuses, because an installer takes the decoy, sent to the clients anyway:
| Negative control (refused by the parser, sent anyway) | npm | pnpm | yarn |
|---|---|---|---|
| second manifest | DISAGREE | DISAGREE | DISAGREE |
| manifest under another top directory | DISAGREE | DISAGREE | DISAGREE |
| manifest in upper case | DISAGREE | agree | DISAGREE |
Not tested (SIN-58): Windows name handling. Drive roots, 8.3 short names, trailing dots and spaces, UNC roots and backslashes cannot be exercised on this platform, so those refusals rest on reasoning and Unix reproductions only. The “upper case” control also depends on the filesystem: this run was on macOS, whose default filesystem folds case.
Consequences
- A third protocol did need a schema change, and it also needed per-protocol normalization in the core. The third adapter is still mostly an adapter, but “cheap” has these limits.
- Sindri gets its first origin setting, used only by npm.
testdata/config/sindri.yamlhas to carry it, and a wrong value breaks installs or pins a bad host into lockfiles. - An OIDC token stored by
npm loginexpires with the token, so people re-run login, and CI uses machine tokens. Issuing machine tokens stays admin-only. - A fork of one
@types/*package in a hosted repository blocks all of@types/*through any virtual repository containing it. It fails closed with a 404; the fix is a separate hosted repository or a new name. - A scope has no claim until its first publish. Nothing can depend on an internal package before it exists, so this is accepted.
- Two proxies in one virtual repository do not combine versions; the first with the package wins. A team that needs otherwise can reorder the members.
npm viewshows no readme, because the packument omits it.- The login path carries the username npm prompted for, so a token typed there by mistake would reach the access log, which records the path. The password travels in the body and stays out of it.
- Tag moves are recorded and OCI tag moves still are not. Bringing OCI in line is separate work.
- A name claim now survives deleting a package’s last file, as section 4 says “ever
published” means. A deleted version number is now refused too (SIN-52): deleting a
hosted file records its version in
retired_filesin the same transaction, and a publish checks that table after its exclusive insert, so the insert’s wait for an in-flight delete makes the tombstone visible. The refusal isErrVersionExists, the same 409 as a live version, and it applies to identical bytes as well: this is a behaviour change, because republishing a deleted version used to succeed. Versions deleted before migration 00009 are not remembered and can still be published again. Only hosted npm and PyPI repositories retire anything: a proxy and a hosted OCI-protocol repository do not. - Versions published before 1.1.1 have no recorded publish time and are left out of the
timemap, so yarn 4 quarantines them (see above). There is no backfill. - The proxy downloads and caches whole upstream documents, which costs upstream traffic,
parsing, response size and cache size. Sindri serves upstream’s
time, sonpm install --beforeand release-age settings work through a proxy. - A proxy takes only tarballs on its own host under its base path, with no off-origin
redirects. Registries that write
%2finto a tarball URL, or redirect downloads to a CDN, get a 502 or are left out. Bearer credentials and private upstreams are SIN-53. - A refused credential on a proxy member fails the walk with a 502 rather than letting it fall to the next member (SIN-55).
Rejected
- Storing the packument. A second source of truth, rewritten on every publish, that can disagree with placement.
- Serving the manifest from the publish body. npm’s own manifest-confusion problem: the metadata promises one set of dependencies and the tarball holds another.
archive/tarplus per-shape checks. Go and node-tar disagree on too many header shapes to list: review reproduced more than a dozen where Sindri read onepackage.jsonand npm installed another, and each fix only exposed the next.- Reusing
tagsfor dist-tags. It targets a digest, and a row counts as a placement and a GC root, so a dist-tag could keep a deleted version’s tarball readable. - Recording tag moves in
lifecycle_events. Its actions are approve and revoke, every row needs a stage, and it is keyed by digest. A tag move is none of those. - Fetching abbreviated packuments from the upstream. This was the M9 choice, and
v1.1.1 reversed it: the abbreviated form has no
time, so yarn 4 on defaults,--beforeand release-age settings all failed through a proxy. - Backfilling
published_atfor existing versions. The only candidate is the migration time or the first-read time, and both are made-up publish times. A client gating on age would trust them. - Declaring a length on a proxied tarball and aborting on a bad hash. The length frames the body as complete, and net/http then computes the end of the response from it, so the abort cannot be told from a finished download.
- Cleaning a
dist.tarballpath. Normalizing dot segments and encodings is the behaviour a hostile author depends on. Refusing the spellings leaves nothing to agree on. - Refusing a same-origin redirect outside the base path. It would break registries that move tarballs on their own host. Stopping the credentials closes the same risk.
- Failing the walk on a refusal for npm only. Smaller, since npm resolves through its own closures, but it would leave the protocols different. SIN-55 chose all three, with Docker Hub, quay.io and ghcr.io’s refusals of unknown names kept as misses (ADR 14).
- Merging packuments per version. A hostile
99.0.0can appear under a name it should never reach. ADR 14 already rejected merging, and I5 forbids it. - Declaring scopes in config. It closes the first-publish gap at the cost of a field that can drift from what is published.
- The Host header for
dist.tarball. Client input reflected into a document that lockfiles then pin. - npm’s web login. It needs a pending-login table, an anonymous polling endpoint, and a token minted for a user. A minted token cannot carry groups, which ADR 18 says are never stored.
- Minting a token at the login route. Same objection, and a machine token cannot stand in for a person.
- Treating an identical re-publish as idempotent, as PyPI does. The roadmap refuses it, and a publish also moves a dist-tag, so a silent no-op would leave it unclear whether the tag moved.