diff --git a/.github/workflows/build-gems.yml b/.github/workflows/build-gems.yml index 3573c8c6..0c1b72cf 100644 --- a/.github/workflows/build-gems.yml +++ b/.github/workflows/build-gems.yml @@ -27,8 +27,8 @@ jobs: - name: Setup Ruby and Rust uses: oxidize-rb/actions/setup-ruby-and-rust@v1 with: - ruby-version: "3.4" - bundler-cache: true + ruby-version: "4.0" + bundler-cache: false # Needed so 'bundler install' doesn't run cargo-cache: true cargo-vendor: true working-directory: ./temporalio @@ -41,7 +41,8 @@ jobs: id: cross-gem working-directory: ./temporalio run: | - bundle exec rb-sys-dock --platform ${{ matrix.rubyPlatform }} --ruby-versions "3.2,3.3,3.4" --mount-toolchains --build + gem install rb_sys --no-document + rb-sys-dock --platform ${{ matrix.rubyPlatform }} --ruby-versions "3.3,3.4,4.0" --mount-toolchains --build echo "gem-path=$(find pkg -name '*-${{ matrix.rubyPlatform }}.gem')" >> $GITHUB_OUTPUT - name: Upload gem @@ -62,7 +63,7 @@ jobs: - name: Setup Ruby and Rust uses: oxidize-rb/actions/setup-ruby-and-rust@v1 with: - ruby-version: "3.4" + ruby-version: "4.0" bundler-cache: true cargo-cache: true cache-version: v1-source @@ -96,7 +97,7 @@ jobs: # does not have updated certificates and it is not easy to update them, see # https://github.com/temporalio/sdk-ruby/issues/306 os: [ubuntu-latest, macos-latest] - rubyVersion: ["3.2", "3.3", "3.4"] + rubyVersion: ["3.3", "3.4", "4.0"] # Container defaults to empty/none, but additional container for Alpine # added later container: [""] diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7572a45c..a38369e0 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -21,11 +21,11 @@ jobs: # https://github.com/temporalio/sdk-ruby/issues/172 os: [ubuntu-latest, macos-latest] # Earliest and latest supported - rubyVersion: ["3.2", "3.4"] + rubyVersion: ["3.3", "4.0"] include: - os: ubuntu-latest - rubyVersion: "3.4" + rubyVersion: "4.0" checkTarget: true docsTarget: true runs-on: ${{ matrix.os }} diff --git a/temporalio/.rubocop.yml b/temporalio/.rubocop.yml index 39551e8f..d4ab54a4 100644 --- a/temporalio/.rubocop.yml +++ b/temporalio/.rubocop.yml @@ -4,7 +4,7 @@ inherit_mode: AllCops: NewCops: enable - TargetRubyVersion: 3.2 + TargetRubyVersion: 3.3 SuggestExtensions: false Exclude: - ext/**/* diff --git a/temporalio/Cargo.lock b/temporalio/Cargo.lock index 90094c7b..38c769d5 100644 --- a/temporalio/Cargo.lock +++ b/temporalio/Cargo.lock @@ -190,11 +190,11 @@ dependencies = [ [[package]] name = "axum" -version = "0.8.7" +version = "0.8.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b098575ebe77cb6d14fc7f32749631a6e44edbef6b796f89b020e99ba20d425" +checksum = "8b52af3cb4058c895d37317bb27508dccc8e5f2d39454016b297bf4a400597b8" dependencies = [ - "axum-core 0.5.5", + "axum-core 0.5.6", "bytes", "futures-util", "http", @@ -235,9 +235,9 @@ dependencies = [ [[package]] name = "axum-core" -version = "0.5.5" +version = "0.5.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "59446ce19cd142f8833f856eb31f3eb097812d1479ab224f54d72428ca21ea22" +checksum = "08c78f31d7b1291f7ee735c1c6780ccde7785daae9a9206026862dab7d8792d1" dependencies = [ "bytes", "futures-core", @@ -333,9 +333,9 @@ dependencies = [ [[package]] name = "bumpalo" -version = "3.19.0" +version = "3.19.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "46c5e41b57b8bba42a04676d81cb89e9ee8e859a1a66f80a5a72e1cb76b34d43" +checksum = "5dd9dc738b7a8311c7ade152424974d8115f2cdad61e8dab8dac9f2362298510" [[package]] name = "byteorder" @@ -366,9 +366,9 @@ checksum = "37b2a672a2cb129a2e41c10b1224bb368f9f37a2b16b612598138befd7b37eb5" [[package]] name = "cc" -version = "1.2.48" +version = "1.2.51" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c481bdbf0ed3b892f6f806287d72acd515b352a4ec27a208489b8c1bc839633a" +checksum = "7a0aeaff4ff1a90589618835a598e545176939b97874f7abc7851caa0618f203" dependencies = [ "find-msvc-tools", "jobserver", @@ -447,9 +447,9 @@ dependencies = [ [[package]] name = "clap" -version = "4.5.53" +version = "4.5.54" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c9e340e012a1bf4935f5282ed1436d1489548e8f72308207ea5df0e23d2d03f8" +checksum = "c6e6ff9dcd79cff5cd969a17a545d79e84ab086e444102a591e288a8aa3ce394" dependencies = [ "clap_builder", "clap_derive", @@ -457,9 +457,9 @@ dependencies = [ [[package]] name = "clap_builder" -version = "4.5.53" +version = "4.5.54" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d76b5d13eaa18c901fd2f7fca939fefe3a0727a953561fefdf3b2922b8569d00" +checksum = "fa42cf4d2b7a41bc8f663a7cab4031ebafa1bf3875705bfaf8466dc60ab52c00" dependencies = [ "anstream", "anstyle", @@ -775,18 +775,18 @@ dependencies = [ [[package]] name = "derive_more" -version = "2.1.0" +version = "2.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "10b768e943bed7bf2cab53df09f4bc34bfd217cdb57d971e769874c9a6710618" +checksum = "d751e9e49156b02b44f9c1815bcb94b984cdcc4396ecc32521c739452808b134" dependencies = [ "derive_more-impl", ] [[package]] name = "derive_more-impl" -version = "2.1.0" +version = "2.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6d286bfdaf75e988b4a78e013ecd79c581e06399ab53fbacd2d916c2f904f30b" +checksum = "799a97264921d8623a957f6c3b9011f3b5492f557bbb7a5a19b7fa6d06ba8dcb" dependencies = [ "convert_case", "proc-macro2", @@ -931,9 +931,9 @@ dependencies = [ [[package]] name = "find-msvc-tools" -version = "0.1.5" +version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3a3076410a55c90011c298b04d0cfa770b00fa04e1e3c97d3f6c9de105a03844" +checksum = "645cbb3a84e60b7531617d5ae4e57f7e27308f6445f5abf653209ea76dec8dff" [[package]] name = "fixedbitset" @@ -943,13 +943,13 @@ checksum = "1d674e81391d1e1ab681a28d99df07927c6d4aa5b027d7da16ba32d1d21ecd99" [[package]] name = "flate2" -version = "1.1.7" +version = "1.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a2152dbcb980c05735e2a651d96011320a949eb31a0c8b38b72645ce97dec676" +checksum = "bfe33edd8e85a12a67454e37f8c75e730830d83e313556ab9ebf9ee7fbeb3bfb" dependencies = [ "crc32fast", + "libz-rs-sys", "miniz_oxide", - "zlib-rs", ] [[package]] @@ -1130,9 +1130,9 @@ checksum = "0cc23270f6e1808e30a928bdc84dea0b9b4136a8bc82338574f23baf47bbd280" [[package]] name = "governor" -version = "0.10.2" +version = "0.10.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e23d5986fd4364c2fb7498523540618b4b8d92eec6c36a02e565f66748e2f79" +checksum = "9efcab3c1958580ff1f25a2a41be1668f7603d849bb63af523b208a3cc1223b8" dependencies = [ "cfg-if", "dashmap", @@ -1153,9 +1153,9 @@ dependencies = [ [[package]] name = "h2" -version = "0.4.12" +version = "0.4.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f3c0b69cfcb4e1b9f1bf2f53f95f766e4661169728ec61cd3fe5a0166f2d1386" +checksum = "2f44da3a8150a6703ed5d34e164b875fd14c2cdab9af1252a9a1020bde2bdc54" dependencies = [ "atomic-waker", "bytes", @@ -1399,9 +1399,9 @@ checksum = "7aedcccd01fc5fe81e6b489c15b247b8b0690feb23304303a9e560f37efc560a" [[package]] name = "icu_properties" -version = "2.1.1" +version = "2.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e93fcd3157766c0c8da2f8cff6ce651a31f0810eaa1c51ec363ef790bbb5fb99" +checksum = "020bfc02fe870ec3a66d93e677ccca0562506e5872c650f893269e08615d74ec" dependencies = [ "icu_collections", "icu_locale_core", @@ -1413,9 +1413,9 @@ dependencies = [ [[package]] name = "icu_properties_data" -version = "2.1.1" +version = "2.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "02845b3647bb045f1100ecd6480ff52f34c35f82d9880e029d329c21d1054899" +checksum = "616c294cf8d725c6afcd8f55abc17c56464ef6211f9ed59cccffe534129c77af" [[package]] name = "icu_provider" @@ -1505,9 +1505,9 @@ checksum = "469fb0b9cefa57e3ef31275ee7cacb78f2fdca44e4765491884a2b119d4eb130" [[package]] name = "iri-string" -version = "0.7.9" +version = "0.7.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4f867b9d1d896b67beb18518eda36fdb77a32ea590de864f1325b294a6d14397" +checksum = "c91338f0783edbd6195decb37bae672fd3b165faffb89bf7b9e6942f8b1a731a" dependencies = [ "memchr", "serde", @@ -1548,9 +1548,9 @@ dependencies = [ [[package]] name = "itoa" -version = "1.0.15" +version = "1.0.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4a5f13b858c8d314ee3e8f639011f7ccefe71f97f96e50151fb991f267928e2c" +checksum = "92ecc6618181def0457392ccd0ee51198e065e016d1d527a7ac1b6dc7c1f09d2" [[package]] name = "jobserver" @@ -1592,9 +1592,9 @@ checksum = "2c4a545a15244c7d945065b5d392b2d2d7f21526fba56ce51467b06ed445e8f7" [[package]] name = "libc" -version = "0.2.178" +version = "0.2.179" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "37c93d8daa9d8a012fd8ab92f088405fb202ea0b6ab73ee2482ae66af4f42091" +checksum = "c5a2d376baa530d1238d133232d15e239abad80d05838b4b59354e5268af431f" [[package]] name = "libloading" @@ -1608,13 +1608,22 @@ dependencies = [ [[package]] name = "libredox" -version = "0.1.10" +version = "0.1.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "416f7e718bdb06000964960ffa43b4335ad4012ae8b99060261aa4a8088d5ccb" +checksum = "3d0b95e02c851351f877147b7deea7b1afb1df71b63aa5f8270716e0c5720616" dependencies = [ "bitflags", "libc", - "redox_syscall", + "redox_syscall 0.7.0", +] + +[[package]] +name = "libz-rs-sys" +version = "0.5.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c10501e7805cee23da17c7790e59df2870c0d4043ec6d03f67d31e2b53e77415" +dependencies = [ + "zlib-rs", ] [[package]] @@ -1681,9 +1690,9 @@ checksum = "112b39cec0b298b6c1999fee3e31427f74f676e4cb9879ed1a121b43661a4154" [[package]] name = "magnus" -version = "0.7.1" +version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d87ae53030f3a22e83879e666cb94e58a7bdf31706878a0ba48752994146dab" +checksum = "3b36a5b126bbe97eb0d02d07acfeb327036c6319fd816139a49824a83b7f9012" dependencies = [ "magnus-macros", "rb-sys", @@ -1693,9 +1702,9 @@ dependencies = [ [[package]] name = "magnus-macros" -version = "0.6.0" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5968c820e2960565f647819f5928a42d6e874551cab9d88d75e3e0660d7f71e3" +checksum = "47607461fd8e1513cb4f2076c197d8092d921a1ea75bd08af97398f593751892" dependencies = [ "proc-macro2", "quote", @@ -1812,9 +1821,9 @@ checksum = "38bf9645c8b145698bb0b18a4637dcacbc421ea49bef2317e4fd8065a387cf21" [[package]] name = "ntapi" -version = "0.4.1" +version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e8a3895c6391c39d7fe7ebc444a87eb2991b2a0bc718fdabd071eec617fc68e4" +checksum = "c70f219e21142367c70c0b30c6a9e3a14d55b4d12a204d897fbec83a0363f081" dependencies = [ "winapi", ] @@ -1876,9 +1885,9 @@ checksum = "d6790f58c7ff633d8771f42965289203411a5e5c68388703c06e14f24770b41e" [[package]] name = "openssl-probe" -version = "0.1.6" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d05e27ee213611ffe7d6348b942e8f942b37114c00cc03cec254295a4a17852e" +checksum = "9f50d9b3dabb09ecd771ad0aa242ca6894994c130308ca3d7684634df8037391" [[package]] name = "opentelemetry" @@ -1980,7 +1989,7 @@ checksum = "2621685985a2ebf1c516881c026032ac7deafcda1a2c9b7850dc81e3dfcb64c1" dependencies = [ "cfg-if", "libc", - "redox_syscall", + "redox_syscall 0.5.18", "smallvec", "windows-link 0.2.1", ] @@ -2078,9 +2087,9 @@ dependencies = [ [[package]] name = "portable-atomic" -version = "1.11.1" +version = "1.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f84267b20a16ea918e43c6a88433c2d54fa145c92a811b5b047ccbe153674483" +checksum = "f89776e4d69bb58bc6993e99ffa1d11f228b839984854c7daeb5d37f87cbe950" [[package]] name = "portable-atomic-util" @@ -2156,9 +2165,9 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.103" +version = "1.0.105" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ee95bc4ef87b8d5ba32e8b7714ccc834865276eab0aed5c9958d00ec45f49e8" +checksum = "535d180e0ecab6268a3e718bb9fd44db66bbbc256257165fc699dadf70d16fe7" dependencies = [ "unicode-ident", ] @@ -2422,9 +2431,9 @@ dependencies = [ [[package]] name = "quote" -version = "1.0.42" +version = "1.0.43" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a338cc41d27e6cc6dce6cefc13a0729dfbb81c262b1f519331575dd80ef3067f" +checksum = "dc74d9a594b72ae6656596548f56f667211f8a97b3d4c3d467150794690dc40a" dependencies = [ "proc-macro2", ] @@ -2525,18 +2534,18 @@ dependencies = [ [[package]] name = "rb-sys" -version = "0.9.119" +version = "0.9.124" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4519fc8de033923105f512c504a8f27714ef38648ccc30969362194c50b2ed08" +checksum = "c85c4188462601e2aa1469def389c17228566f82ea72f137ed096f21591bc489" dependencies = [ "rb-sys-build", ] [[package]] name = "rb-sys-build" -version = "0.9.119" +version = "0.9.124" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2e0109499e06c85f56df4abad7d9c642ea8a2dd821d1d7132b4d1b69534677f3" +checksum = "568068db4102230882e6d4ae8de6632e224ca75fe5970f6e026a04e91ed635d3" dependencies = [ "bindgen", "lazy_static", @@ -2549,9 +2558,9 @@ dependencies = [ [[package]] name = "rb-sys-env" -version = "0.1.2" +version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a35802679f07360454b418a5d1735c89716bde01d35b1560fc953c1415a0b3bb" +checksum = "08f8d2924cf136a1315e2b4c7460a39f62ef11ee5d522df9b2750fab55b868b6" [[package]] name = "redox_syscall" @@ -2562,6 +2571,15 @@ dependencies = [ "bitflags", ] +[[package]] +name = "redox_syscall" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "49f3fe0889e69e2ae9e41f4d6c4c0181701d00e4697b356fb1f74173a5e0ee27" +dependencies = [ + "bitflags", +] + [[package]] name = "redox_users" version = "0.5.2" @@ -2610,9 +2628,9 @@ checksum = "ba39f3699c378cd8970968dcbff9c43159ea4cfbd88d43c00b22f2ef10a435d2" [[package]] name = "reqwest" -version = "0.12.24" +version = "0.12.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d0946410b9f7b082a427e4ef5c8ff541a88b357bc6c637c40db3a68ac70a36f" +checksum = "eddd3ca559203180a307f12d114c268abf583f59b03cb906fd0b3ff8646c1147" dependencies = [ "base64 0.22.1", "bytes", @@ -2737,9 +2755,9 @@ dependencies = [ [[package]] name = "rustix" -version = "1.1.2" +version = "1.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cd15f8a2c5551a84d56efdc1cd049089e409ac19a3072d5037a17fd70719ff3e" +checksum = "146c9e247ccc180c1f61615433868c99f3de3ae256a30a43b49f67c2d9171f34" dependencies = [ "bitflags", "errno", @@ -2750,9 +2768,9 @@ dependencies = [ [[package]] name = "rustls" -version = "0.23.35" +version = "0.23.36" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "533f54bc6a7d4f647e46ad909549eda97bf5afc1585190ef692b4286b198bd8f" +checksum = "c665f33d38cea657d9614f766881e4d510e0eda4239891eea56b4cadcf01801b" dependencies = [ "log", "once_cell", @@ -2765,9 +2783,9 @@ dependencies = [ [[package]] name = "rustls-native-certs" -version = "0.8.2" +version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9980d917ebb0c0536119ba501e90834767bffc3d60641457fd84a1f3fd337923" +checksum = "612460d5f7bea540c490b2b6395d8e34a953e52b491accd6c86c8164c5932a63" dependencies = [ "openssl-probe", "rustls-pki-types", @@ -2777,9 +2795,9 @@ dependencies = [ [[package]] name = "rustls-pki-types" -version = "1.13.1" +version = "1.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "708c0f9d5f54ba0272468c1d306a52c495b31fa155e91bc25371e6df7996908c" +checksum = "21e6f2ab2928ca4291b86736a8bd920a277a399bba1589409d72154ff87c1282" dependencies = [ "web-time", "zeroize", @@ -2804,9 +2822,9 @@ checksum = "b39cdef0fa800fc44525c84ccb54a029961a8215f9619753635a9c0d2538d46d" [[package]] name = "ryu" -version = "1.0.20" +version = "1.0.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "28d3b2b1366ec20994f1fd18c3c594f05c5dd4bc44d8bb0c1c632c8d6829481f" +checksum = "a50f4cf475b65d88e057964e0e9bb1f0aa9bbb2036dc65c64596b42932536984" [[package]] name = "same-file" @@ -2899,22 +2917,22 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.145" +version = "1.0.149" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "402a6f66d8c709116cf22f558eab210f5a50187f702eb4d7e5ef38d9a7f1c79c" +checksum = "83fc039473c5595ace860d8c4fafa220ff474b3fc6bfdb4293327f1a37e94d86" dependencies = [ "itoa", "memchr", - "ryu", "serde", "serde_core", + "zmij", ] [[package]] name = "serde_spanned" -version = "1.0.3" +version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e24345aa0fe688594e73770a5f6d1b216508b4f93484c0026d521acd30134392" +checksum = "f8bbf91e5a4d6315eee45e704372590b30e260ee83af6639d64557f51b067776" dependencies = [ "serde_core", ] @@ -2942,9 +2960,9 @@ dependencies = [ [[package]] name = "shell-words" -version = "1.1.0" +version = "1.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "24188a676b6ae68c3b2cb3a01be17fbf7240ce009799bb56d5b1409051e78fde" +checksum = "dc6fe69c597f9c37bfeeeeeb33da3530379845f10be461a66d16d03eca2ded77" [[package]] name = "shlex" @@ -2954,18 +2972,19 @@ checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" [[package]] name = "signal-hook-registry" -version = "1.4.7" +version = "1.4.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7664a098b8e616bdfcc2dc0e9ac44eb231eedf41db4e9fe95d8d32ec728dedad" +checksum = "c4db69cba1110affc0e9f7bcd48bbf87b3f4fc7c61fc9155afd4c469eb3d6c1b" dependencies = [ + "errno", "libc", ] [[package]] name = "simd-adler32" -version = "0.3.7" +version = "0.3.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d66dc143e6b11c1eddc06d5c423cfc97062865baf299914ab64caa38182078fe" +checksum = "e320a6c5ad31d271ad523dcf3ad13e2767ad8b1cb8f047f75a8aeaf8da139da2" [[package]] name = "siphasher" @@ -2981,9 +3000,9 @@ checksum = "7a2ae44ef20feb57a68b23d846850f861394c2e02dc425a50098ae8c90267589" [[package]] name = "slotmap" -version = "1.0.7" +version = "1.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dbff4acf519f630b3a3ddcfaea6c06b42174d9a44bc70c620e9ed1649d58b82a" +checksum = "bdd58c3c93c3d278ca835519292445cb4b0d4dc59ccfdf7ceadaab3f8aeb4038" dependencies = [ "version_check", ] @@ -3043,9 +3062,9 @@ checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" [[package]] name = "syn" -version = "2.0.111" +version = "2.0.113" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "390cc9a294ab71bdb1aa2e99d13be9c753cd2d7bd6560c77118597410c4d2e87" +checksum = "678faa00651c9eb72dd2020cbdf275d92eccb2400d568e419efdd64838145cb4" dependencies = [ "proc-macro2", "quote", @@ -3105,9 +3124,9 @@ checksum = "591ef38edfb78ca4771ee32cf494cb8771944bee237a9b91fc9c1424ac4b777b" [[package]] name = "tempfile" -version = "3.23.0" +version = "3.24.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2d31c77bdf42a745371d260a26ca7163f1e0924b64afa0b688e61b5a9fa02f16" +checksum = "655da9c7eb6305c55742045d5a8d2037996d61d8de95806335c7c86ce0f82e9c" dependencies = [ "fastrand", "getrandom 0.3.4", @@ -3403,9 +3422,9 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" [[package]] name = "tokio" -version = "1.48.0" +version = "1.49.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ff360e02eab121e0bc37a2d3b4d4dc622e6eda3a8e5253d5435ecf5bd4c68408" +checksum = "72a2903cd7736441aac9df9d7688bd0ce48edccaadf181c3b90be801e81d3d86" dependencies = [ "bytes", "libc", @@ -3442,9 +3461,9 @@ dependencies = [ [[package]] name = "tokio-stream" -version = "0.1.17" +version = "0.1.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eca58d7bba4a75707817a2c44174253f9236b2d5fbd055602e9d5c07c139a047" +checksum = "32da49809aab5c3bc678af03902d4ccddea2a87d028d86392a4b1560c6906c70" dependencies = [ "futures-core", "pin-project-lite", @@ -3453,9 +3472,9 @@ dependencies = [ [[package]] name = "tokio-util" -version = "0.7.17" +version = "0.7.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2efa149fe76073d6e8fd97ef4f4eca7b67f599660115591483572e406e165594" +checksum = "9ae9cec805b01e8fc3fd2fe289f89149a9b66dd16786abd8b19cfa7b48cb0098" dependencies = [ "bytes", "futures-core", @@ -3466,9 +3485,9 @@ dependencies = [ [[package]] name = "toml" -version = "0.9.8" +version = "0.9.10+spec-1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f0dc8b1fb61449e27716ec0e1bdf0f6b8f3e8f6b05391e8497b8b6d7804ea6d8" +checksum = "0825052159284a1a8b4d6c0c86cbc801f2da5afd2b225fa548c72f2e74002f48" dependencies = [ "indexmap 2.12.1", "serde_core", @@ -3481,18 +3500,18 @@ dependencies = [ [[package]] name = "toml_datetime" -version = "0.7.3" +version = "0.7.5+spec-1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f2cdb639ebbc97961c51720f858597f7f24c4fc295327923af55b74c3c724533" +checksum = "92e1cfed4a3038bc5a127e35a2d360f145e1f4b971b551a2ba5fd7aedf7e1347" dependencies = [ "serde_core", ] [[package]] name = "toml_edit" -version = "0.23.7" +version = "0.23.10+spec-1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6485ef6d0d9b5d0ec17244ff7eb05310113c3f316f2d14200d4de56b3cb98f8d" +checksum = "84c8b9f757e028cee9fa244aea147aab2a9ec09d5325a9b01e0a49730c2b5269" dependencies = [ "indexmap 2.12.1", "toml_datetime", @@ -3502,18 +3521,18 @@ dependencies = [ [[package]] name = "toml_parser" -version = "1.0.4" +version = "1.0.6+spec-1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c0cbe268d35bdb4bb5a56a2de88d0ad0eb70af5384a99d648cd4b3d04039800e" +checksum = "a3198b4b0a8e11f09dd03e133c0280504d0801269e9afa46362ffde1cbeebf44" dependencies = [ "winnow", ] [[package]] name = "toml_writer" -version = "1.0.4" +version = "1.0.6+spec-1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "df8b2b54733674ad286d16267dcfc7a71ed5c776e4ac7aa3c3e2561f7c637bf2" +checksum = "ab16f14aed21ee8bfd8ec22513f7287cd4a91aa92e44edfe2c17ddd004e92607" [[package]] name = "tonic" @@ -3552,7 +3571,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "eb7613188ce9f7df5bfe185db26c5814347d110db17920415cf2fbcad85e7203" dependencies = [ "async-trait", - "axum 0.8.7", + "axum 0.8.8", "base64 0.22.1", "bytes", "h2", @@ -3656,9 +3675,9 @@ dependencies = [ [[package]] name = "tower-http" -version = "0.6.7" +version = "0.6.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9cf146f99d442e8e68e585f5d798ccd3cad9a7835b917e09728880a862706456" +checksum = "d4e6559d53cc268e5031cd8429d05415bc4cb4aefc4aa5d6cc35fbf5b924a1f8" dependencies = [ "bitflags", "bytes", @@ -3686,9 +3705,9 @@ checksum = "8df9b6e13f2d32c91b9bd719c00d1958837bc7dec474d94952798cc8e69eeec3" [[package]] name = "tracing" -version = "0.1.43" +version = "0.1.44" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2d15d90a0b5c19378952d479dc858407149d7bb45a14de0142f6c534b16fc647" +checksum = "63e71662fa4b2a2c3a26f570f037eb95bb1f85397f3cd8076caed2f026a6d100" dependencies = [ "pin-project-lite", "tracing-attributes", @@ -3708,9 +3727,9 @@ dependencies = [ [[package]] name = "tracing-core" -version = "0.1.35" +version = "0.1.36" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a04e24fab5c89c6a36eb8558c9656f30d81de51dfa4d3b45f26b21d61fa0a6c" +checksum = "db97caf9d906fbde555dd62fa95ddba9eecfd14cb388e4f491a66d74cd5fb79a" dependencies = [ "once_cell", "valuable", @@ -3787,9 +3806,9 @@ dependencies = [ [[package]] name = "unicase" -version = "2.8.1" +version = "2.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "75b844d17643ee918803943289730bec8aac480150456169e647ed0b576ba539" +checksum = "dbc4bc3a9f746d862c45cb89d705aa10f187bb96c76001afab07a0d35ce60142" [[package]] name = "unicode-ident" @@ -3817,9 +3836,9 @@ checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1" [[package]] name = "url" -version = "2.5.7" +version = "2.5.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08bc136a29a3d1758e07a9cca267be308aeebf5cfd5a10f3f67ab2097683ef5b" +checksum = "ff67a8a4397373c3ef660812acab3268222035010ab8680ec4215f38ba3d0eed" dependencies = [ "form_urlencoded", "idna", @@ -4443,9 +4462,15 @@ dependencies = [ [[package]] name = "zlib-rs" -version = "0.5.3" +version = "0.5.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "40990edd51aae2c2b6907af74ffb635029d5788228222c4bb811e9351c0caad3" + +[[package]] +name = "zmij" +version = "1.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "36134c44663532e6519d7a6dfdbbe06f6f8192bde8ae9ed076e9b213f0e31df7" +checksum = "2fc5a66a20078bf1251bde995aa2fdcc4b800c70b5d92dd2c62abc5c60f679f8" [[package]] name = "zopfli" diff --git a/temporalio/Gemfile b/temporalio/Gemfile index 7b81f446..4b8c6673 100644 --- a/temporalio/Gemfile +++ b/temporalio/Gemfile @@ -11,6 +11,7 @@ group :development do gem 'base64' gem 'grpc', '~> 1.69' gem 'grpc-tools', '~> 1.69' + gem 'irb' gem 'minitest' # Have to explicitly depend on openssl for macos issue in GH CI described at # https://github.com/rails/rails/issues/55886 until 3.4.8 is released @@ -21,10 +22,11 @@ group :development do gem 'opentelemetry-sdk' gem 'rake' gem 'rake-compiler' - gem 'rbs', '~> 3.5.3' - gem 'rb_sys', '~> 0.9.63' + gem 'rbs', '~> 3.10' + gem 'rb_sys', '~> 0.9' + gem 'rdoc' gem 'rubocop' gem 'sqlite3' - gem 'steep', '~> 1.7.1' + gem 'steep', '~> 1.10' gem 'yard' end diff --git a/temporalio/Steepfile b/temporalio/Steepfile index 3d19063c..9c1ab004 100644 --- a/temporalio/Steepfile +++ b/temporalio/Steepfile @@ -2,17 +2,32 @@ D = Steep::Diagnostic -target :lib do - signature 'sig', 'test/sig' +common_diagnostics = { + # TODO(cretz): Needed because lack of proto RBS, waiting on https://github.com/protocolbuffers/protobuf/pull/15633 + D::Ruby::UnknownConstant => :information, - check 'lib', 'test' + # Steep >= 1.9 started becoming too noisy in these cases + D::Ruby::UnannotatedEmptyCollection => :information, + D::Ruby::UndeclaredMethodDefinition => :information +} +target :lib do + signature 'sig' + check 'lib' ignore 'lib/temporalio/api', 'lib/temporalio/internal/bridge/api' - library 'uri', 'objspace' + configure_code_diagnostics do |hash| + hash.update(common_diagnostics) + end +end +target :test do + signature 'sig', 'test/sig' + check 'test' + library 'uri', 'objspace' configure_code_diagnostics do |hash| - # TODO(cretz): Fix as more protos are generated - hash[D::Ruby::UnknownConstant] = :information + hash.update(common_diagnostics) + # Steep cannot infer some things, so we can ignore them in tests + hash[D::Ruby::InsufficientKeywordArguments] = :information end end diff --git a/temporalio/ext/Cargo.toml b/temporalio/ext/Cargo.toml index da818637..7331c809 100644 --- a/temporalio/ext/Cargo.toml +++ b/temporalio/ext/Cargo.toml @@ -13,7 +13,7 @@ crate-type = ["cdylib"] async-trait = "0.1" futures = "0.3" log = "0.4" -magnus = "0.7" +magnus = "0.8" parking_lot = "0.12" prost = { workspace = true } rb-sys = "0.9" diff --git a/temporalio/ext/src/client.rs b/temporalio/ext/src/client.rs index 7311eb8c..22d3792a 100644 --- a/temporalio/ext/src/client.rs +++ b/temporalio/ext/src/client.rs @@ -6,8 +6,8 @@ use temporalio_client::{ }; use magnus::{ - DataTypeFunctions, Error, RHash, RString, Ruby, TypedData, Value, class, function, method, - prelude::*, scan_args, + DataTypeFunctions, Error, RHash, RString, Ruby, TypedData, Value, function, method, prelude::*, + scan_args, }; use tonic::{Status, metadata::MetadataKey}; use url::Url; @@ -29,7 +29,7 @@ pub(crate) const SERVICE_HEALTH: u8 = 5; pub fn init(ruby: &Ruby) -> Result<(), Error> { let root_mod = ruby.get_inner(&ROOT_MOD); - let class = root_mod.define_class("Client", class::object())?; + let class = root_mod.define_class("Client", ruby.class_object())?; class.const_set("SERVICE_WORKFLOW", SERVICE_WORKFLOW)?; class.const_set("SERVICE_OPERATOR", SERVICE_OPERATOR)?; class.const_set("SERVICE_CLOUD", SERVICE_CLOUD)?; @@ -45,7 +45,7 @@ pub fn init(ruby: &Ruby) -> Result<(), Error> { inner_class.define_method("message", method!(RpcFailure::message, 0))?; inner_class.define_method("details", method!(RpcFailure::details, 0))?; - let inner_class = class.define_class("CancellationToken", class::object())?; + let inner_class = class.define_class("CancellationToken", ruby.class_object())?; inner_class.define_singleton_method("new", function!(CancellationToken::new, 0))?; inner_class.define_method("cancel", method!(CancellationToken::cancel, 0))?; Ok(()) @@ -333,7 +333,11 @@ impl RpcFailure { if self.status.details().is_empty() { None } else { - Some(RString::from_slice(self.status.details())) + Some( + Ruby::get() + .expect("Ruby missing") + .str_from_slice(self.status.details()), + ) } } } @@ -407,7 +411,7 @@ where match result { // TODO(cretz): Any reasonable way to prevent byte copy that is just going to get decoded into proto // object? - Ok(val) => callback.push(&ruby, RString::from_slice(&val)), + Ok(val) => callback.push(&ruby, ruby.str_from_slice(&val)), Err(status) => callback.push(&ruby, RpcFailure { status }), } }, diff --git a/temporalio/ext/src/envconfig.rs b/temporalio/ext/src/envconfig.rs index adece43c..baea6676 100644 --- a/temporalio/ext/src/envconfig.rs +++ b/temporalio/ext/src/envconfig.rs @@ -1,6 +1,6 @@ use std::collections::HashMap; -use magnus::{Error, RHash, RString, Ruby, class, function, prelude::*, scan_args}; +use magnus::{Error, RHash, RString, Ruby, function, prelude::*, scan_args}; use temporalio_common::envconfig::{ ClientConfig as CoreClientConfig, ClientConfigCodec, ClientConfigProfile as CoreClientConfigProfile, ClientConfigTLS as CoreClientConfigTLS, @@ -14,7 +14,7 @@ use crate::{ROOT_MOD, error}; pub fn init(ruby: &Ruby) -> Result<(), Error> { let root_mod = ruby.get_inner(&ROOT_MOD); - let class = root_mod.define_class("EnvConfig", class::object())?; + let class = root_mod.define_class("EnvConfig", ruby.class_object())?; class.define_singleton_method("load_client_config", function!(load_client_config, -1))?; class.define_singleton_method( "load_client_connect_config", @@ -25,7 +25,7 @@ pub fn init(ruby: &Ruby) -> Result<(), Error> { } fn data_source_to_hash(ruby: &Ruby, ds: &DataSource) -> Result { - let hash = RHash::new(); + let hash = ruby.hash_new(); match ds { DataSource::Path(p) => { hash.aset(ruby.sym_new("path"), ruby.str_new(p))?; @@ -38,7 +38,7 @@ fn data_source_to_hash(ruby: &Ruby, ds: &DataSource) -> Result { } fn tls_to_hash(ruby: &Ruby, tls: &CoreClientConfigTLS) -> Result { - let hash = RHash::new(); + let hash = ruby.hash_new(); hash.aset(ruby.sym_new("disabled"), tls.disabled)?; if let Some(v) = &tls.client_cert { @@ -65,7 +65,7 @@ fn tls_to_hash(ruby: &Ruby, tls: &CoreClientConfigTLS) -> Result { } fn codec_to_hash(ruby: &Ruby, codec: &ClientConfigCodec) -> Result { - let hash = RHash::new(); + let hash = ruby.hash_new(); if let Some(v) = &codec.endpoint { hash.aset(ruby.sym_new("endpoint"), ruby.str_new(v))?; } @@ -76,7 +76,7 @@ fn codec_to_hash(ruby: &Ruby, codec: &ClientConfigCodec) -> Result } fn profile_to_hash(ruby: &Ruby, profile: &CoreClientConfigProfile) -> Result { - let hash = RHash::new(); + let hash = ruby.hash_new(); if let Some(v) = &profile.address { hash.aset(ruby.sym_new("address"), ruby.str_new(v))?; @@ -94,7 +94,7 @@ fn profile_to_hash(ruby: &Ruby, profile: &CoreClientConfigProfile) -> Result Result Result { - let profiles_hash = RHash::new(); + let profiles_hash = ruby.hash_new(); for (name, profile) in &core_config.profiles { let profile_hash = profile_to_hash(ruby, profile)?; profiles_hash.aset(ruby.str_new(name), profile_hash)?; diff --git a/temporalio/ext/src/metric.rs b/temporalio/ext/src/metric.rs index 9e07ad90..921becfa 100644 --- a/temporalio/ext/src/metric.rs +++ b/temporalio/ext/src/metric.rs @@ -2,7 +2,7 @@ use std::{any::Any, sync::Arc, time::Duration}; use magnus::{ DataTypeFunctions, Error, Float, Integer, RClass, RHash, RModule, RString, Ruby, StaticSymbol, - Symbol, TryConvert, TypedData, Value, class, function, + Symbol, TryConvert, TypedData, Value, function, gc::register_mark_object, method, prelude::*, @@ -18,18 +18,18 @@ use crate::{ROOT_MOD, error, id, runtime::Runtime, util::SendSyncBoxValue}; pub fn init(ruby: &Ruby) -> Result<(), Error> { let root_mod = ruby.get_inner(&ROOT_MOD); - let class = root_mod.define_class("Metric", class::object())?; + let class = root_mod.define_class("Metric", ruby.class_object())?; class.define_singleton_method("new", function!(Metric::new, 6))?; class.define_method("record_value", method!(Metric::record_value, 2))?; - let inner_class = class.define_class("Meter", class::object())?; + let inner_class = class.define_class("Meter", ruby.class_object())?; inner_class.define_singleton_method("new", function!(MetricMeter::new, 1))?; inner_class.define_method( "default_attributes", method!(MetricMeter::default_attributes, 0), )?; - let inner_class = class.define_class("Attributes", class::object())?; + let inner_class = class.define_class("Attributes", ruby.class_object())?; inner_class.define_method( "with_additional", method!(MetricAttributes::with_additional, 1), diff --git a/temporalio/ext/src/runtime.rs b/temporalio/ext/src/runtime.rs index 1cb7ffc0..824b6cbe 100644 --- a/temporalio/ext/src/runtime.rs +++ b/temporalio/ext/src/runtime.rs @@ -2,7 +2,7 @@ use super::{ROOT_MOD, error, id}; use crate::metric::{BufferedMetricRef, convert_metric_events}; use crate::util::{Struct, without_gvl}; use magnus::{ - DataTypeFunctions, Error, RArray, Ruby, TypedData, Value, class, function, method, prelude::*, + DataTypeFunctions, Error, RArray, Ruby, TypedData, Value, function, method, prelude::*, }; use std::collections::HashMap; use std::net::SocketAddr; @@ -25,7 +25,7 @@ use url::Url; pub fn init(ruby: &Ruby) -> Result<(), Error> { let class = ruby .get_inner(&ROOT_MOD) - .define_class("Runtime", class::object())?; + .define_class("Runtime", ruby.class_object())?; class.define_singleton_method("new", function!(Runtime::new, 1))?; class.define_method("run_command_loop", method!(Runtime::run_command_loop, 0))?; class.define_method( diff --git a/temporalio/ext/src/testing.rs b/temporalio/ext/src/testing.rs index dc2a4e4a..ac16c3b7 100644 --- a/temporalio/ext/src/testing.rs +++ b/temporalio/ext/src/testing.rs @@ -1,8 +1,6 @@ use std::time::Duration; -use magnus::{ - DataTypeFunctions, Error, Ruby, TypedData, Value, class, function, method, prelude::*, -}; +use magnus::{DataTypeFunctions, Error, Ruby, TypedData, Value, function, method, prelude::*}; use parking_lot::Mutex; use temporalio_sdk_core::ephemeral_server::{ self, EphemeralExe, EphemeralExeVersion, TemporalDevServerConfigBuilder, @@ -20,7 +18,7 @@ pub fn init(ruby: &Ruby) -> Result<(), Error> { let module = root_mod.define_module("Testing")?; - let class = module.define_class("EphemeralServer", class::object())?; + let class = module.define_class("EphemeralServer", ruby.class_object())?; class.define_singleton_method( "async_start_dev_server", function!(EphemeralServer::async_start_dev_server, 3), diff --git a/temporalio/ext/src/util.rs b/temporalio/ext/src/util.rs index acd57940..c7b1f237 100644 --- a/temporalio/ext/src/util.rs +++ b/temporalio/ext/src/util.rs @@ -26,18 +26,23 @@ impl Struct { where T: TryConvert, { + let ruby = Ruby::get().expect("Ruby missing"); self.inner.getmember::<_, T>(field).map_err(|err| { if self.field_path.is_empty() { - error!("Failed reading field '{}': {}", field.into_symbol(), err) + error!( + "Failed reading field '{}': {}", + field.into_symbol_with(&ruby), + err + ) } else { error!( "Failed reading field '{}.{}': {}", self.field_path .iter() - .map(|v| v.into_symbol().to_string()) + .map(|v| v.into_symbol_with(&ruby).to_string()) .collect::>() .join("."), - field.into_symbol(), + field.into_symbol_with(&ruby), err ) } diff --git a/temporalio/ext/src/worker.rs b/temporalio/ext/src/worker.rs index 8eff7dc3..e0eea081 100644 --- a/temporalio/ext/src/worker.rs +++ b/temporalio/ext/src/worker.rs @@ -19,7 +19,7 @@ use magnus::{ DataTypeFunctions, Error, Exception, IntoValue, RArray, RClass, RModule, RString, RTypedData, Ruby, TypedData, Value, block::Proc, - class, function, method, + function, method, prelude::*, typed_data, value::{Lazy, LazyId}, @@ -53,7 +53,7 @@ use tokio_stream::wrappers::ReceiverStream; pub fn init(ruby: &Ruby) -> Result<(), Error> { let class = ruby .get_inner(&ROOT_MOD) - .define_class("Worker", class::object())?; + .define_class("Worker", ruby.class_object())?; class.define_singleton_method("new", function!(Worker::new, 2))?; class.define_singleton_method("async_poll_all", function!(Worker::async_poll_all, 2))?; class.define_singleton_method( @@ -76,7 +76,7 @@ pub fn init(ruby: &Ruby) -> Result<(), Error> { class.define_method("replace_client", method!(Worker::replace_client, 1))?; class.define_method("initiate_shutdown", method!(Worker::initiate_shutdown, 0))?; - let inner_class = class.define_class("WorkflowReplayer", class::object())?; + let inner_class = class.define_class("WorkflowReplayer", ruby.class_object())?; inner_class.define_singleton_method("new", function!(WorkflowReplayer::new, 2))?; inner_class.define_method("push_history", method!(WorkflowReplayer::push_history, 2))?; @@ -241,15 +241,15 @@ impl Worker { }; // Call block let result: Value = match poll_result.result { - Ok(Some(val)) => RString::from_slice(&val).as_value(), + Ok(Some(val)) => ruby.str_from_slice(&val).as_value(), Ok(None) => ruby.qnil().as_value(), Err(err) => new_error!("Poll failure: {}", err).as_value(), }; callback.push( &ruby, ruby.ary_new_from_values(&[ - poll_result.worker_index.into_value(), - worker_type.into_value(), + poll_result.worker_index.into_value_with(&ruby), + worker_type.into_value_with(&ruby), result, ]), ) diff --git a/temporalio/lib/temporalio/activity/definition.rb b/temporalio/lib/temporalio/activity/definition.rb index 10637a81..413545d2 100644 --- a/temporalio/lib/temporalio/activity/definition.rb +++ b/temporalio/lib/temporalio/activity/definition.rb @@ -123,6 +123,11 @@ def execute(*args) raise NotImplementedError, 'Activity did not implement "execute"' end + # @!visibility private + def _activity_definition_details + self.class._activity_definition_details + end + # Definition info of an activity. Activities are usually classes/instances that extend {Definition}, but # definitions can also be manually created with a block via {initialize} here. class Info @@ -175,7 +180,7 @@ def self.from_activity(activity) result_hint: details[:activity_result_hint] ) { |*args| Context.current.instance&.execute(*args) } when Definition - details = activity.class._activity_definition_details + details = activity._activity_definition_details new( name: details[:activity_name], instance: activity, diff --git a/temporalio/lib/temporalio/converters/payload_converter/binary_protobuf.rb b/temporalio/lib/temporalio/converters/payload_converter/binary_protobuf.rb index e13f894b..b7cc2786 100644 --- a/temporalio/lib/temporalio/converters/payload_converter/binary_protobuf.rb +++ b/temporalio/lib/temporalio/converters/payload_converter/binary_protobuf.rb @@ -22,7 +22,10 @@ def to_payload(value, hint: nil) # rubocop:disable Lint/UnusedMethodArgument # @type var value: Google::Protobuf::MessageExts Api::Common::V1::Payload.new( - metadata: { 'encoding' => ENCODING, 'messageType' => value.class.descriptor.name }, + metadata: { + 'encoding' => ENCODING, + 'messageType' => value.class.descriptor.name # steep:ignore NoMethod + }, data: value.to_proto ) end diff --git a/temporalio/lib/temporalio/converters/payload_converter/json_protobuf.rb b/temporalio/lib/temporalio/converters/payload_converter/json_protobuf.rb index db12dce7..d09228fc 100644 --- a/temporalio/lib/temporalio/converters/payload_converter/json_protobuf.rb +++ b/temporalio/lib/temporalio/converters/payload_converter/json_protobuf.rb @@ -21,7 +21,10 @@ def to_payload(value, hint: nil) # rubocop:disable Lint/UnusedMethodArgument return nil unless value.is_a?(Google::Protobuf::MessageExts) Api::Common::V1::Payload.new( - metadata: { 'encoding' => ENCODING, 'messageType' => value.class.descriptor.name }, + metadata: { + 'encoding' => ENCODING, + 'messageType' => value.class.descriptor.name # steep:ignore NoMethod + }, data: value.to_json.b ) end diff --git a/temporalio/lib/temporalio/internal/worker/workflow_instance/externally_immutable_hash.rb b/temporalio/lib/temporalio/internal/worker/workflow_instance/externally_immutable_hash.rb index a1eeb56a..65f18773 100644 --- a/temporalio/lib/temporalio/internal/worker/workflow_instance/externally_immutable_hash.rb +++ b/temporalio/lib/temporalio/internal/worker/workflow_instance/externally_immutable_hash.rb @@ -9,7 +9,7 @@ class WorkflowInstance # Delegator to a hash that does not allow external mutations. Used for memo. class ExternallyImmutableHash < SimpleDelegator def initialize(initial_hash) - super(initial_hash.freeze) + super(initial_hash.freeze) # steep:ignore ArgumentTypeMismatch end def _update(&) diff --git a/temporalio/lib/temporalio/internal/worker/workflow_instance/handler_hash.rb b/temporalio/lib/temporalio/internal/worker/workflow_instance/handler_hash.rb index 890b8dc0..ebc58073 100644 --- a/temporalio/lib/temporalio/internal/worker/workflow_instance/handler_hash.rb +++ b/temporalio/lib/temporalio/internal/worker/workflow_instance/handler_hash.rb @@ -7,7 +7,7 @@ class WorkflowInstance # Hash for handlers that notifies when one is added. Only `[]=` and `store` can be used to mutate it. class HandlerHash < SimpleDelegator def initialize(initial_frozen_hash, definition_class, &on_new_definition) - super(initial_frozen_hash) + super(initial_frozen_hash) # steep:ignore ArgumentTypeMismatch @definition_class = definition_class @on_new_definition = on_new_definition end diff --git a/temporalio/lib/temporalio/internal/worker/workflow_instance/illegal_call_tracer.rb b/temporalio/lib/temporalio/internal/worker/workflow_instance/illegal_call_tracer.rb index 54455c1f..2852bd89 100644 --- a/temporalio/lib/temporalio/internal/worker/workflow_instance/illegal_call_tracer.rb +++ b/temporalio/lib/temporalio/internal/worker/workflow_instance/illegal_call_tracer.rb @@ -13,7 +13,7 @@ def self.frozen_validated_illegal_calls(illegal_calls) illegal_calls.to_h do |key, val| raise TypeError, 'Invalid illegal call map, top-level key must be a String' unless key.is_a?(String) - # @type var fixed_val: :all | Worker::IllegalWorkflowCallValidator | Hash[Symbol, TrueClass | Worker::IllegalWorkflowCallValidator] # rubocop:disable Layout/LineLength + # @type var fixed_val: :all | Temporalio::Worker::IllegalWorkflowCallValidator | Hash[Symbol, (true | Temporalio::Worker::IllegalWorkflowCallValidator)] fixed_val = case val when Temporalio::Worker::IllegalWorkflowCallValidator if val.method_name @@ -86,21 +86,25 @@ def initialize(illegal_calls) when Temporalio::Worker::IllegalWorkflowCallValidator disable_temporarily do vals.block.call(Temporalio::Worker::IllegalWorkflowCallValidator::CallInfo.new( - class_name:, method_name: tp.callee_id, trace_point: tp + class_name:, + method_name: tp.callee_id || :__unknown__, + trace_point: tp )) nil rescue Exception => e # rubocop:disable Lint/RescueException ", reason: #{e}" end else - per_method = vals&.[](tp.callee_id) + per_method = vals&.[](tp.callee_id || :__unknown__) case per_method when true '' when Temporalio::Worker::IllegalWorkflowCallValidator disable_temporarily do per_method.block.call(Temporalio::Worker::IllegalWorkflowCallValidator::CallInfo.new( - class_name:, method_name: tp.callee_id, trace_point: tp + class_name:, + method_name: tp.callee_id || :__unknown__, + trace_point: tp )) nil rescue Exception => e # rubocop:disable Lint/RescueException diff --git a/temporalio/lib/temporalio/internal/worker/workflow_instance/scheduler.rb b/temporalio/lib/temporalio/internal/worker/workflow_instance/scheduler.rb index 6663e7a4..21410a72 100644 --- a/temporalio/lib/temporalio/internal/worker/workflow_instance/scheduler.rb +++ b/temporalio/lib/temporalio/internal/worker/workflow_instance/scheduler.rb @@ -141,6 +141,10 @@ def fiber(&block) fiber end + def fiber_interrupt(fiber, exception) + fiber.raise(exception) if fiber.alive? + end + def io_wait(io, events, timeout) # Do not allow if IO disabled unless @instance.io_enabled diff --git a/temporalio/lib/temporalio/simple_plugin.rb b/temporalio/lib/temporalio/simple_plugin.rb index 4164c250..28854c45 100644 --- a/temporalio/lib/temporalio/simple_plugin.rb +++ b/temporalio/lib/temporalio/simple_plugin.rb @@ -121,7 +121,7 @@ def configure_worker(options) # Implements {Worker::Plugin#run_worker}. def run_worker(options, next_call) if @options.run_context - @options.run_context.call(options, next_call) # steep:ignore + @options.run_context.call(options, next_call) # steep:ignore NoMethod else next_call.call(options) end @@ -151,7 +151,7 @@ def configure_workflow_replayer(options) # Implements {Worker::Plugin#with_workflow_replay_worker}. def with_workflow_replay_worker(options, next_call) if @options.run_context - @options.run_context.call(options, next_call) # steep:ignore + @options.run_context.call(options, next_call) # steep:ignore NoMethod else next_call.call(options) end @@ -163,7 +163,7 @@ def _single_option(new:, existing:, type:, name:) when nil nil when Proc - new.call(existing).tap do |val| + new.call(existing).tap do |val| # steep:ignore NoMethod raise "Instance of #{name} required" unless val.is_a?(type) end when type @@ -179,11 +179,11 @@ def _array_option(new:, existing:, name:) when nil nil when Proc - new.call(existing).tap do |conv| + new.call(existing).tap do |conv| # steep:ignore NoMethod raise "Array for #{name} required" unless conv.is_a?(Array) end when Array - existing + new # steep:ignore + existing + new # steep:ignore NoMethod else raise "Unrecognized #{name} type #{new.class}" end diff --git a/temporalio/lib/temporalio/workflow/definition.rb b/temporalio/lib/temporalio/workflow/definition.rb index 3f362e8b..d4caa6e6 100644 --- a/temporalio/lib/temporalio/workflow/definition.rb +++ b/temporalio/lib/temporalio/workflow/definition.rb @@ -102,7 +102,9 @@ def workflow_query_attr_reader(*attr_names, description: nil) # Just run this as if done manually workflow_query(description:) - define_method(attr_name) { instance_variable_get("@#{attr_name}") } + define_method(attr_name) do + instance_variable_get("@#{attr_name}") # steep:ignore NoMethod + end end end diff --git a/temporalio/rbs_collection.lock.yaml b/temporalio/rbs_collection.lock.yaml index b5853bb2..c266f61d 100644 --- a/temporalio/rbs_collection.lock.yaml +++ b/temporalio/rbs_collection.lock.yaml @@ -2,19 +2,19 @@ path: ".gem_rbs_collection" gems: - name: activemodel - version: '7.0' + version: '7.1' source: type: git name: ruby/gem_rbs_collection - revision: 2275d263564ec90f749ea9ff8fce8160b9ed58e9 + revision: 2af46cde7fec5e4130f6c84c5b691c0538af8789 remote: https://github.com/ruby/gem_rbs_collection.git repo_dir: gems - name: activerecord - version: '7.1' + version: '8.0' source: type: git name: ruby/gem_rbs_collection - revision: 2275d263564ec90f749ea9ff8fce8160b9ed58e9 + revision: 2af46cde7fec5e4130f6c84c5b691c0538af8789 remote: https://github.com/ruby/gem_rbs_collection.git repo_dir: gems - name: activesupport @@ -22,7 +22,7 @@ gems: source: type: git name: ruby/gem_rbs_collection - revision: e9bc1bf94c262e79a2d599a9c173342915b29808 + revision: 2af46cde7fec5e4130f6c84c5b691c0538af8789 remote: https://github.com/ruby/gem_rbs_collection.git repo_dir: gems - name: async @@ -30,30 +30,50 @@ gems: source: type: git name: ruby/gem_rbs_collection - revision: e9bc1bf94c262e79a2d599a9c173342915b29808 + revision: 2af46cde7fec5e4130f6c84c5b691c0538af8789 remote: https://github.com/ruby/gem_rbs_collection.git repo_dir: gems - name: base64 - version: '0' + version: 0.3.0 source: - type: stdlib + type: rubygems - name: bigdecimal - version: '0' + version: '4.0' source: - type: stdlib + type: git + name: ruby/gem_rbs_collection + revision: 2af46cde7fec5e4130f6c84c5b691c0538af8789 + remote: https://github.com/ruby/gem_rbs_collection.git + repo_dir: gems - name: concurrent-ruby version: '1.1' source: type: git name: ruby/gem_rbs_collection - revision: e9bc1bf94c262e79a2d599a9c173342915b29808 + revision: 2af46cde7fec5e4130f6c84c5b691c0538af8789 remote: https://github.com/ruby/gem_rbs_collection.git repo_dir: gems - name: csv + version: '3.3' + source: + type: git + name: ruby/gem_rbs_collection + revision: 2af46cde7fec5e4130f6c84c5b691c0538af8789 + remote: https://github.com/ruby/gem_rbs_collection.git + repo_dir: gems +- name: date version: '0' source: type: stdlib -- name: date +- name: dbm + version: '0' + source: + type: stdlib +- name: delegate + version: '0' + source: + type: stdlib +- name: digest version: '0' source: type: stdlib @@ -74,7 +94,7 @@ gems: source: type: git name: ruby/gem_rbs_collection - revision: e9bc1bf94c262e79a2d599a9c173342915b29808 + revision: 2af46cde7fec5e4130f6c84c5b691c0538af8789 remote: https://github.com/ruby/gem_rbs_collection.git repo_dir: gems - name: grpc @@ -82,7 +102,7 @@ gems: source: type: git name: ruby/gem_rbs_collection - revision: e9bc1bf94c262e79a2d599a9c173342915b29808 + revision: 2af46cde7fec5e4130f6c84c5b691c0538af8789 remote: https://github.com/ruby/gem_rbs_collection.git repo_dir: gems - name: i18n @@ -90,9 +110,13 @@ gems: source: type: git name: ruby/gem_rbs_collection - revision: e9bc1bf94c262e79a2d599a9c173342915b29808 + revision: 2af46cde7fec5e4130f6c84c5b691c0538af8789 remote: https://github.com/ruby/gem_rbs_collection.git repo_dir: gems +- name: io-console + version: '0' + source: + type: stdlib - name: json version: '0' source: @@ -102,17 +126,21 @@ gems: source: type: stdlib - name: minitest - version: '0' + version: '5.25' source: - type: stdlib + type: git + name: ruby/gem_rbs_collection + revision: 2af46cde7fec5e4130f6c84c5b691c0538af8789 + remote: https://github.com/ruby/gem_rbs_collection.git + repo_dir: gems - name: monitor version: '0' source: type: stdlib - name: mutex_m - version: '0' + version: 0.3.0 source: - type: stdlib + type: rubygems - name: openssl version: '0' source: @@ -121,12 +149,28 @@ gems: version: '0' source: type: stdlib -- name: pathname +- name: pp + version: '0' + source: + type: stdlib +- name: prettyprint + version: '0' + source: + type: stdlib +- name: prism + version: 1.7.0 + source: + type: rubygems +- name: pstore + version: '0' + source: + type: stdlib +- name: psych version: '0' source: type: stdlib - name: rbs - version: 3.5.3 + version: 3.10.0 source: type: rubygems - name: rdoc @@ -154,9 +198,13 @@ gems: source: type: git name: ruby/gem_rbs_collection - revision: 7ae9e3cf731a9628e0cc39064ed6e2cf51d822da + revision: 2af46cde7fec5e4130f6c84c5b691c0538af8789 remote: https://github.com/ruby/gem_rbs_collection.git repo_dir: gems +- name: stringio + version: '0' + source: + type: stdlib - name: strscan version: '0' source: @@ -178,7 +226,7 @@ gems: source: type: git name: ruby/gem_rbs_collection - revision: e9bc1bf94c262e79a2d599a9c173342915b29808 + revision: 2af46cde7fec5e4130f6c84c5b691c0538af8789 remote: https://github.com/ruby/gem_rbs_collection.git repo_dir: gems - name: uri @@ -190,7 +238,7 @@ gems: source: type: git name: ruby/gem_rbs_collection - revision: e9bc1bf94c262e79a2d599a9c173342915b29808 + revision: 2af46cde7fec5e4130f6c84c5b691c0538af8789 remote: https://github.com/ruby/gem_rbs_collection.git repo_dir: gems gemfile_lock_path: Gemfile.lock diff --git a/temporalio/sig/temporalio/activity/definition.rbs b/temporalio/sig/temporalio/activity/definition.rbs index 70e3c978..9e4f8b9a 100644 --- a/temporalio/sig/temporalio/activity/definition.rbs +++ b/temporalio/sig/temporalio/activity/definition.rbs @@ -20,6 +20,15 @@ module Temporalio def execute: (*untyped) -> untyped + def _activity_definition_details: -> { + activity_name: String | Symbol | nil, + activity_executor: Symbol, + activity_cancel_raise: bool, + activity_raw_args: bool, + activity_arg_hints: Array[Object]?, + activity_result_hint: Object? + } + class Info attr_reader name: String | Symbol | nil attr_reader instance: Object | Proc | nil diff --git a/temporalio/sig/temporalio/converters/payload_converter.rbs b/temporalio/sig/temporalio/converters/payload_converter.rbs index 113de88d..5ac4c055 100644 --- a/temporalio/sig/temporalio/converters/payload_converter.rbs +++ b/temporalio/sig/temporalio/converters/payload_converter.rbs @@ -1,12 +1,12 @@ module Temporalio module Converters class PayloadConverter - def self.default: -> PayloadConverter + def self.default: -> Composite def self.new_with_defaults: ( ?json_parse_options: Hash[Symbol, untyped], ?json_generate_options: Hash[Symbol, untyped] - ) -> PayloadConverter + ) -> Composite def to_payload: (Object? value, ?hint: Object?) -> untyped def to_payloads: (Array[Object?] values, ?hints: Array[Object]?) -> untyped diff --git a/temporalio/sig/temporalio/internal/worker/workflow_instance/context.rbs b/temporalio/sig/temporalio/internal/worker/workflow_instance/context.rbs index 6eb15bfe..e2072ae7 100644 --- a/temporalio/sig/temporalio/internal/worker/workflow_instance/context.rbs +++ b/temporalio/sig/temporalio/internal/worker/workflow_instance/context.rbs @@ -81,7 +81,7 @@ module Temporalio def now: -> Time - def patched: (String patch_id) -> bool + def patched: (Symbol | String patch_id) -> bool def payload_converter: -> Converters::PayloadConverter diff --git a/temporalio/sig/temporalio/workflow.rbs b/temporalio/sig/temporalio/workflow.rbs index 74915080..96107332 100644 --- a/temporalio/sig/temporalio/workflow.rbs +++ b/temporalio/sig/temporalio/workflow.rbs @@ -17,6 +17,8 @@ module Temporalio def self.current_update_info: -> UpdateInfo? + def self.deprecate_patch: (Symbol | String patch_id) -> void + def self.execute_activity: ( singleton(Activity::Definition) | Symbol | String activity, *Object? args, @@ -91,7 +93,7 @@ module Temporalio def self.now: -> Time - def self.patched: (String patch_id) -> bool + def self.patched: (Symbol | String patch_id) -> bool def self.payload_converter: -> Converters::PayloadConverter diff --git a/temporalio/temporalio.gemspec b/temporalio/temporalio.gemspec index b989a75e..cc89a725 100644 --- a/temporalio/temporalio.gemspec +++ b/temporalio/temporalio.gemspec @@ -23,7 +23,7 @@ Gem::Specification.new do |spec| spec.require_paths = ['lib'] spec.extensions = ['ext/Cargo.toml'] spec.metadata['rubygems_mfa_required'] = 'true' - spec.required_ruby_version = '>= 3.2.0' + spec.required_ruby_version = '>= 3.3.0' spec.add_dependency 'google-protobuf', '>= 3.25.0' spec.add_dependency 'logger' diff --git a/temporalio/test/converters/payload_converter_test.rb b/temporalio/test/converters/payload_converter_test.rb index ac0431a2..09981cf2 100644 --- a/temporalio/test/converters/payload_converter_test.rb +++ b/temporalio/test/converters/payload_converter_test.rb @@ -8,13 +8,6 @@ module Converters class PayloadConverterTest < Test - # @type method assert_payload: ( - # untyped input, - # String expected_encoding, - # String expected_data, - # ?expected_decoded_input: untyped, - # ?converter: Temporalio::Converters::PayloadConverter - # ) -> untyped def assert_payload( input, expected_encoding, @@ -99,6 +92,8 @@ def test_binary_proto assert_equal 'temporal.api.common.v1.WorkflowExecution', payload.metadata['messageType'] end + # steep:ignore:start + # Need this support library for active model to work module ActiveRecordJSONSupport extend ActiveSupport::Concern @@ -186,5 +181,7 @@ def test_active_record_and_model assert_instance_of MyActiveModelObject, new_obj assert_equal obj.attributes, new_obj.attributes end + + # steep:ignore:end end end diff --git a/temporalio/test/gc_utils.rb b/temporalio/test/gc_utils.rb index a8f2aa4f..cd3c0c94 100644 --- a/temporalio/test/gc_utils.rb +++ b/temporalio/test/gc_utils.rb @@ -80,7 +80,7 @@ def find_retaining_path_to(target_id, max_depth: 12, max_visits: 250_000, catego i = parent[i] end objs = ids.reverse.map do |id| - ObjectSpace._id2ref(id) + ObjectSpace._id2ref(id) # steep:ignore rescue StandardError id end diff --git a/temporalio/test/sig/converters/payload_converter_test.rbs b/temporalio/test/sig/converters/payload_converter_test.rbs new file mode 100644 index 00000000..f22f4590 --- /dev/null +++ b/temporalio/test/sig/converters/payload_converter_test.rbs @@ -0,0 +1,11 @@ +module Converters + class PayloadConverterTest < Test + def assert_payload: ( + untyped input, + String expected_encoding, + String expected_data, + ?expected_decoded_input: untyped, + ?converter: Temporalio::Converters::PayloadConverter + ) -> untyped + end +end \ No newline at end of file diff --git a/temporalio/test/sig/gc_utils.rbs b/temporalio/test/sig/gc_utils.rbs index 0c335596..f5811350 100644 --- a/temporalio/test/sig/gc_utils.rbs +++ b/temporalio/test/sig/gc_utils.rbs @@ -6,7 +6,7 @@ module GCUtils ?category_whitelist: Array[String]? ) -> [Array[untyped], String] - def self.print_annotated_path: (Array[untyped] path, root_category: String) -> void + def self.annotated_path: (Array[untyped] path, root_category: String) -> String def self.edge_labels: (untyped parent, untyped child) -> Array[String] diff --git a/temporalio/test/sig/worker_workflow_test.rbs b/temporalio/test/sig/worker_workflow_test.rbs new file mode 100644 index 00000000..18f9bd4f --- /dev/null +++ b/temporalio/test/sig/worker_workflow_test.rbs @@ -0,0 +1,26 @@ +class WorkerWorkflowTest < Test + class NonDeterminismErrorWorkflow < Temporalio::Workflow::Definition + def execute: () -> void + def self.finish: () -> Temporalio::Workflow::Definition::Signal + end + + class PatchWorkflowBase < Temporalio::Workflow::Definition + attr_writer activity_result: untyped + end + + class ConfirmGarbageCollectWorkflow < Temporalio::Workflow::Definition + attr_accessor self.initialized_count: Integer + attr_accessor self.finalized_count: Integer + attr_accessor self.weak_instance: ConfirmGarbageCollectWorkflow? + attr_accessor self.strong_instance: ConfirmGarbageCollectWorkflow? + attr_accessor self.instance_object_id: Integer? + attr_accessor self.weak_fiber: Fiber? + attr_accessor self.fiber_object_id: Integer? + def execute: () -> void + end + + class UnsafeIOWorkflow < Temporalio::Workflow::Definition + def execute: (bool unsafe_io_enabled) -> void + def do_http_call: () -> void + end +end \ No newline at end of file diff --git a/temporalio/test/sig/workflow_utils.rbs b/temporalio/test/sig/workflow_utils.rbs index 817d09e3..830b737d 100644 --- a/temporalio/test/sig/workflow_utils.rbs +++ b/temporalio/test/sig/workflow_utils.rbs @@ -17,6 +17,7 @@ module WorkflowUtils ?id_conflict_policy: Temporalio::WorkflowIDConflictPolicy::enum, ?max_heartbeat_throttle_interval: Float, ?task_timeout: duration?, + ?interceptors: Array[Temporalio::Worker::Interceptor::Activity | Temporalio::Worker::Interceptor::Workflow], ?on_worker_run: Proc?, ?unsafe_workflow_io_enabled: bool, ?priority: Temporalio::Priority, @@ -41,6 +42,7 @@ module WorkflowUtils ?id_conflict_policy: Temporalio::WorkflowIDConflictPolicy::enum, ?max_heartbeat_throttle_interval: Float, ?task_timeout: duration?, + ?interceptors: Array[Temporalio::Worker::Interceptor::Activity | Temporalio::Worker::Interceptor::Workflow], ?on_worker_run: Proc?, ?unsafe_workflow_io_enabled: bool, ?priority: Temporalio::Priority, diff --git a/temporalio/test/test.rb b/temporalio/test/test.rb index b1c18da3..db467637 100644 --- a/temporalio/test/test.rb +++ b/temporalio/test/test.rb @@ -65,7 +65,7 @@ def self.method_added(method_name) original_method = instance_method(method_name) define_method("#{method_name}_in_fiber") do - Async do |_task| + Kernel.Async do |_task| original_method.bind(self).call end end @@ -155,8 +155,7 @@ def initialize '--dynamic-config-value', 'system.enableDeploymentVersions=true', # Enable activity pause '--dynamic-config-value', 'frontend.activityAPIsEnabled=true' - ], - dev_server_download_version: 'v1.4.1-cloud-v1-29-0-139-2.0' + ] ) Minitest.after_run do @server.shutdown diff --git a/temporalio/test/worker_workflow_handler_test.rb b/temporalio/test/worker_workflow_handler_test.rb index f89fcfb7..4e3fd48a 100644 --- a/temporalio/test/worker_workflow_handler_test.rb +++ b/temporalio/test/worker_workflow_handler_test.rb @@ -454,14 +454,14 @@ def test_unfinished_handlers_warn { 'name' => 'some_update1', 'id' => 'my-update-1' }, { 'name' => 'some_update1', 'id' => 'my-update-2' }, { 'name' => 'some_update2', 'id' => 'my-update-3' } - ], JSON.parse(trailing_arr) + ], JSON.parse(trailing_arr) # steep:ignore # Check update signal_lines = lines.select { |l| l.include?('signal handlers are still running') } assert_equal 1, signal_lines.size trailing_arr = signal_lines.first[signal_lines.first.rindex('[')..] # steep:ignore assert_equal [{ 'name' => 'some_signal1', 'count' => 2 }, { 'name' => 'some_signal2', 'count' => 1 }], - JSON.parse(trailing_arr) + JSON.parse(trailing_arr) # steep:ignore end def test_unfinished_handlers_all_finished diff --git a/temporalio/test/worker_workflow_test.rb b/temporalio/test/worker_workflow_test.rb index 679a0342..4fe96fb1 100644 --- a/temporalio/test/worker_workflow_test.rb +++ b/temporalio/test/worker_workflow_test.rb @@ -68,7 +68,7 @@ def execute(scenario) when :queue Queue.new when :sized_queue - SizedQueue.new + SizedQueue.new(100) when :mutex Mutex.new when :condvar @@ -182,9 +182,9 @@ def test_arg_count class InfoWorkflow < Temporalio::Workflow::Definition def execute Temporalio::Workflow.info.to_h.tap do |h| - h['parent'] = Temporalio::Workflow.info.parent.to_h if Temporalio::Workflow.info.parent - h['root'] = Temporalio::Workflow.info.root.to_h if Temporalio::Workflow.info.root - h['start_time'] = Temporalio::Workflow.info.start_time.to_s + h[:parent] = Temporalio::Workflow.info.parent.to_h if Temporalio::Workflow.info.parent + h[:root] = Temporalio::Workflow.info.root.to_h if Temporalio::Workflow.info.root + h[:start_time] = Temporalio::Workflow.info.start_time.to_s end end end @@ -755,8 +755,6 @@ def finish end class NonDeterminismErrorSpecificAsFailureWorkflow < NonDeterminismErrorWorkflow - # @type module: Temporalio::Workflow::Definition.class - workflow_failure_exception_type Temporalio::Workflow::NondeterminismError end @@ -899,6 +897,7 @@ def execute(scenario) Temporalio::Workflow::Future.new { Temporalio::Workflow.sleep(0.01) }, Temporalio::Workflow::Future.new { 'done' } ).wait + # @type var result: String? raise unless result == 'done' # Any of with exception @@ -1078,7 +1077,7 @@ def test_payload_codec new_options = env.client.options.with( data_converter: Temporalio::Converters::DataConverter.new(payload_codec: Base64Codec.new) ) - client = Temporalio::Client.new(**new_options.to_h) + client = Temporalio::Client.new(**new_options.to_h) # steep:ignore InsufficientKeywordArguments assert_encoded = lambda do |payload| assert_equal 'test/base64', payload.metadata['encoding'] Base64.strict_decode64(payload.data) @@ -1132,7 +1131,7 @@ def test_payload_codec # Check SA and memo on describe desc = handle.describe - assert_equal 'new-sa', desc.search_attributes[ATTR_KEY_TEXT] + assert_equal 'new-sa', desc.search_attributes&.[](ATTR_KEY_TEXT) assert_equal 'new-memo', desc.memo['some-memo-key'] end @@ -1163,7 +1162,7 @@ def test_payload_codec payload_codec: Base64Codec.new ) ) - client = Temporalio::Client.new(**new_options.to_h) + client = Temporalio::Client.new(**new_options.to_h) # steep:ignore InsufficientKeywordArguments execute_workflow( PayloadCodecWorkflow, true, activities: [PayloadCodecActivity], @@ -1243,7 +1242,7 @@ def test_dynamic class ContextFrozenWorkflow < Temporalio::Workflow::Definition workflow_init def initialize(scenario = :do_nothing) - do_bad_thing(scenario) + do_bad_thing(scenario) # steep:ignore end def execute(_scenario = :do_nothing) @@ -1252,7 +1251,7 @@ def execute(_scenario = :do_nothing) workflow_query def some_query(scenario) - do_bad_thing(scenario) + do_bad_thing(scenario) # steep:ignore end workflow_update @@ -1262,7 +1261,7 @@ def some_update(scenario) workflow_update_validator :some_update def some_update_validator(scenario) - do_bad_thing(scenario) + do_bad_thing(scenario) # steep:ignore end def do_bad_thing(scenario) @@ -1435,7 +1434,7 @@ def execute(timeout = nil) queue = Temporalio::Workflow::SizedQueue.new(1) queue.push('some-value') # Timeout only works on 3.2+ - raise 'Expected nil' if timeout && !queue.push('some-other-value', timeout:).nil? + raise 'Expected nil' if timeout && !queue.push('some-other-value', timeout:).nil? # steep:ignore queue.pop end @@ -1942,7 +1941,7 @@ def initialize self.class.weak_fiber = WeakRef.new(Fiber.current) self.class.fiber_object_id = Fiber.current.object_id - ObjectSpace.define_finalizer(self, self.class.create_finalizer) + ObjectSpace.define_finalizer(self, self.class.create_finalizer) # steep:ignore end def execute @@ -1971,11 +1970,14 @@ def test_confirm_garbage_collect loop do GC.start # Break if the instance is gone - break unless ConfirmGarbageCollectWorkflow.weak_fiber.weakref_alive? + break unless ConfirmGarbageCollectWorkflow.weak_fiber.weakref_alive? # steep:ignore # If this is last iteration, flunk w/ the path if Time.now - start_time > 10 - path, cat = GCUtils.find_retaining_path_to(ConfirmGarbageCollectWorkflow.fiber_object_id, max_depth: 12) + path, cat = GCUtils.find_retaining_path_to( + ConfirmGarbageCollectWorkflow.fiber_object_id || raise, + max_depth: 12 + ) msg = GCUtils.annotated_path(path, root_category: cat) msg += "\nPath:\n#{path.map { |p| " Item: #{p}" }.join("\n")}" # Also display any Thread/Fiber backtraces that are in the path @@ -1985,7 +1987,7 @@ def test_confirm_garbage_collect path.grep(Fiber).each do |fiber| msg += "\nFiber trace: #{fiber.backtrace.join("\n")}" end - msg += "\nOrig fiber trace: #{ConfirmGarbageCollectWorkflow.weak_fiber.backtrace.join("\n")}" + msg += "\nOrig fiber trace: #{ConfirmGarbageCollectWorkflow.weak_fiber.backtrace.join("\n")}" # steep:ignore flunk msg end sleep(0.2) @@ -2001,7 +2003,7 @@ def intercept_workflow(next_interceptor) class Inbound < Temporalio::Worker::Interceptor::Workflow::Inbound def execute(input) - Temporalio::Workflow.instance.events << 'interceptor-execute' + Temporalio::Workflow.instance.events << 'interceptor-execute' # steep:ignore super end end @@ -2009,7 +2011,7 @@ def execute(input) class ContextInstanceWorkflow < Temporalio::Workflow::Definition def execute - events << 'execute' + events << 'execute' # steep:ignore end workflow_query @@ -2360,7 +2362,7 @@ def test_workflow_metadata # Complete and check final details handle.execute_update(WorkflowMetadataWorkflow.some_update) handle.result - assert_equal 'final current details', handle.query(:__temporal_workflow_metadata).current_details + assert_equal 'final current details', handle.query(:__temporal_workflow_metadata).current_details # steep:ignore end end