diff --git a/.github/actions/test_ruby_gem_uploads/action.yaml b/.github/actions/test_ruby_gem_uploads/action.yaml index e1ebb506..66bde7ad 100644 --- a/.github/actions/test_ruby_gem_uploads/action.yaml +++ b/.github/actions/test_ruby_gem_uploads/action.yaml @@ -71,3 +71,7 @@ runs: TRUNK_PUBLIC_API_ADDRESS: ${{ inputs.trunk-public-api-address }} TRUNK_ORG_URL_SLUG: ${{ inputs.trunk-org-slug }} TRUNK_API_TOKEN: ${{ inputs.trunk-token }} + # Fix for macOS 15 Intel connection failures due to "Happy Eyeballs" algorithm + # See: https://bugs.ruby-lang.org/issues/21104 + RUBY_TCP_NO_FAST_FALLBACK: 1 + TRUNK_DEBUG: 1 diff --git a/.github/workflows/release_ruby_gem.yml b/.github/workflows/release_ruby_gem.yml index e208f867..759fccb1 100644 --- a/.github/workflows/release_ruby_gem.yml +++ b/.github/workflows/release_ruby_gem.yml @@ -42,9 +42,6 @@ jobs: strategy: matrix: platform: - - x86_64-linux - - aarch64-linux - - arm64-darwin - x86_64-darwin steps: - uses: actions/checkout@v4 @@ -77,6 +74,8 @@ jobs: file: context-ruby/context_ruby.gemspec - uses: oxidize-rb/actions/cross-gem@v1 + env: + CARGO_PROFILE_RELEASE_OPT_LEVEL: "1" with: platform: ${{ matrix.platform }} working-directory: context-ruby @@ -97,12 +96,6 @@ jobs: matrix: ruby-version: ["3.0", "3.1", "3.2", "3.3", "3.4"] platform: - - name: x86_64-linux - os: ubuntu-latest - - name: aarch64-linux - os: ubuntu-24.04-arm - - name: arm64-darwin - os: macos-latest - name: x86_64-darwin os: macos-15-intel steps: @@ -115,24 +108,24 @@ jobs: platform: ${{ matrix.platform.name }} artifact-pattern: cross-gem-${{ matrix.platform.name }} - publish_ruby_gem: - runs-on: ubuntu-latest - needs: test-ruby-gem - steps: - - uses: actions/checkout@v4 + # publish_ruby_gem: + # runs-on: ubuntu-latest + # needs: test-ruby-gem + # steps: + # - uses: actions/checkout@v4 - - uses: rubygems/configure-rubygems-credentials@main - with: - role-to-assume: rg_oidc_akr_vxb9d9w6dob8q6sr6jz5 - - uses: actions/download-artifact@v4 - with: - pattern: cross-gem-* - path: context-ruby/pkg/ - merge-multiple: true - - working-directory: context-ruby - run: | - set -euxo pipefail - find pkg - for i in $(ls pkg/*.gem); do - gem push $i - done + # - uses: rubygems/configure-rubygems-credentials@main + # with: + # role-to-assume: rg_oidc_akr_vxb9d9w6dob8q6sr6jz5 + # - uses: actions/download-artifact@v4 + # with: + # pattern: cross-gem-* + # path: context-ruby/pkg/ + # merge-multiple: true + # - working-directory: context-ruby + # run: | + # set -euxo pipefail + # find pkg + # for i in $(ls pkg/*.gem); do + # gem push $i + # done diff --git a/Cargo.lock b/Cargo.lock index aa0adaa3..969e57bf 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -773,12 +773,6 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" -[[package]] -name = "cfg_aliases" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "613afe47fcd5fac7ccf1db93babcb082c5994d996f20b8b159f2ad1658eb5724" - [[package]] name = "chrono" version = "0.4.41" @@ -1067,16 +1061,6 @@ dependencies = [ "libc", ] -[[package]] -name = "core-foundation" -version = "0.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b55271e5c8c478ad3f38ad24ef34923091e0548492a266d19b3c0b4d82574c63" -dependencies = [ - "core-foundation-sys", - "libc", -] - [[package]] name = "core-foundation-sys" version = "0.8.7" @@ -1190,6 +1174,12 @@ dependencies = [ "syn 1.0.109", ] +[[package]] +name = "data-encoding" +version = "2.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2a2330da5de22e8a3cb63252ce2abb30116bf5265e89c0e01bc17015ce30a476" + [[package]] name = "debugid" version = "0.8.0" @@ -1323,6 +1313,18 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "34aa73646ffb006b8f5147f3dc182bd4bcb190227ce861fc4a4844bf8e3cb2c0" +[[package]] +name = "enum-as-inner" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a1e6a265c649f3f5979b601d26f1d05ada116434c87741c9493cb56218f76cbc" +dependencies = [ + "heck 0.5.0", + "proc-macro2", + "quote", + "syn 2.0.98", +] + [[package]] name = "env_filter" version = "0.1.2" @@ -1676,10 +1678,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c4567c8db10ae91089c99af84c68c38da3ec2f087c3f82960bcdbf3656b6f4d7" dependencies = [ "cfg-if", - "js-sys", "libc", "wasi", - "wasm-bindgen", ] [[package]] @@ -2266,6 +2266,51 @@ version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" +[[package]] +name = "hickory-proto" +version = "0.24.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "92652067c9ce6f66ce53cc38d1169daa36e6e7eb7dd3b63b5103bd9d97117248" +dependencies = [ + "async-trait", + "cfg-if", + "data-encoding", + "enum-as-inner", + "futures-channel", + "futures-io", + "futures-util", + "idna", + "ipnet", + "once_cell", + "rand", + "thiserror 1.0.69", + "tinyvec", + "tokio", + "tracing", + "url", +] + +[[package]] +name = "hickory-resolver" +version = "0.24.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cbb117a1ca520e111743ab2f6688eddee69db4e0ea242545a604dce8a66fd22e" +dependencies = [ + "cfg-if", + "futures-util", + "hickory-proto", + "ipconfig", + "lru-cache", + "once_cell", + "parking_lot", + "rand", + "resolv-conf", + "smallvec", + "thiserror 1.0.69", + "tokio", + "tracing", +] + [[package]] name = "home" version = "0.5.9" @@ -2404,24 +2449,6 @@ dependencies = [ "want", ] -[[package]] -name = "hyper-rustls" -version = "0.27.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08afdbb5c31130e3034af566421053ab03787c640246a446327f550d11bcb333" -dependencies = [ - "futures-util", - "http 1.2.0", - "hyper 1.5.1", - "hyper-util", - "rustls", - "rustls-native-certs", - "rustls-pki-types", - "tokio", - "tokio-rustls", - "tower-service", -] - [[package]] name = "hyper-timeout" version = "0.4.1" @@ -2663,6 +2690,18 @@ version = "0.3.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f958d3d68f4167080a18141e10381e7634563984a537f2a49a30fd8e53ac5767" +[[package]] +name = "ipconfig" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b58db92f96b720de98181bbbe63c831e87005ab460c1bf306eb2622b4707997f" +dependencies = [ + "socket2", + "widestring", + "windows-sys 0.48.0", + "winreg", +] + [[package]] name = "ipnet" version = "2.10.1" @@ -2878,6 +2917,12 @@ dependencies = [ "vcpkg", ] +[[package]] +name = "linked-hash-map" +version = "0.5.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0717cef1bc8b636c6e1c1bbdefc09e6322da8a9321966e8928ef80d20f7f770f" + [[package]] name = "linux-raw-sys" version = "0.4.14" @@ -2948,6 +2993,15 @@ dependencies = [ "logos-codegen", ] +[[package]] +name = "lru-cache" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "31e24f1ad8321ca0e8a1e0ac13f23cb668e6f5466c2c57319f6a5cf1cc8e3b1c" +dependencies = [ + "linked-hash-map", +] + [[package]] name = "magnus" version = "0.7.1" @@ -3132,7 +3186,7 @@ dependencies = [ "openssl-probe", "openssl-sys", "schannel", - "security-framework 2.11.1", + "security-framework", "security-framework-sys", "tempfile", ] @@ -4066,58 +4120,6 @@ dependencies = [ "memchr", ] -[[package]] -name = "quinn" -version = "0.11.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62e96808277ec6f97351a2380e6c25114bc9e67037775464979f3037c92d05ef" -dependencies = [ - "bytes", - "pin-project-lite", - "quinn-proto", - "quinn-udp", - "rustc-hash 2.1.0", - "rustls", - "socket2", - "thiserror 2.0.11", - "tokio", - "tracing", -] - -[[package]] -name = "quinn-proto" -version = "0.11.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a2fe5ef3495d7d2e377ff17b1a8ce2ee2ec2a18cde8b6ad6619d65d0701c135d" -dependencies = [ - "bytes", - "getrandom", - "rand", - "ring", - "rustc-hash 2.1.0", - "rustls", - "rustls-pki-types", - "slab", - "thiserror 2.0.11", - "tinyvec", - "tracing", - "web-time", -] - -[[package]] -name = "quinn-udp" -version = "0.5.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7d5a626c6807713b15cac82a6acaccd6043c9a5408c24baae07611fec3f243da" -dependencies = [ - "cfg_aliases", - "libc", - "once_cell", - "socket2", - "tracing", - "windows-sys 0.59.0", -] - [[package]] name = "quote" version = "1.0.37" @@ -4292,11 +4294,11 @@ dependencies = [ "futures-channel", "futures-core", "futures-util", + "hickory-resolver", "http 1.2.0", "http-body 1.0.1", "http-body-util", "hyper 1.5.1", - "hyper-rustls", "hyper-tls", "hyper-util", "ipnet", @@ -4307,18 +4309,13 @@ dependencies = [ "once_cell", "percent-encoding", "pin-project-lite", - "quinn", - "rustls", - "rustls-native-certs", "rustls-pemfile", - "rustls-pki-types", "serde", "serde_json", "serde_urlencoded", "sync_wrapper 1.0.2", "tokio", "tokio-native-tls", - "tokio-rustls", "tokio-util", "tower-service", "url", @@ -4330,19 +4327,10 @@ dependencies = [ ] [[package]] -name = "ring" -version = "0.17.8" +name = "resolv-conf" +version = "0.7.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c17fa4cb658e3583423e915b9f3acc01cceaee1860e33d59ebae66adc3a2dc0d" -dependencies = [ - "cc", - "cfg-if", - "getrandom", - "libc", - "spin", - "untrusted", - "windows-sys 0.52.0", -] +checksum = "6b3789b30bd25ba102de4beabd95d21ac45b69b1be7d14522bab988c526d6799" [[package]] name = "rustc-demangle" @@ -4397,32 +4385,6 @@ dependencies = [ "windows-sys 0.59.0", ] -[[package]] -name = "rustls" -version = "0.23.19" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "934b404430bb06b3fae2cba809eb45a1ab1aecd64491213d7c3301b88393f8d1" -dependencies = [ - "once_cell", - "ring", - "rustls-pki-types", - "rustls-webpki", - "subtle", - "zeroize", -] - -[[package]] -name = "rustls-native-certs" -version = "0.8.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7fcff2dd52b58a8d98a70243663a0d234c4e2b79235637849d15913394a247d3" -dependencies = [ - "openssl-probe", - "rustls-pki-types", - "schannel", - "security-framework 3.0.1", -] - [[package]] name = "rustls-pemfile" version = "2.2.0" @@ -4437,20 +4399,6 @@ name = "rustls-pki-types" version = "1.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "16f1201b3c9a7ee8039bcadc17b7e605e2945b27eee7631788c1bd2b0643674b" -dependencies = [ - "web-time", -] - -[[package]] -name = "rustls-webpki" -version = "0.102.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "64ca1bc8749bd4cf37b5ce386cc146580777b4e8572c7b97baf22c83f444bee9" -dependencies = [ - "ring", - "rustls-pki-types", - "untrusted", -] [[package]] name = "rustversion" @@ -4534,20 +4482,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "897b2245f0b511c87893af39b033e5ca9cce68824c4d7e7630b5a1d339658d02" dependencies = [ "bitflags 2.9.1", - "core-foundation 0.9.4", - "core-foundation-sys", - "libc", - "security-framework-sys", -] - -[[package]] -name = "security-framework" -version = "3.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e1415a607e92bec364ea2cf9264646dcce0f91e6d65281bd6f2819cca3bf39c8" -dependencies = [ - "bitflags 2.9.1", - "core-foundation 0.10.0", + "core-foundation", "core-foundation-sys", "libc", "security-framework-sys", @@ -4967,12 +4902,6 @@ dependencies = [ "strum_macros", ] -[[package]] -name = "spin" -version = "0.9.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6980e8d7511241f8acf4aebddbb1ff938df5eebe98691418c4468d0b72a96a67" - [[package]] name = "stable_deref_trait" version = "1.2.0" @@ -5022,12 +4951,6 @@ dependencies = [ "syn 2.0.98", ] -[[package]] -name = "subtle" -version = "2.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" - [[package]] name = "superconsole" version = "0.2.0" @@ -5236,6 +5159,7 @@ dependencies = [ "constants", "context", "env_logger", + "http 1.2.0", "js-sys", "log", "magnus", @@ -5243,6 +5167,7 @@ dependencies = [ "prost", "prost-wkt-types", "proto", + "reqwest", "sentry-tracing", "serde_json", "serial_test", @@ -5253,6 +5178,7 @@ dependencies = [ "tracing", "tracing-subscriber", "trunk-analytics-cli", + "url", "wasm-bindgen", ] @@ -5455,16 +5381,6 @@ dependencies = [ "tokio", ] -[[package]] -name = "tokio-rustls" -version = "0.26.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f6d0975eaace0cf0fcadee4e4aaa5da15b5c079146f2cffb67c113be122bf37" -dependencies = [ - "rustls", - "tokio", -] - [[package]] name = "tokio-stream" version = "0.1.17" @@ -5897,12 +5813,6 @@ version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c7de7d73e1754487cb58364ee906a499937a0dfabd86bcb980fa99ec8c8fa2ce" -[[package]] -name = "untrusted" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1" - [[package]] name = "ureq" version = "2.12.1" @@ -6150,16 +6060,6 @@ dependencies = [ "wasm-bindgen", ] -[[package]] -name = "web-time" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a6580f308b1fad9207618087a65c04e7a10bc77e02c8e84e9b00dd4b12fa0bb" -dependencies = [ - "js-sys", - "wasm-bindgen", -] - [[package]] name = "wezterm-bidi" version = "0.2.3" @@ -6219,6 +6119,12 @@ dependencies = [ "syn 1.0.109", ] +[[package]] +name = "widestring" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72069c3113ab32ab29e5584db3c6ec55d416895e60715417b5b883a357c3e471" + [[package]] name = "winapi" version = "0.3.9" @@ -6462,6 +6368,16 @@ dependencies = [ "memchr", ] +[[package]] +name = "winreg" +version = "0.50.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "524e57b2c537c0f9b1e69f1965311ec12182b4122e45035b1508cd24d2adadb1" +dependencies = [ + "cfg-if", + "windows-sys 0.48.0", +] + [[package]] name = "write16" version = "1.0.0" @@ -6579,12 +6495,6 @@ dependencies = [ "synstructure", ] -[[package]] -name = "zeroize" -version = "1.8.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ced3678a2879b30306d323f4542626697a464a97c0a07c9aebf7ebca65cd4dde" - [[package]] name = "zerovec" version = "0.10.4" diff --git a/api/Cargo.toml b/api/Cargo.toml index 366e4e6e..0aa470ea 100644 --- a/api/Cargo.toml +++ b/api/Cargo.toml @@ -15,9 +15,10 @@ tokio = { version = "*", default-features = false, features = [ ] } anyhow = "1.0.44" reqwest = { version = "0.12.5", default-features = false, features = [ - "rustls-tls-native-roots", + "native-tls", "stream", "json", + "hickory-dns", ] } log = "0.4.14" http = "1.1.0" diff --git a/cli/Cargo.toml b/cli/Cargo.toml index e77a97b8..6f6b5075 100644 --- a/cli/Cargo.toml +++ b/cli/Cargo.toml @@ -38,9 +38,10 @@ tracing-log = "0.2.0" tracing-subscriber = "0.3.19" glob = "0.3.0" reqwest = { version = "0.12.5", default-features = false, features = [ - "rustls-tls-native-roots", + "native-tls", "stream", "json", + "hickory-dns", ] } codeowners = { path = "../codeowners" } xcresult = { path = "../xcresult" } diff --git a/context-ruby/Cargo.lock b/context-ruby/Cargo.lock index 1d6ca82f..7e293817 100644 --- a/context-ruby/Cargo.lock +++ b/context-ruby/Cargo.lock @@ -415,7 +415,7 @@ dependencies = [ "proc-macro2", "quote", "regex", - "rustc-hash 1.1.0", + "rustc-hash", "shlex", "syn 2.0.96", ] @@ -592,12 +592,6 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" -[[package]] -name = "cfg_aliases" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "613afe47fcd5fac7ccf1db93babcb082c5994d996f20b8b159f2ad1658eb5724" - [[package]] name = "chrono" version = "0.4.39" @@ -815,16 +809,6 @@ dependencies = [ "libc", ] -[[package]] -name = "core-foundation" -version = "0.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b55271e5c8c478ad3f38ad24ef34923091e0548492a266d19b3c0b4d82574c63" -dependencies = [ - "core-foundation-sys", - "libc", -] - [[package]] name = "core-foundation-sys" version = "0.8.7" @@ -928,6 +912,12 @@ dependencies = [ "phf 0.11.3", ] +[[package]] +name = "data-encoding" +version = "2.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2a2330da5de22e8a3cb63252ce2abb30116bf5265e89c0e01bc17015ce30a476" + [[package]] name = "debugid" version = "0.8.0" @@ -1037,6 +1027,18 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "34aa73646ffb006b8f5147f3dc182bd4bcb190227ce861fc4a4844bf8e3cb2c0" +[[package]] +name = "enum-as-inner" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a1e6a265c649f3f5979b601d26f1d05ada116434c87741c9493cb56218f76cbc" +dependencies = [ + "heck 0.5.0", + "proc-macro2", + "quote", + "syn 2.0.96", +] + [[package]] name = "env_filter" version = "0.1.3" @@ -1332,10 +1334,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c4567c8db10ae91089c99af84c68c38da3ec2f087c3f82960bcdbf3656b6f4d7" dependencies = [ "cfg-if", - "js-sys", "libc", "wasi", - "wasm-bindgen", ] [[package]] @@ -1869,6 +1869,51 @@ version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" +[[package]] +name = "hickory-proto" +version = "0.24.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "92652067c9ce6f66ce53cc38d1169daa36e6e7eb7dd3b63b5103bd9d97117248" +dependencies = [ + "async-trait", + "cfg-if", + "data-encoding", + "enum-as-inner", + "futures-channel", + "futures-io", + "futures-util", + "idna", + "ipnet", + "once_cell", + "rand", + "thiserror 1.0.69", + "tinyvec", + "tokio", + "tracing", + "url", +] + +[[package]] +name = "hickory-resolver" +version = "0.24.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cbb117a1ca520e111743ab2f6688eddee69db4e0ea242545a604dce8a66fd22e" +dependencies = [ + "cfg-if", + "futures-util", + "hickory-proto", + "ipconfig", + "lru-cache", + "once_cell", + "parking_lot", + "rand", + "resolv-conf", + "smallvec", + "thiserror 1.0.69", + "tokio", + "tracing", +] + [[package]] name = "home" version = "0.5.9" @@ -1976,24 +2021,6 @@ dependencies = [ "want", ] -[[package]] -name = "hyper-rustls" -version = "0.27.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2d191583f3da1305256f22463b9bb0471acad48a4e534a5218b9963e9c1f59b2" -dependencies = [ - "futures-util", - "http 1.2.0", - "hyper", - "hyper-util", - "rustls", - "rustls-native-certs", - "rustls-pki-types", - "tokio", - "tokio-rustls", - "tower-service", -] - [[package]] name = "hyper-tls" version = "0.6.0" @@ -2210,6 +2237,18 @@ dependencies = [ "rustversion", ] +[[package]] +name = "ipconfig" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b58db92f96b720de98181bbbe63c831e87005ab460c1bf306eb2622b4707997f" +dependencies = [ + "socket2", + "widestring", + "windows-sys 0.48.0", + "winreg", +] + [[package]] name = "ipnet" version = "2.11.0" @@ -2357,6 +2396,12 @@ dependencies = [ "redox_syscall 0.5.8", ] +[[package]] +name = "linked-hash-map" +version = "0.5.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0717cef1bc8b636c6e1c1bbdefc09e6322da8a9321966e8928ef80d20f7f770f" + [[package]] name = "linux-raw-sys" version = "0.4.15" @@ -2427,6 +2472,15 @@ dependencies = [ "logos-codegen", ] +[[package]] +name = "lru-cache" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "31e24f1ad8321ca0e8a1e0ac13f23cb668e6f5466c2c57319f6a5cf1cc8e3b1c" +dependencies = [ + "linked-hash-map", +] + [[package]] name = "magnus" version = "0.7.1" @@ -2565,7 +2619,7 @@ dependencies = [ "openssl-probe", "openssl-sys", "schannel", - "security-framework 2.11.1", + "security-framework", "security-framework-sys", "tempfile", ] @@ -3300,58 +3354,6 @@ dependencies = [ "memchr", ] -[[package]] -name = "quinn" -version = "0.11.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62e96808277ec6f97351a2380e6c25114bc9e67037775464979f3037c92d05ef" -dependencies = [ - "bytes", - "pin-project-lite", - "quinn-proto", - "quinn-udp", - "rustc-hash 2.1.0", - "rustls", - "socket2", - "thiserror 2.0.11", - "tokio", - "tracing", -] - -[[package]] -name = "quinn-proto" -version = "0.11.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a2fe5ef3495d7d2e377ff17b1a8ce2ee2ec2a18cde8b6ad6619d65d0701c135d" -dependencies = [ - "bytes", - "getrandom", - "rand", - "ring", - "rustc-hash 2.1.0", - "rustls", - "rustls-pki-types", - "slab", - "thiserror 2.0.11", - "tinyvec", - "tracing", - "web-time", -] - -[[package]] -name = "quinn-udp" -version = "0.5.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1c40286217b4ba3a71d644d752e6a0b71f13f1b6a2c5311acfcbe0c2418ed904" -dependencies = [ - "cfg_aliases", - "libc", - "once_cell", - "socket2", - "tracing", - "windows-sys 0.59.0", -] - [[package]] name = "quote" version = "1.0.38" @@ -3520,11 +3522,11 @@ dependencies = [ "futures-channel", "futures-core", "futures-util", + "hickory-resolver", "http 1.2.0", "http-body 1.0.1", "http-body-util", "hyper", - "hyper-rustls", "hyper-tls", "hyper-util", "ipnet", @@ -3535,18 +3537,13 @@ dependencies = [ "once_cell", "percent-encoding", "pin-project-lite", - "quinn", - "rustls", - "rustls-native-certs", "rustls-pemfile", - "rustls-pki-types", "serde", "serde_json", "serde_urlencoded", "sync_wrapper", "tokio", "tokio-native-tls", - "tokio-rustls", "tokio-util", "tower", "tower-service", @@ -3559,18 +3556,10 @@ dependencies = [ ] [[package]] -name = "ring" -version = "0.17.14" +name = "resolv-conf" +version = "0.7.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4689e6c2294d81e88dc6261c768b63bc4fcdb852be6d1352498b114f61383b7" -dependencies = [ - "cc", - "cfg-if", - "getrandom", - "libc", - "untrusted", - "windows-sys 0.52.0", -] +checksum = "6b3789b30bd25ba102de4beabd95d21ac45b69b1be7d14522bab988c526d6799" [[package]] name = "rustc-demangle" @@ -3584,12 +3573,6 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" -[[package]] -name = "rustc-hash" -version = "2.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c7fb8039b3032c191086b10f11f319a6e99e1e82889c5cc6046f515c9db1d497" - [[package]] name = "rustc_version" version = "0.4.1" @@ -3625,32 +3608,6 @@ dependencies = [ "windows-sys 0.59.0", ] -[[package]] -name = "rustls" -version = "0.23.21" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f287924602bf649d949c63dc8ac8b235fa5387d394020705b80c4eb597ce5b8" -dependencies = [ - "once_cell", - "ring", - "rustls-pki-types", - "rustls-webpki", - "subtle", - "zeroize", -] - -[[package]] -name = "rustls-native-certs" -version = "0.8.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7fcff2dd52b58a8d98a70243663a0d234c4e2b79235637849d15913394a247d3" -dependencies = [ - "openssl-probe", - "rustls-pki-types", - "schannel", - "security-framework 3.2.0", -] - [[package]] name = "rustls-pemfile" version = "2.2.0" @@ -3665,20 +3622,6 @@ name = "rustls-pki-types" version = "1.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d2bf47e6ff922db3825eb750c4e2ff784c6ff8fb9e13046ef6a1d1c5401b0b37" -dependencies = [ - "web-time", -] - -[[package]] -name = "rustls-webpki" -version = "0.102.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "64ca1bc8749bd4cf37b5ce386cc146580777b4e8572c7b97baf22c83f444bee9" -dependencies = [ - "ring", - "rustls-pki-types", - "untrusted", -] [[package]] name = "rustversion" @@ -3747,20 +3690,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "897b2245f0b511c87893af39b033e5ca9cce68824c4d7e7630b5a1d339658d02" dependencies = [ "bitflags 2.8.0", - "core-foundation 0.9.4", - "core-foundation-sys", - "libc", - "security-framework-sys", -] - -[[package]] -name = "security-framework" -version = "3.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "271720403f46ca04f7ba6f55d438f8bd878d6b8ca0a1046e8228c4145bcbb316" -dependencies = [ - "bitflags 2.8.0", - "core-foundation 0.10.0", + "core-foundation", "core-foundation-sys", "libc", "security-framework-sys", @@ -4181,12 +4111,6 @@ dependencies = [ "syn 2.0.96", ] -[[package]] -name = "subtle" -version = "2.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" - [[package]] name = "superconsole" version = "0.2.0" @@ -4370,11 +4294,13 @@ dependencies = [ "constants", "context", "env_logger", + "http 1.2.0", "log", "magnus", "prost", "prost-wkt-types", "proto", + "reqwest", "sentry-tracing", "serde_json", "tempfile", @@ -4383,6 +4309,7 @@ dependencies = [ "tracing", "tracing-subscriber", "trunk-analytics-cli", + "url", ] [[package]] @@ -4552,16 +4479,6 @@ dependencies = [ "tokio", ] -[[package]] -name = "tokio-rustls" -version = "0.26.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f6d0975eaace0cf0fcadee4e4aaa5da15b5c079146f2cffb67c113be122bf37" -dependencies = [ - "rustls", - "tokio", -] - [[package]] name = "tokio-stream" version = "0.1.17" @@ -4899,12 +4816,6 @@ version = "0.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ebc1c04c71510c7f702b52b7c350734c9ff1295c464a03335b00bb84fc54f853" -[[package]] -name = "untrusted" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1" - [[package]] name = "ureq" version = "2.12.1" @@ -5135,16 +5046,6 @@ dependencies = [ "wasm-bindgen", ] -[[package]] -name = "web-time" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a6580f308b1fad9207618087a65c04e7a10bc77e02c8e84e9b00dd4b12fa0bb" -dependencies = [ - "js-sys", - "wasm-bindgen", -] - [[package]] name = "wezterm-bidi" version = "0.2.3" @@ -5204,6 +5105,12 @@ dependencies = [ "syn 1.0.109", ] +[[package]] +name = "widestring" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72069c3113ab32ab29e5584db3c6ec55d416895e60715417b5b883a357c3e471" + [[package]] name = "winapi" version = "0.3.9" @@ -5441,6 +5348,16 @@ dependencies = [ "memchr", ] +[[package]] +name = "winreg" +version = "0.50.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "524e57b2c537c0f9b1e69f1965311ec12182b4122e45035b1508cd24d2adadb1" +dependencies = [ + "cfg-if", + "windows-sys 0.48.0", +] + [[package]] name = "write16" version = "1.0.0" @@ -5543,12 +5460,6 @@ dependencies = [ "synstructure", ] -[[package]] -name = "zeroize" -version = "1.8.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ced3678a2879b30306d323f4542626697a464a97c0a07c9aebf7ebca65cd4dde" - [[package]] name = "zerovec" version = "0.10.4" diff --git a/context-ruby/ext/context_ruby/extconf.rb b/context-ruby/ext/context_ruby/extconf.rb index 0b9c4c36..d5323d67 100644 --- a/context-ruby/ext/context_ruby/extconf.rb +++ b/context-ruby/ext/context_ruby/extconf.rb @@ -9,10 +9,11 @@ # https://github.com/cross-rs/cross/issues/1243#issuecomment-2102742482 r.profile = ENV.fetch('RB_SYS_CARGO_PROFILE', :dev).to_sym puts "Using profile: #{r.profile}" + r.env = { 'CARGO_PROFILE_RELEASE_OPT_LEVEL' => '1' } case RUBY_PLATFORM when 'arm64-darwin' - r.env = { 'RANLIB' => '/opt/osxcross/target/bin/arm64e-apple-darwin-ranlib' } + r.env['RANLIB'] = '/opt/osxcross/target/bin/arm64e-apple-darwin-ranlib' when 'x86_64-darwin' - r.env = { 'RANLIB' => '/opt/osxcross/target/bin/x86_64-apple-darwin-ranlib' } + r.env['RANLIB'] = '/opt/osxcross/target/bin/x86_64-apple-darwin-ranlib' end end diff --git a/test_report/Cargo.toml b/test_report/Cargo.toml index 6c934626..558a882e 100644 --- a/test_report/Cargo.toml +++ b/test_report/Cargo.toml @@ -28,6 +28,14 @@ api = { version = "0.1.0", path = "../api" } context = { version = "0.1.0", path = "../context" } codeowners = { version = "0.1.3", path = "../codeowners" } constants = { path = "../constants" } +reqwest = { version = "0.12.5", default-features = false, features = [ + "blocking", + "native-tls", + "json", + "hickory-dns", +] } +http = "1.1.0" +url = "2.5.4" [dev-dependencies] assert_matches = "1.5.0" diff --git a/test_report/src/report.rs b/test_report/src/report.rs index 0dbb37d9..3cdead65 100644 --- a/test_report/src/report.rs +++ b/test_report/src/report.rs @@ -3,7 +3,7 @@ use std::{ collections::HashMap, env, fs, path::{Path, PathBuf}, - time::SystemTime, + time::{Duration, SystemTime}, }; use api::{client::ApiClient, message}; @@ -11,7 +11,9 @@ use bundle::BundleMetaDebugProps; use bundle::Test; use chrono::prelude::*; use codeowners::CodeOwners; +use constants::TRUNK_API_TOKEN_ENV; use context::repo::{BundleRepo, RepoUrlParts}; +use http::{header::HeaderMap, HeaderValue}; #[cfg(feature = "ruby")] use magnus::{value::ReprValue, Module, Object}; use prost_wkt_types::Timestamp; @@ -19,9 +21,13 @@ use proto::test_context::test_run::{ CodeOwner, TestCaseRun, TestCaseRunStatus, TestReport as TestReportProto, TestResult, UploaderMetadata, }; +use reqwest::blocking::Client; +use reqwest::header; +use reqwest::StatusCode; use third_party::sentry; use tracing_subscriber::{filter::FilterFn, prelude::*}; use trunk_analytics_cli::{context::gather_initial_test_context, upload_command::run_upload}; +use url::Url; #[cfg(feature = "wasm")] use wasm_bindgen::prelude::wasm_bindgen; @@ -206,7 +212,7 @@ impl MutTestReport { .with_target(true) .with_level(true) .with_writer(std::io::stdout.with_max_level(if debug_mode { - tracing::Level::DEBUG + tracing::Level::TRACE } else { tracing::Level::ERROR })) @@ -311,11 +317,8 @@ impl MutTestReport { repo: repo.clone(), }; loop { - let response = tokio::runtime::Builder::new_multi_thread() - .enable_all() - .build() - .unwrap() - .block_on(api_client.list_quarantined_tests(&request)); + let response = + Self::list_quarantined_tests_blocking(api_client, &request, &org_url_slug); match response { Ok(response) => { for test in response.quarantined_tests.iter() { @@ -340,11 +343,7 @@ impl MutTestReport { } Err(err) => { tracing::warn!("Unable to fetch quarantined tests"); - tracing::error!( - hidden_in_console = true, - "Error fetching quarantined tests: {:?}", - err - ); + tracing::error!("Error fetching quarantined tests: {:?}", err); break; } } @@ -352,6 +351,98 @@ impl MutTestReport { self.0.borrow_mut().quarantined_tests = Some(quarantined_tests); } + fn list_quarantined_tests_blocking( + api_client: &ApiClient, + request: &message::ListQuarantinedTestsRequest, + org_url_slug: &str, + ) -> anyhow::Result { + let api_token = env::var(TRUNK_API_TOKEN_ENV) + .map_err(|_| anyhow::anyhow!("Trunk API token is required."))?; + if api_token.trim().is_empty() { + return Err(anyhow::anyhow!("Trunk API token is required.")); + } + + let api_token_header_value = HeaderValue::from_str(&api_token) + .map_err(|_| anyhow::Error::msg("Trunk API token is not ASCII"))?; + + let version_path_prefix = if env::var("DEBUG_STRIP_VERSION_PREFIX").is_ok() { + String::from("") + } else { + String::from("/v1") + }; + + let mut default_headers = HeaderMap::new(); + default_headers.append( + header::CONTENT_TYPE, + HeaderValue::from_static("application/json"), + ); + default_headers.append("x-api-token", api_token_header_value); + + let client = Client::builder() + .timeout(Duration::from_secs(30)) + .default_headers(default_headers) + .build()?; + + let url = format!("https://api.trunk-staging.io/v1/flaky-tests/list-quarantined-tests"); + + let response = client.post(&url).json(request).send()?; + println!("response: {:?}", response); + println!("url: {:?}", url); + println!("request: {:?}", request); + + // Handle status codes similar to status_code_help + let response = if !response.status().is_client_error() { + response.error_for_status()? + } else { + let status = response.status(); + let error_message = match status { + StatusCode::UNAUTHORIZED => { + let domain = Url::parse(&api_client.api_host) + .ok() + .and_then(|url| url.domain().map(String::from)); + let context = "Your Trunk token may be incorrect - find it on the Trunk app (Settings -> Manage Organization -> Organization API Token -> View)."; + if let Some(present_domain) = domain { + let settings_url = format!( + "https://{}/{}/settings", + present_domain.replace("api", "app"), + org_url_slug + ); + format!( + "{}\nHint - Your settings page can be found at: {}", + context, settings_url + ) + } else { + String::from(context) + } + } + StatusCode::NOT_FOUND => { + let domain = Url::parse(&api_client.api_host) + .ok() + .and_then(|url| url.domain().map(String::from)); + let context = "Your Trunk organization URL slug may be incorrect - find it on the Trunk app (Settings -> Manage Organization -> Organization Slug)."; + if let Some(present_domain) = domain { + let settings_url = format!( + "https://{}/{}/settings", + present_domain.replace("api", "app"), + org_url_slug + ); + format!( + "{}\nHint - Your settings page can be found at: {}", + context, settings_url + ) + } else { + String::from(context) + } + } + _ => format!("Failed to list quarantined tests."), + }; + return Err(anyhow::Error::msg(error_message)); + }; + + let deserialized: message::ListQuarantinedTestsResponse = response.json()?; + Ok(deserialized) + } + fn get_org_url_slug(&self) -> String { env::var(constants::TRUNK_ORG_URL_SLUG_ENV).unwrap_or_default() }