From 98fef0a1ecab14ec0001ad585a28f1c46c9dc236 Mon Sep 17 00:00:00 2001 From: Richard van der Hoff Date: Thu, 23 Jul 2026 16:49:49 +0100 Subject: [PATCH 1/3] Add debug to help diagnose panics --- .github/workflows/single_sdk_tests.yml | 1 + matrix_sdk_ffi.patch | 24 ++++++++++++++++++++++++ 2 files changed, 25 insertions(+) create mode 100644 matrix_sdk_ffi.patch diff --git a/.github/workflows/single_sdk_tests.yml b/.github/workflows/single_sdk_tests.yml index 6b2459b..0a5252e 100644 --- a/.github/workflows/single_sdk_tests.yml +++ b/.github/workflows/single_sdk_tests.yml @@ -148,6 +148,7 @@ jobs: run: | echo "Compiling matrix-rust-sdk @ $RUST_SDK" cd complement-crypto && ./install_uniffi_bindgen_go.sh && ./rebuild_rust_sdk.sh $RUST_SDK_DIR + patch -p0 < matrix_sdk_ffi.patch - name: Build RPC client (rust) if: ${{ inputs.use_rust_sdk != '' }} diff --git a/matrix_sdk_ffi.patch b/matrix_sdk_ffi.patch new file mode 100644 index 0000000..6d37626 --- /dev/null +++ b/matrix_sdk_ffi.patch @@ -0,0 +1,24 @@ +--- internal/api/rust/matrix_sdk_ffi/matrix_sdk_ffi.go.bak 2026-07-23 16:39:06.249000000 +0100 ++++ internal/api/rust/matrix_sdk_ffi/matrix_sdk_ffi.go 2026-07-23 16:32:50.560000000 +0100 +@@ -23496,20 +23496,21 @@ + // possible, instead of just storing IDs and coming back to the timeline + // object to look up items. + func (_self *Timeline) GetEventTimelineItemByEventId(eventId string) (EventTimelineItem, error) { + _pointer := _self.ffiObject.incrementPointer("*Timeline") + defer _self.ffiObject.decrementPointer() + res, err := uniffiRustCallAsync[*ClientError]( + FfiConverterClientErrorINSTANCE, + // completeFn + func(handle C.uint64_t, status *C.RustCallStatus) RustBufferI { + res := C.ffi_matrix_sdk_ffi_rust_future_complete_rust_buffer(handle, status) ++ fmt.Fprintf(os.Stderr, "GetEventTimelineItemByEventId returned status %d, buffer of length %d\n", status.code, uint64(res.len)) + return GoRustBuffer{ + inner: res, + } + }, + // liftFn + func(ffi RustBufferI) EventTimelineItem { + return FfiConverterEventTimelineItemINSTANCE.Lift(ffi) + }, + C.uniffi_matrix_sdk_ffi_fn_method_timeline_get_event_timeline_item_by_event_id( + _pointer, FfiConverterStringINSTANCE.Lower(eventId)), From 077787525b4e5489a9c50ebd11d7b0a5aef0e528 Mon Sep 17 00:00:00 2001 From: Richard van der Hoff Date: Thu, 23 Jul 2026 17:08:15 +0100 Subject: [PATCH 2/3] missing import --- matrix_sdk_ffi.patch | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/matrix_sdk_ffi.patch b/matrix_sdk_ffi.patch index 6d37626..fdbd509 100644 --- a/matrix_sdk_ffi.patch +++ b/matrix_sdk_ffi.patch @@ -1,6 +1,25 @@ ---- internal/api/rust/matrix_sdk_ffi/matrix_sdk_ffi.go.bak 2026-07-23 16:39:06.249000000 +0100 -+++ internal/api/rust/matrix_sdk_ffi/matrix_sdk_ffi.go 2026-07-23 16:32:50.560000000 +0100 -@@ -23496,20 +23496,21 @@ +--- internal/api/rust/matrix_sdk_ffi/matrix_sdk_ffi.go.bak 2026-07-23 17:07:10.407000000 +0100 ++++ internal/api/rust/matrix_sdk_ffi/matrix_sdk_ffi.go 2026-07-23 17:07:32.137000000 +0100 +@@ -1,16 +1,18 @@ + package matrix_sdk_ffi + + // #include + // #cgo LDFLAGS: -lmatrix_sdk_ffi + import "C" + ++import "os" ++ + import ( + "bytes" + "encoding/binary" + "errors" + "fmt" + "io" + "math" + "runtime" + "runtime/cgo" + "sync" +@@ -23495,20 +23497,21 @@ // possible, instead of just storing IDs and coming back to the timeline // object to look up items. func (_self *Timeline) GetEventTimelineItemByEventId(eventId string) (EventTimelineItem, error) { From f23b8ef0bfd583df54c433797ac8c2ef27bc7f49 Mon Sep 17 00:00:00 2001 From: Richard van der Hoff Date: Thu, 23 Jul 2026 17:27:53 +0100 Subject: [PATCH 3/3] fix patch --- matrix_sdk_ffi.patch | 38 +++++++++++++++++++++----------------- 1 file changed, 21 insertions(+), 17 deletions(-) diff --git a/matrix_sdk_ffi.patch b/matrix_sdk_ffi.patch index fdbd509..837d585 100644 --- a/matrix_sdk_ffi.patch +++ b/matrix_sdk_ffi.patch @@ -1,25 +1,29 @@ ---- internal/api/rust/matrix_sdk_ffi/matrix_sdk_ffi.go.bak 2026-07-23 17:07:10.407000000 +0100 -+++ internal/api/rust/matrix_sdk_ffi/matrix_sdk_ffi.go 2026-07-23 17:07:32.137000000 +0100 -@@ -1,16 +1,18 @@ - package matrix_sdk_ffi - - // #include - // #cgo LDFLAGS: -lmatrix_sdk_ffi - import "C" - -+import "os" -+ - import ( - "bytes" - "encoding/binary" - "errors" - "fmt" +--- internal/api/rust/matrix_sdk_ffi/matrix_sdk_ffi.go.orig 2026-07-23 17:25:04.754939450 +0100 ++++ internal/api/rust/matrix_sdk_ffi/matrix_sdk_ffi.go 2026-07-23 17:27:40.408000000 +0100 +@@ -19,20 +19,22 @@ "io" "math" "runtime" "runtime/cgo" "sync" -@@ -23495,20 +23497,21 @@ + "sync/atomic" + "time" + "unsafe" + ) + ++import "os" ++ + // This is needed, because as of go 1.24 + // type RustBuffer C.RustBuffer cannot have methods, + // RustBuffer is treated as non-local type + type GoRustBuffer struct { + inner C.RustBuffer + } + + type RustBufferI interface { + AsReader() *bytes.Reader + Free() +@@ -23494,20 +23496,21 @@ // possible, instead of just storing IDs and coming back to the timeline // object to look up items. func (_self *Timeline) GetEventTimelineItemByEventId(eventId string) (EventTimelineItem, error) {