Build the SDK gems with magnus 0.8 so they compile on Ruby 4.0
The cross build targets every Ruby >= 3.1, which includes 4.0. magnus 0.7.1 fails there because Ruby 4.0 removed RTypedData's typed_flag. magnus 0.8 compiles against both, so both gems move to it. magnus 0.8 deprecates the free exception::* functions, so auth now gets the exception classes from the Ruby handle. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Seto Elkahfi committed
Oct 24, 2026 at 12:15 UTC
cd2dd43445d10f4fbb750e0cff15a8f68c0c1ccc
5 files changed
+24
-18
sdk/gems/auth/Cargo.lock
+6
-6
@@ -834,9 +834,9 @@ checksum = "112b39cec0b298b6c1999fee3e31427f74f676e4cb9879ed1a121b43661a4154"
834
835
[[package]]
836
name = "magnus"
837
-version = "0.7.1"
837
+version = "0.8.4"
838
source = "registry+https://github.com/rust-lang/crates.io-index"
839
-checksum = "3d87ae53030f3a22e83879e666cb94e58a7bdf31706878a0ba48752994146dab"
839
+checksum = "e76237a607e1dea288dd0ef0c6c8f49037df2152d14bb52b3542c46522d9e6fc"
840
dependencies = [
841
"magnus-macros",
842
"rb-sys",
@@ -846,9 +846,9 @@ dependencies = [
846
847
[[package]]
848
name = "magnus-macros"
849
-version = "0.6.0"
849
+version = "0.8.0"
850
source = "registry+https://github.com/rust-lang/crates.io-index"
851
-checksum = "5968c820e2960565f647819f5928a42d6e874551cab9d88d75e3e0660d7f71e3"
851
+checksum = "47607461fd8e1513cb4f2076c197d8092d921a1ea75bd08af97398f593751892"
852
dependencies = [
853
"proc-macro2",
854
"quote",
@@ -1116,9 +1116,9 @@ dependencies = [
1116
1117
[[package]]
1118
name = "rb-sys-env"
1119
-version = "0.1.2"
1119
+version = "0.2.3"
1120
source = "registry+https://github.com/rust-lang/crates.io-index"
1121
-checksum = "a35802679f07360454b418a5d1735c89716bde01d35b1560fc953c1415a0b3bb"
1121
+checksum = "cca7ad6a7e21e72151d56fe2495a259b5670e204c3adac41ee7ef676ea08117a"
1122
1123
[[package]]
1124
name = "regex"
sdk/gems/auth/ext/auth/Cargo.toml
+1
-1
@@ -9,7 +9,7 @@ publish = false
9
crate-type = ["cdylib"]
10
11
[dependencies]
12
-magnus = { version = "0.7.1" }
12
+magnus = { version = "0.8" }
13
serde = { version = "1", features = ["derive"] }
14
serde_json = "1"
15
tokio = { version = "1", features = ["rt-multi-thread"] }
sdk/gems/auth/ext/auth/src/lib.rs
+10
-4
@@ -17,10 +17,16 @@ struct LoginPayload {
17
message: Option<String>,
18
}
19
20
+// Every helper here runs on the Ruby thread that called into the extension
21
+// (tokio's `block_on` stays on the calling thread), so the handle is available.
22
+fn ruby() -> Ruby {
23
+ Ruby::get().expect("smbcloud-auth called outside a Ruby thread")
24
+}
25
+
26
fn parse_environment(value: String) -> Result<Environment, Error> {
27
value.parse().map_err(|_| {
28
Error::new(
23
- magnus::exception::arg_error(),
29
+ ruby().exception_arg_error(),
30
format!("invalid environment `{value}`, expected `dev` or `production`"),
31
)
32
})
@@ -32,7 +38,7 @@ where
38
{
39
let runtime = Runtime::new().map_err(|err| {
40
Error::new(
35
- magnus::exception::runtime_error(),
41
+ ruby().exception_runtime_error(),
42
format!("failed to initialize tokio runtime: {err}"),
43
)
44
})?;
@@ -42,7 +48,7 @@ where
48
fn to_json<T: Serialize>(value: &T) -> Result<String, Error> {
49
serde_json::to_string(value).map_err(|err| {
50
Error::new(
45
- magnus::exception::runtime_error(),
51
+ ruby().exception_runtime_error(),
52
format!("failed to serialize response: {err}"),
53
)
54
})
@@ -52,7 +58,7 @@ fn raise_error_response(error: ErrorResponse) -> Error {
58
let payload = serde_json::to_string(&error).unwrap_or_else(|_| {
59
"{\"error\":{\"error_code\":0,\"message\":\"Unknown error.\"}}".to_string()
60
});
55
- Error::new(magnus::exception::runtime_error(), payload)
61
+ Error::new(ruby().exception_runtime_error(), payload)
62
}
63
64
fn login_payload(status: AccountStatus) -> LoginPayload {
sdk/gems/model/Cargo.lock
+6
-6
@@ -342,9 +342,9 @@ dependencies = [
342
343
[[package]]
344
name = "magnus"
345
-version = "0.7.1"
345
+version = "0.8.4"
346
source = "registry+https://github.com/rust-lang/crates.io-index"
347
-checksum = "3d87ae53030f3a22e83879e666cb94e58a7bdf31706878a0ba48752994146dab"
347
+checksum = "e76237a607e1dea288dd0ef0c6c8f49037df2152d14bb52b3542c46522d9e6fc"
348
dependencies = [
349
"magnus-macros",
350
"rb-sys",
@@ -354,9 +354,9 @@ dependencies = [
354
355
[[package]]
356
name = "magnus-macros"
357
-version = "0.6.0"
357
+version = "0.8.0"
358
source = "registry+https://github.com/rust-lang/crates.io-index"
359
-checksum = "5968c820e2960565f647819f5928a42d6e874551cab9d88d75e3e0660d7f71e3"
359
+checksum = "47607461fd8e1513cb4f2076c197d8092d921a1ea75bd08af97398f593751892"
360
dependencies = [
361
"proc-macro2",
362
"quote",
@@ -507,9 +507,9 @@ dependencies = [
507
508
[[package]]
509
name = "rb-sys-env"
510
-version = "0.1.2"
510
+version = "0.2.3"
511
source = "registry+https://github.com/rust-lang/crates.io-index"
512
-checksum = "a35802679f07360454b418a5d1735c89716bde01d35b1560fc953c1415a0b3bb"
512
+checksum = "cca7ad6a7e21e72151d56fe2495a259b5670e204c3adac41ee7ef676ea08117a"
513
514
[[package]]
515
name = "regex"
sdk/gems/model/ext/model/Cargo.toml
+1
-1
@@ -9,6 +9,6 @@ publish = false
9
crate-type = ["cdylib"]
10
11
[dependencies]
12
-magnus = { version = "0.7.1" }
12
+magnus = { version = "0.8" }
13
strum = "0.27"
14
smbcloud-model = { version = "0.7" }