Skip to content

pnpr: per-ecosystem storage namespaces and name mapping #213

Closed
pnpm/pnpm
#17355

Description

@zkochan

A hosted registry declared under an ecosystem group without an org: gets the synthetic org <ecosystem>~<name> (pnpr/crates/config/src/registry_graph.rs). So /npm/~acme/ and /cargo/~acme/ are stored as:

orgs/npm!7eacme/packages/…
orgs/cargo!7eacme/packages/…

After pnpm/pnpm#17353 this is the last escaped name in a common store path.

Proposal

Add an ecosystem directory to each org namespace and drop the synthetic org:

orgs/acme/npm/packages/@/left-pad/…
orgs/acme/cargo/packages/@/serde/…
default/npm/packages/…
  • A group registry without org: uses its own name as the org.
  • Two hosted registries may share an org: when their ecosystems differ. The collision check in pnpr/crates/config/src/validation.rs would compare (org, ecosystem) instead of org.
  • Storage::for_hosted would take the ecosystem, and layout::namespace_segments would add it.

Notes

  • No new capability: separate registries per ecosystem with the same name already work through the synthetic org. This changes the paths and lets several ecosystems share one explicit org.
  • pnpr is still experimental, so the layout can change in place as feat(pnpr): store packages under readable scope and version paths pnpm#17353 did, with no version bump.
  • Check the records that are keyed by org (staged publishes, pipeline runs, tombstones, .tar-integrity) for anything that assumes one ecosystem per org.

Per-ecosystem name mapping

Once a namespace knows its ecosystem, layout::package_segments can map names per ecosystem. Today only npm's @scope/name gets a directory level, and every other / or : is escaped into one segment:

ecosystem name today
Composer vendor/pkg @/vendor!2fpkg
Go github.com/a/b @/github.com!2fa!2fb
Maven org.foo:bar @/org.foo!3abar
OCI acme/app/tool @/acme!2fapp!2ftool

Splitting such names into one directory per component makes them readable. It also fixes a limit the filesystem backend already has: MAX_OCI_NAME_LEN is 255 and every escaped / takes 3 bytes, so a long nested image name exceeds the 255-byte file name limit and fails with ENAMETOOLONG. Bucket keys allow 1024 bytes, so the S3 backend is unaffected.

Splitting must keep a name from sitting where another name's child or blobs/ does. For example, OCI acme/app and acme/app/tool would both be directories, and acme/blobs must not alias acme's blobs.

Do this before a new ecosystem lands, so its names are mapped by its own rules from the start. VERSIONED_EXTENSIONS in layout.rs states the rule for blob extensions a new ecosystem adds.


Written by an agent (Claude Code, claude-opus-5-5).

Activity

  1. changed the title [-]pnpr: an ecosystem directory in each org namespace instead of the <ecosystem>~<name> org[/-] [+]pnpr: per-ecosystem storage namespaces and name mapping[/+] on Oct 25, 2026
  2. zkochan commented on Oct 25, 2026

    @zkochan
    MemberAuthor

    Opened pnpm/pnpm#17355 covering the full issue:

    • Hosted store namespaces now include the ecosystem (default/<ecosystem>/ and orgs/<org>/<ecosystem>/).
    • Hosted registries declared under an <ecosystem>: group without an explicit org: now default their org to their own registry name instead of <ecosystem>~<name>, and pnpr-config checks (org, ecosystem) for collisions so registries of different ecosystems can share an org.
    • layout::package_segments and layout::decode_package_segments take an Ecosystem (Npm, Cargo, Pypi, Oci), mapping multi-component OCI repository names c_1/.../c_k to ["@<encode(c_1)>", ..., "@<encode(c_{k-1})>", "<encode(c_k)>"] and single-component names to ["@", "<encode(name)>"].
    • pnpr upgrade-storage and documentation (storage.md, configuration.md, ecosystems.md, cli.md) are updated accordingly.

    Generated by Antigravity (Claude Opus 4.7)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions