feat(repodata_gateway): read virtual package plugin registrations - #2630
Open
hunger wants to merge 1 commit into
Open
feat(repodata_gateway): read virtual package plugin registrations#2630hunger wants to merge 1 commit into
hunger wants to merge 1 commit into
Conversation
Channels can register virtual package detection plugins in `info.virtual_package_plugins`, mapping the name of the package providing the plugin to the virtual packages it provides. Keying by plugin lets one `cuda-detect` cover both `__cuda` and `__cuda_arch` instead of registering the same detector twice. Parsed from both `repodata.json` and the sharded index; names are deserialized unchecked so one malformed entry cannot make a channel unusable. The gateway exposes the registrations two ways: - `Gateway::virtual_package_plugins(channel, platform)` mirrors `Gateway::channel_relations` and needs no specs, which matters because the plugin package names only exist inside the metadata being fetched. - `RepoDataQueryOutput::virtual_package_plugins` lists them per subdir in resolved channel-priority order, so channels a solve discovers through CEP-42 are covered too. Registrations are reported exactly as declared: duplicate claims on the same virtual package are left for the caller to resolve, and no plugin is fetched or executed. Registrations stay per subdir rather than collapsed per channel, matching how CEP-42 relations are handled. `rattler virtual-packages -c <channel>` prints them for manual testing against the new `test-data/channels/virtual-package-plugins` fixture. The design, including the parts that are not implemented yet -- the plugin protocol, execution, caching and the trust model -- is written up in `crates/rattler_repodata_gateway/docs/virtual-package-plugins.md`. All of it sits behind the `experimental-virtual-package-plugins` feature; with the feature off the public API and the serialized output are unchanged. Cargo features are additive, so every crate constructing `ChannelInfo` or `ShardedSubdirInfo` must enable it in lockstep, hence the forwarding entries in `rattler_index` and `rattler-bin`. Also switches the sharded-index test mock to `rmp_serde::to_vec_named`, matching what the indexer writes. Positional encoding misaligns as soon as a skipped field precedes a present one.
Contributor
|
Details |
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.
Channels can register virtual package detection plugins in
info.virtual_package_plugins, mapping the name of the package providing the plugin to the virtual packages it provides. Keying by plugin lets onecuda-detectcover both__cudaand__cuda_archinstead of registering the same detector twice. Parsed from bothrepodata.jsonand the sharded index; names are deserialized unchecked so one malformed entry cannot make a channel unusable.The gateway exposes the registrations two ways:
Gateway::virtual_package_plugins(channel, platform)mirrorsGateway::channel_relationsand needs no specs, which matters because the plugin package names only exist inside the metadata being fetched.RepoDataQueryOutput::virtual_package_pluginslists them per subdir in resolved channel-priority order, so channels a solve discovers through CEP-42 are covered too.Registrations are reported exactly as declared: duplicate claims on the same virtual package are left for the caller to resolve, and no plugin is fetched or executed. Registrations stay per subdir rather than collapsed per channel, matching how CEP-42 relations are handled.
rattler virtual-packages -c <channel>prints them for manual testing against the newtest-data/channels/virtual-package-pluginsfixture.The design, including the parts that are not implemented yet -- the plugin protocol, execution, caching and the trust model -- is written up in
crates/rattler_repodata_gateway/docs/virtual-package-plugins.md.All of it sits behind the
experimental-virtual-package-pluginsfeature; with the feature off the public API and the serialized output are unchanged. Cargo features are additive, so every crate constructingChannelInfoorShardedSubdirInfomust enable it in lockstep, hence the forwarding entries inrattler_indexandrattler-bin.Also switches the sharded-index test mock to
rmp_serde::to_vec_named, matching what the indexer writes. Positional encoding misaligns as soon as a skipped field precedes a present one.This is just an initial attempt at the data structure in repo-data only and just enough extra code to get something out of the
rattlerbinary.The preliminary spec is in crates/rattler_repodata_gateway/docs/virtual-package-plugins.md, based on @wolfv suggestion with changes from claude to update it with the decisions taken in this change.
We can merge this into main: Everything is hidden behind
experimental-virtual-package-pluginsfeatures.How Has This Been Tested?
By running
cargo run --bin rattler --features experimental-virtual-package-plugins -- virtual-packages -c ./test-data/channels/virtual-package-pluginsand with unit tests.AI Disclosure
Tools: Claude
Checklist: