Title: test(cli): pin GetArgs flag surface, download/no-apply aliases, detect_identifier_type by mikolalysenko · Pull Request #76 · SocketDev/socket-patch · GitHub
Open Graph Title: test(cli): pin GetArgs flag surface, download/no-apply aliases, detect_identifier_type by mikolalysenko · Pull Request #76 · SocketDev/socket-patch
X Title: test(cli): pin GetArgs flag surface, download/no-apply aliases, detect_identifier_type by mikolalysenko · Pull Request #76 · SocketDev/socket-patch
Description: Summary Locks in the get subcommand's public CLI contract with parser snapshot tests, and adds unit tests for the two pure helpers behind it: detect_identifier_type and select_patches. No behavior change to the binary. Stacked on #67 (tests/cli-contract-foundation). What's covered tests/cli_parse_get.rs (27 tests) — every flag in the get table asserts its documented default + binding: Positional identifier (required; missing triggers MissingRequiredArgument). --org, --cwd, --id, --cve, --ghsa, --package/-p, --yes/-y, --api-url, --api-token, --save-only, --global/-g, --global-prefix, --one-off, --json. --download-mode default = "diff" plus "package" and "file" accepted. Hidden alias --no-apply proven equivalent to --save-only (contract-significant; widely used in existing scripts but doesn't appear in --help). Visible alias download proven equivalent to get. Unknown flag triggers UnknownArgument. #[cfg(test)] mod tests in commands/get.rs (17 tests): detect_identifier_type: UUID/CVE/GHSA/PURL detection, case-insensitivity for UUID + CVE + GHSA (load-bearing), bare package names + malformed CVE + empty string all map to None. select_patches: free user single-free auto-select, paid user prefers most-recent paid over free for same PURL, paid user picks most-recent paid, paid user falls back to most-recent free when no paid is available, free user paid-filtered-out then single-free auto-select, free user multi-free JSON mode returns Err(1), empty input is Ok(vec![]). The interactive TTY path (free user, multi-free, non-JSON) is intentionally not tested — it calls dialoguer which requires a real TTY. Verification cargo build --workspace --all-features # clean cargo clippy --workspace --all-features -- -D warnings # clean cargo test --workspace --all-features --lib --tests # 459 lib tests + 27 cli_parse_get tests pass Test plan cargo build --workspace --all-features clean cargo clippy --workspace --all-features -- -D warnings clean cargo test --workspace --all-features --lib --tests passes (17 new commands::get::tests + 27 new cli_parse_get tests, plus existing 415 + others) --no-apply hidden alias exercised download visible alias exercised Required positional enforced via clap error-kind assertion
Open Graph Description: Summary Locks in the get subcommand's public CLI contract with parser snapshot tests, and adds unit tests for the two pure helpers behind it: detect_identifier_type and select_patches. No behav...
X Description: Summary Locks in the get subcommand's public CLI contract with parser snapshot tests, and adds unit tests for the two pure helpers behind it: detect_identifier_type and select_patches. No b...
Opengraph URL: https://github.com/SocketDev/socket-patch/pull/76
X: @github
Domain: github.com
| route-pattern | /:user_id/:repository/pull/:id/files(.:format) |
| route-controller | pull_requests |
| route-action | files |
| fetch-nonce | v2:92d3bc3b-b7ef-d889-51be-5afb5b2d582d |
| current-catalog-service-hash | ae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b |
| request-id | 8280:1EE1:7BC2A7:A6C124:6A4EFC6C |
| html-safe-nonce | d7e4fac24345a41f72df1a6aeb0b7c35184f295e5aae48cb76f2f869503af81a |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4MjgwOjFFRTE6N0JDMkE3OkE2QzEyNDo2QTRFRkM2QyIsInZpc2l0b3JfaWQiOiI2NjA3MjM0ODA5MjcyOTI1MjkyIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 1bace1e848601a486c5040e196ed14d91cfc7c7dc3fca889527f811246163b0d |
| hovercard-subject-tag | pull_request:3711918602 |
| 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/76/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 Locks in the get subcommand's public CLI contract with parser snapshot tests, and adds unit tests for the two pure helpers behind it: detect_identifier_type and select_patches. No behav... |
| 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