feat: add Cargo/Rust crate patching support behind feature flag#31
Merged
mikolalysenko merged 1 commit intomainfrom Mar 4, 2026
Merged
feat: add Cargo/Rust crate patching support behind feature flag#31mikolalysenko merged 1 commit intomainfrom
mikolalysenko merged 1 commit intomainfrom
Conversation
Introduces Cargo ecosystem support gated behind a `cargo` feature flag, and refactors the duplicated ecosystem dispatch logic across CLI commands into a centralized module. - Add `Ecosystem` enum to replace string-based ecosystem dispatch - Add `CargoCrawler` supporting registry and vendor layouts - Add `ecosystem_dispatch.rs` with shared partition/crawl helpers - Refactor apply, rollback, scan, get commands to use dispatch helpers - Add cargo PURL functions (parse, build, is_cargo_purl) - Add 20 new tests (253 total with feature, 233 without) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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.
Summary
cargofeature flag, enabling patching of crates in$CARGO_HOME/registry/src/andvendor/directoriesapply,rollback,scan,get) into a centralizedecosystem_dispatchmodule, reducing ~190 lines of boilerplateEcosystemenum that replaces string-based ecosystem identification, making future ecosystem additions mechanicalKey changes
Core (
socket-patch-core):Ecosystemenum incrawlers/types.rswithfrom_purl(),cli_name(),display_name(),purl_prefix(),all()CargoCrawlerincrawlers/cargo_crawler.rs— supports registry layout (<name>-<version>/) and vendor layout (<name>/), with line-basedCargo.tomlparser and directory-name fallback forversion.workspace = trueutils/purl.rs(is_cargo_purl,parse_cargo_purl,build_cargo_purl)CLI (
socket-patch-cli):ecosystem_dispatch.rs—partition_purls(),find_packages_for_purls(),find_packages_for_rollback(),crawl_all_ecosystems()Feature flag:
--features cargoon both crates; without it, all existing behavior is unchanged.Test plan
cargo test --workspace— 233 tests pass (no regressions, no feature flag)cargo test --workspace --features cargo— 253 tests pass (20 new cargo-specific tests)cargo build --release— clean build without featurecargo build --release --features cargo— clean build with featurecargo test --workspaceandcargo test --workspace --features cargo🤖 Generated with Claude Code