Title: test(cli): unit-test partition_purls ecosystem filter by mikolalysenko · Pull Request #70 · SocketDev/socket-patch · GitHub
Open Graph Title: test(cli): unit-test partition_purls ecosystem filter by mikolalysenko · Pull Request #70 · SocketDev/socket-patch
X Title: test(cli): unit-test partition_purls ecosystem filter by mikolalysenko · Pull Request #70 · SocketDev/socket-patch
Description: Summary Adds nine unit tests for partition_purls in crates/socket-patch-cli/src/ecosystem_dispatch.rs. partition_purls is the helper that splits the user-supplied PURL list by ecosystem and enforces the --ecosystems CSV allow-list flag on apply, rollback, and scan, so it is on the hot path of the CLI contract. The new #[cfg(test)] mod tests block exercises only partition_purls. The neighboring find_packages_for_purls, find_packages_for_rollback, and crawl_all_ecosystems helpers are intentionally not unit-tested here because they touch the filesystem — they are covered by integration tests elsewhere. Cases No filter, single npm PURL -> Ecosystem::Npm bucket has the PURL. No filter, mixed npm/pypi/cargo -> three buckets, each with the matching PURL. No filter, empty input -> empty map. No filter, duplicate PURLs -> both copies preserved in the npm bucket (the function does not dedupe). No filter, unrecognized pkg:weirdo/... -> dropped, empty map. Allow-list ["npm"] against npm+pypi -> only the npm bucket. Allow-list ["pypi"] against npm-only -> empty map. Allow-list ["npm","pypi"] -> both buckets. Empty allow-list Some(&[]) -> empty map (matches nothing). PURL prefixes are verified against Ecosystem::from_purl in crates/socket-patch-core/src/crawlers/types.rs; allow-list values match Ecosystem::cli_name() in the same file. Test plan cargo build --workspace --all-features clean cargo clippy --workspace --all-features -- -D warnings clean cargo test --workspace --all-features --lib — all 9 new tests pass, existing tests still pass Stacked on #67 (tests/cli-contract-foundation).
Open Graph Description: Summary Adds nine unit tests for partition_purls in crates/socket-patch-cli/src/ecosystem_dispatch.rs. partition_purls is the helper that splits the user-supplied PURL list by ecosystem and enforce...
X Description: Summary Adds nine unit tests for partition_purls in crates/socket-patch-cli/src/ecosystem_dispatch.rs. partition_purls is the helper that splits the user-supplied PURL list by ecosystem and enforce...
Opengraph URL: https://github.com/SocketDev/socket-patch/pull/70
X: @github
Domain: github.com
| route-pattern | /:user_id/:repository/pull/:id/files(.:format) |
| route-controller | pull_requests |
| route-action | files |
| fetch-nonce | v2:51b58501-a917-c324-7232-d625d41448db |
| current-catalog-service-hash | ae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b |
| request-id | CBF6:2E7285:30355DD:41FCBB5:6A4EFEB7 |
| html-safe-nonce | 4f6d41cfc9205a3d2712de8fee087827032d899d24e0258a91a753e2f5d1d3fa |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDQkY2OjJFNzI4NTozMDM1NUREOjQxRkNCQjU6NkE0RUZFQjciLCJ2aXNpdG9yX2lkIjoiNjk2MDcxMDMwNDIwMTExMzI3MSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | def30171297f991fc20f2290b9e3828d725eead50a61817ba87ddb61db56db9b |
| hovercard-subject-tag | pull_request:3711906849 |
| github-keyboard-shortcuts | repository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/SocketDev/socket-patch/pull/70/files |
| twitter:image | https://avatars.githubusercontent.com/u/231686?s=400&v=4 |
| twitter:card | summary_large_image |
| og:image | https://avatars.githubusercontent.com/u/231686?s=400&v=4 |
| og:image:alt | Summary Adds nine unit tests for partition_purls in crates/socket-patch-cli/src/ecosystem_dispatch.rs. partition_purls is the helper that splits the user-supplied PURL list by ecosystem and enforce... |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | b92d11c0aa4a77d54ef4af1078b6a15fb5a70a215b30c4ecf28889d5a8e656d9 |
| turbo-cache-control | no-preview |
| diff-view | unified |
| go-import | github.com/SocketDev/socket-patch git https://github.com/SocketDev/socket-patch.git |
| octolytics-dimension-user_id | 69326764 |
| octolytics-dimension-user_login | SocketDev |
| octolytics-dimension-repository_id | 1093661456 |
| octolytics-dimension-repository_nwo | SocketDev/socket-patch |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 1093661456 |
| octolytics-dimension-repository_network_root_nwo | SocketDev/socket-patch |
| turbo-body-classes | logged-out env-production page-responsive full-width |
| disable-turbo | true |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 2b8f23afb982271f1b22258a94aede67a6b77760 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width