Skip to content

Commit 922f173

Browse files
authored
Merge branch 'bfops/cargo-test-all' into bfops/cargo-unity-test
2 parents 44740eb + e538ece commit 922f173

33 files changed

Lines changed: 455 additions & 145 deletions

File tree

.github/workflows/ci.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -763,14 +763,18 @@ jobs:
763763
const publicRef = (context.eventName === 'pull_request') ? context.payload.pull_request.head.ref : context.sha;
764764
const publicPrNumber = context.payload.pull_request?.number ?? context.payload.inputs?.pr_number;
765765
const preDispatch = new Date().toISOString();
766+
const inputs = { public_ref: publicRef };
767+
if (publicPrNumber) {
768+
inputs.public_pr_number = String(publicPrNumber);
769+
}
766770
767771
// Dispatch the workflow in the target repository
768772
await github.rest.actions.createWorkflowDispatch({
769773
owner: targetOwner,
770774
repo: targetRepo,
771775
workflow_id: workflowId,
772776
ref: targetRef,
773-
inputs: { public_ref: publicRef, public_pr_number: String(publicPrNumber) }
777+
inputs,
774778
});
775779
776780
const sleep = (ms) => new Promise(r => setTimeout(r, ms));

crates/bindings-cpp/include/spacetimedb/procedure_context.h

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,17 +97,22 @@ struct ProcedureContext {
9797
*
9898
* Example:
9999
* @code
100-
* auto module_id = ctx.identity();
100+
* auto module_id = ctx.database_identity();
101101
* std::string url = "http://localhost:3000/v1/database/" +
102102
* module_id.to_hex() + "/schema?version=9";
103103
* @endcode
104104
*/
105-
Identity identity() const {
105+
Identity database_identity() const {
106106
std::array<uint8_t, 32> id_bytes;
107107
::identity(id_bytes.data());
108108
return Identity(id_bytes);
109109
}
110110

111+
[[deprecated("Use database_identity() instead.")]]
112+
Identity identity() const {
113+
return database_identity();
114+
}
115+
111116
/**
112117
* @brief Get the random number generator for this procedure call
113118
*

crates/bindings-cpp/include/spacetimedb/reducer_context.h

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,11 +58,16 @@ struct ReducerContext {
5858
return *rng_instance;
5959
}
6060

61-
Identity identity() const {
61+
Identity database_identity() const {
6262
std::array<uint8_t, 32> buffer;
6363
::identity(buffer.data());
6464
return Identity(buffer);
6565
}
66+
67+
[[deprecated("Use database_identity() instead.")]]
68+
Identity identity() const {
69+
return database_identity();
70+
}
6671

6772
/**
6873
* Generate a new random UUID v4.

crates/bindings-cpp/include/spacetimedb/tx_context.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,9 @@ struct TxContext {
6969
// Access to ReducerContext methods
7070
Identity sender() const { return ctx_.sender(); }
7171
const AuthCtx& sender_auth() const { return ctx_.sender_auth(); }
72-
Identity identity() const { return ctx_.identity(); }
72+
Identity database_identity() const { return ctx_.database_identity(); }
73+
[[deprecated("Use database_identity() instead.")]]
74+
Identity identity() const { return database_identity(); }
7375
StdbRng& rng() const { return ctx_.rng(); }
7476

7577
/**

crates/bindings-csharp/BSATN.Runtime/Builtins.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
namespace SpacetimeDB;
22

3-
using System.Diagnostics;
43
using System.Runtime.InteropServices;
54
using SpacetimeDB.BSATN;
5+
#if !NET5_0_OR_GREATER
6+
using System.Diagnostics;
7+
#endif
68

79
internal static class Util
810
{

crates/bindings-csharp/BSATN.Runtime/QueryBuilder.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -877,10 +877,14 @@ public static string FormatStringLiteral(ReadOnlySpan<char> value) =>
877877

878878
public static string FormatHexLiteral(string hex)
879879
{
880+
#if NET6_0_OR_GREATER
881+
ArgumentNullException.ThrowIfNull(hex);
882+
#else
880883
if (hex is null)
881884
{
882885
throw new ArgumentNullException(nameof(hex));
883886
}
887+
#endif
884888

885889
var s = hex;
886890
if (s.StartsWith("0x", StringComparison.OrdinalIgnoreCase))

crates/bindings-csharp/Codegen.Tests/fixtures/diag/snapshots/Module#FFI.verified.cs

Lines changed: 6 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crates/bindings-csharp/Codegen.Tests/fixtures/explicitnames/snapshots/Module#FFI.verified.cs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,13 @@ public sealed record ReducerContext : DbContext<Local>, Internal.IReducerContext
5757

5858
// **Note:** must be 0..=u32::MAX
5959
internal int CounterUuid;
60+
public Identity DatabaseIdentity => Internal.IReducerContext.GetDatabaseIdentity();
6061

61-
// We need this property to be non-static for parity with client SDK.
62-
public Identity Identity => Internal.IReducerContext.GetIdentity();
62+
// We keep this property for compatibility with existing module code.
63+
[global::System.Obsolete(
64+
"ReducerContext.Identity is deprecated. Use DatabaseIdentity instead."
65+
)]
66+
public Identity Identity => DatabaseIdentity;
6367

6468
internal ReducerContext(
6569
Identity identity,

crates/bindings-csharp/Codegen.Tests/fixtures/server/snapshots/Module#FFI.verified.cs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -499,9 +499,13 @@ public sealed record ReducerContext : DbContext<Local>, Internal.IReducerContext
499499

500500
// **Note:** must be 0..=u32::MAX
501501
internal int CounterUuid;
502+
public Identity DatabaseIdentity => Internal.IReducerContext.GetDatabaseIdentity();
502503

503-
// We need this property to be non-static for parity with client SDK.
504-
public Identity Identity => Internal.IReducerContext.GetIdentity();
504+
// We keep this property for compatibility with existing module code.
505+
[global::System.Obsolete(
506+
"ReducerContext.Identity is deprecated. Use DatabaseIdentity instead."
507+
)]
508+
public Identity Identity => DatabaseIdentity;
505509

506510
internal ReducerContext(
507511
Identity identity,

crates/bindings-csharp/Codegen/Module.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2189,8 +2189,10 @@ public sealed record ReducerContext : DbContext<Local>, Internal.IReducerContext
21892189
public readonly AuthCtx SenderAuth;
21902190
// **Note:** must be 0..=u32::MAX
21912191
internal int CounterUuid;
2192-
// We need this property to be non-static for parity with client SDK.
2193-
public Identity Identity => Internal.IReducerContext.GetIdentity();
2192+
public Identity DatabaseIdentity => Internal.IReducerContext.GetDatabaseIdentity();
2193+
// We keep this property for compatibility with existing module code.
2194+
[global::System.Obsolete("ReducerContext.Identity is deprecated. Use DatabaseIdentity instead.")]
2195+
public Identity Identity => DatabaseIdentity;
21942196
21952197
internal ReducerContext(Identity identity, ConnectionId? connectionId, Random random,
21962198
Timestamp time, AuthCtx? senderAuth = null)

0 commit comments

Comments
 (0)