Skip to content

Conversation

@maciejdudko
Copy link
Contributor

@maciejdudko maciejdudko commented Jul 1, 2025

What was changed

Moved C Bridge from dotnet-sdk to core-sdk repo.

The PR has been squashed into 2 commits to make it easier to review:

  • The first commit is a straight copy of what's in dotnet-sdk repo.
  • The second commit contains all the other changes.

💥 There are breaking changes to the C bridge:

  • Renamed crate to temporal_sdk_core_c_bridge
  • Renamed header file to temporal-sdk-core-c-bridge.h
  • Added temporal_core_ prefix to exported C functions and TemporalCore prefix to exported types
  • Changed TestServerOptions::download_ttl_ms to download_ttl_seconds

Other changes:

  • Upgraded to edition 2024, cleaned up dependencies
  • Made exported structs and their fields public (so that Rust tests can use them)
  • Added missing RPC calls
  • Added some smoke tests for the bridge
  • Moved LTO profile to workspace root
  • Various lints and formatting

There's also one unrelated change to integration tests that fixes unused import warning on Linux/ARM.

Why?

It makes the C bridge available for other languages that prefer to use C interface to interact with Rust. See temporalio/sdk-dotnet#423

Checklist

  1. How was this tested:
  • The bridge crate has some basic smoke tests.
  • A matching PR will be opened for dotnet-sdk repo. Before merging this PR we should make sure dotnet-sdk builds and works using this version of the bridge.
  1. Any docs updates needed?

README was updated to mention the new crate.

@maciejdudko maciejdudko requested a review from a team as a code owner July 1, 2025 15:58
Copy link
Member

@cretz cretz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great, thanks for all the work here! Only a minor CI suggestion and code-gen/validation suggestion (that can be deferred).

Also, looking forward to seeing maybe a .NET draft PR that changes submodule to this branch and just to confirm we don't need any more change on this side to be usable.

};
}

async fn call_workflow_service(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should either change this to be code generated (w/ CI check confirming code gen is accurate), or something else to confirm that every string is represented here. In .NET we do have a test IIRC to confirm every gRPC call is available. In Ruby we ended up writing a code gen to generate these big match statements (though if the match statement gets too big it can have stack problems in debug build).

If we'd like though, we can defer this to another PR. But we do need something at some point to confirm this doesn't get out of sync with the proto RPC names.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I made a test that makes sure we have all RPC calls:

fn test_all_rpc_calls_exist() {

It gets run by CI: https://github.com/temporalio/sdk-core/actions/runs/16004477686/job/45147643644?pr=951#step:7:579

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! This is good enough for me. I do think we may want code gen one day, but so long as the test is there to make sure we have to add them as they come up, sounds good.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should have a CI step that confirms that there is no git diff after build (thereby confirming that the checked in header is the latest)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

…tion tests on Linux/ARM.

Breaking changes:
- Renamed crate to `temporal_sdk_core_c_bridge`
- Renamed header file to `temporal-sdk-core-c-bridge.h`
- Added `temporal_core_` prefix to exported C functions and `TemporalCore` prefix to exported types
- Changed `TestServerOptions::download_ttl_ms` to `download_ttl_seconds`

Other:
- Upgraded to edition 2024, cleaned up dependencies
- Added missing RPC calls
- Added some smoke tests for the bridge
- Moved LTO profile to workspace root
- Various lints and formatting
…ated header to test CI diff check (it should fail).
Copy link
Member

@cretz cretz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking at temporalio/sdk-dotnet#494, I think we're good here

@maciejdudko maciejdudko merged commit 99b25ed into master Jul 1, 2025
18 checks passed
@maciejdudko maciejdudko deleted the core-c-bridge branch July 1, 2025 20:14
Comment on lines +1 to +2
#![allow(dead_code)]
#![allow(unused_imports)]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would be good to make these specific to the area they're needed in

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oops. Fixed in new PR #954

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants