Repository navigation
Plugin contract 0.2: mounts, asset names, kinds, ranged downloads and NuGet's queries - #156
Merged
Merged
Conversation
schmitch
marked this pull request as ready for review
October 21, 2026 16:55
…NuGet's queries What a format like NuGet needs from the plugin contract, added for every plugin (Helm's behavior is unchanged): - plugin.toml names the format's mount (`/repository` by default), the repository kinds it serves (hosted and group; proxies come later) and its `[assets]` names and content types. The server routes every mount, serves a repository under its own format's mount only, and the admin API and /admin/formats follow the declared kinds and mount. - Downloads answer a single `Range` (206/416) when the blob source serves ranges, as NuGet's do. - New query `packages-of(id, versions)` for a page of a long listing; search takes `semver2` and `upstream`, passes `take` through (0 is the default page) and its hits carry the download total. - Publish times are RFC 3339 with milliseconds; a version stored before manifest summaries were gets its summary from its stored manifest. - Uploads can be the first multipart part, whatever its name (NuGet push). - Unlist, relist and delete of a package outside the caller's selector answer 404, as for NuGet; an offline proxy keeps serving. - Request helpers in forge-plugin-api: decoded path segments and query parameters, plain-text responses. The contract becomes forge:format@0.2.0 (0.1.0 shipped in no release). Tests: a native test plugin covers mounts, kinds, asset names, first-part uploads, ranges, the queries and selector 404s; the Helm component is installed under a mount of its own; the test server honors [blob_cache]. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PVwHnFCgGPRzXcChXeCHFx
schmitch
force-pushed
the
claude/plugin-contract-0-2
branch
from
October 21, 2026 17:09
da0e6e7 to
75733ce
Compare
This was referenced Oct 21, 2026
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.
Plugin contract 0.2: what NuGet needs, for every plugin
First of the follow-ups to #146, toward NuGet as a built-in plugin in
plugins/nugetwith the same architecture as Helm. This PR grows the plugin contract by the parts the NuGet protocol needs that the contract lacked. Each one is generic, so Helm and future plugins get it too. Helm's behavior is unchanged.Rebased onto
mainwith the Docker / OCI registry (#149). Plugin mounts sit next to the/v2registry routes. A plugin's kinds feedFormatRegistry::kinds, andGET /admin/formatslists NuGet, Docker and then the plugins.What changes
Declared in
plugin.tomlmount: where the format's repositories are served,{mount}/{repo}/…. The default is/repository. NuGet will declare/v3, which stays reserved until then./v2included) and the web UI's pages are reserved; so are the idsnugetanddocker.kinds: the repository kinds the format serves. The default is hosted and group;proxyis refused until proxies come to the contract. The admin API and/admin/formatsfollow it, throughFormatRegistry::kinds.[assets]: the names and content types a version's package and manifest are stored under. NuGet keeps its existingpackage.nupkg/package.nuspecrows this way.Host behavior
downloadanswers a singleRange(206/416,Accept-Ranges) when the blob source serves ranges (the local blob cache), exactly as NuGet's.nupkgdownloads do. The range parser is NuGet's, made public.offline_serves_nothing, as on/v3).Contract
forge:format@0.2.0(WIT andFormatPlugintypes)packages-of(id, versions): the metadata of some versions, ascending. NuGet uses it for registration pages.search-querygainssemver2andupstream.takeis passed through to the read ops, so 0 is the default page as for NuGet (it used to be clamped to 1).search-hitgainstotal-downloads.upload::first-part: the first multipart part, whatever its name (NuGet push).…T12:00:00.000+00:00), NuGet's format.manifest_summary.forge-plugin-apihelpersRequest::segments()(percent-decoded path segments),query_pairs()andquery_param()(form-decoded), andResponse::text().Testing
crates/server/tests/plugin_contract.rs: a small native test plugin,probe, installed through a newServerOpts::extra_pluginshook, with its own mount, kinds and asset names. It covers:/probeonly; a Helm repository under/probeanswers 404);probeis refused) and/admin/formats;[blob_cache], which the test server now honors asmaindoes;packages-of(ascending; unknown and malformed versions left out);semver2,take=0, and download totals;tests/plugins.rs: the Helm component is installed under the mount/chartsand served there only.forge-plugin: manifest tests for mounts, kinds and assets (including the reserved/v2anddocker); the component tests run against Helm built for 0.2.0.forge-serversuite on a fresh database, including the new registry tests, plus theforge-plugin,forge-plugin-apiandforge-format-helmtests. All passed exceptworkers, which passed when run on its own. It counts every pending outbox row in the database, and locally all test binaries share one database, so it fails after the registry tests (CI gives each binary its own).cargo fmt --check, clippy-D warnings,cargo check --all-features, andcargo xtask plugins-check.Next in the series
plugins/nuget,mount = "/v3"; NuGet as a built-in format plugin (plugins/nuget), served at /v3 by the plugin dispatcher #157): its protocol behindFormatPlugin, and the separate/v3dispatcher removed. Proxies keep the host's NuGet upstream code for now.Generated by Claude Code