Title: test(cli): pin ApplyArgs flag surface + verify_status_str by mikolalysenko · Pull Request #73 · SocketDev/socket-patch · GitHub
Open Graph Title: test(cli): pin ApplyArgs flag surface + verify_status_str by mikolalysenko · Pull Request #73 · SocketDev/socket-patch
X Title: test(cli): pin ApplyArgs flag surface + verify_status_str by mikolalysenko · Pull Request #73 · SocketDev/socket-patch
Description: Summary Locks in the public CLI contract for the apply subcommand and adds unit tests for its pure JSON-output helpers. No behavior change to the binary. Stacked on tests/cli-contract-foundation (PR #67). tests/cli_parse_apply.rs (25 tests) — drives Cli::try_parse_from(...) to pin every flag in the apply row of CLI_CONTRACT.md: defaults, long-form, short-form, CSV split for --ecosystems, accepted token values for --download-mode, and a failure-path assertion that an unknown flag returns clap::error::ErrorKind::UnknownArgument. Inline #[cfg(test)] mod tests in apply.rs (8 tests) — covers the two pure helpers used by --json output: verify_status_str — all four VerifyStatus variants map to their documented snake_case tags (ready, already_patched, hash_mismatch, not_found). result_to_json — top-level key set is exactly {purl, path, success, error, filesPatched, appliedVia, filesVerified}; filesVerified[0] keys are {file, status, message, currentHash, expectedHash, targetHash}; HashMismatch round-trips to "hash_mismatch"; appliedVia uses camelCase (not snake_case applied_via) and serializes as a path -> tag map. A flag rename, dropped short form, default-value drift, or JSON key rename now fails loudly here instead of silently breaking the npm/pypi/cargo wrappers and CI scripts that depend on the surface. Test plan cargo build --workspace --all-features clean from /tmp/spw/apply cargo clippy --workspace --all-features -- -D warnings clean cargo test --workspace --all-features --lib --tests — all pass (33 new tests, 448 total) All 4 VerifyStatus variants covered Top-level + filesVerified[0] JSON key sets asserted --ecosystems npm,pypi,cargo CSV split verified --download-mode default verified as exactly "diff" One failure case asserts clap::error::ErrorKind::UnknownArgument
Open Graph Description: Summary Locks in the public CLI contract for the apply subcommand and adds unit tests for its pure JSON-output helpers. No behavior change to the binary. Stacked on tests/cli-contract-foundation (P...
X Description: Summary Locks in the public CLI contract for the apply subcommand and adds unit tests for its pure JSON-output helpers. No behavior change to the binary. Stacked on tests/cli-contract-foundation (P...
Opengraph URL: https://github.com/SocketDev/socket-patch/pull/73
X: @github
Domain: github.com
| route-pattern | /:user_id/:repository/pull/:id/files(.:format) |
| route-controller | pull_requests |
| route-action | files |
| fetch-nonce | v2:e5216e95-dc2b-9461-40a6-56627846a5f0 |
| current-catalog-service-hash | ae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b |
| request-id | B252:3730CE:36A2BF0:4B59652:6A4F3729 |
| html-safe-nonce | 00be827019edd0a360da962928c1324763df39608bef888966c73742fc736e01 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCMjUyOjM3MzBDRTozNkEyQkYwOjRCNTk2NTI6NkE0RjM3MjkiLCJ2aXNpdG9yX2lkIjoiMjc5NjQ1ODIzMzMyMDkxMjY4MSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | c203869e7e46e73ae6264a092011e05f772a910ebe6972ba40551f8cffcdef5a |
| hovercard-subject-tag | pull_request:3711914887 |
| 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/73/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 public CLI contract for the apply subcommand and adds unit tests for its pure JSON-output helpers. No behavior change to the binary. Stacked on tests/cli-contract-foundation (P... |
| 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