Skip to content

Commit ae56bb7

Browse files
authored
Merge branch 'master' into tyler/update-nativeaot-llvm-infrastructure
2 parents 3e64dbd + 61be6e6 commit ae56bb7

55 files changed

Lines changed: 1684 additions & 504 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

Cargo.lock

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

Cargo.toml

Lines changed: 35 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -108,46 +108,46 @@ inherits = "release"
108108
debug = true
109109

110110
[workspace.package]
111-
version = "2.0.4"
111+
version = "2.0.5"
112112
edition = "2024"
113113
# update rust-toolchain.toml too!
114114
rust-version = "1.93.0"
115115

116116
[workspace.dependencies]
117-
spacetimedb = { path = "crates/bindings", version = "=2.0.4" }
118-
spacetimedb-auth = { path = "crates/auth", version = "=2.0.4" }
119-
spacetimedb-bindings-macro = { path = "crates/bindings-macro", version = "=2.0.4" }
120-
spacetimedb-bindings-sys = { path = "crates/bindings-sys", version = "=2.0.4" }
121-
spacetimedb-cli = { path = "crates/cli", version = "=2.0.4" }
122-
spacetimedb-client-api = { path = "crates/client-api", version = "=2.0.4" }
123-
spacetimedb-client-api-messages = { path = "crates/client-api-messages", version = "=2.0.4" }
124-
spacetimedb-codegen = { path = "crates/codegen", version = "=2.0.4" }
125-
spacetimedb-commitlog = { path = "crates/commitlog", version = "=2.0.4" }
126-
spacetimedb-core = { path = "crates/core", version = "=2.0.4" }
127-
spacetimedb-data-structures = { path = "crates/data-structures", version = "=2.0.4" }
128-
spacetimedb-datastore = { path = "crates/datastore", version = "=2.0.4" }
129-
spacetimedb-durability = { path = "crates/durability", version = "=2.0.4" }
130-
spacetimedb-execution = { path = "crates/execution", version = "=2.0.4" }
131-
spacetimedb-expr = { path = "crates/expr", version = "=2.0.4" }
132-
spacetimedb-guard = { path = "crates/guard", version = "=2.0.4" }
133-
spacetimedb-lib = { path = "crates/lib", default-features = false, version = "=2.0.4" }
134-
spacetimedb-memory-usage = { path = "crates/memory-usage", version = "=2.0.4", default-features = false }
135-
spacetimedb-metrics = { path = "crates/metrics", version = "=2.0.4" }
136-
spacetimedb-paths = { path = "crates/paths", version = "=2.0.4" }
137-
spacetimedb-pg = { path = "crates/pg", version = "=2.0.4" }
138-
spacetimedb-physical-plan = { path = "crates/physical-plan", version = "=2.0.4" }
139-
spacetimedb-primitives = { path = "crates/primitives", version = "=2.0.4" }
140-
spacetimedb-query = { path = "crates/query", version = "=2.0.4" }
141-
spacetimedb-sats = { path = "crates/sats", version = "=2.0.4" }
142-
spacetimedb-schema = { path = "crates/schema", version = "=2.0.4" }
143-
spacetimedb-standalone = { path = "crates/standalone", version = "=2.0.4" }
144-
spacetimedb-sql-parser = { path = "crates/sql-parser", version = "=2.0.4" }
145-
spacetimedb-table = { path = "crates/table", version = "=2.0.4" }
146-
spacetimedb-vm = { path = "crates/vm", version = "=2.0.4" }
147-
spacetimedb-fs-utils = { path = "crates/fs-utils", version = "=2.0.4" }
148-
spacetimedb-snapshot = { path = "crates/snapshot", version = "=2.0.4" }
149-
spacetimedb-subscription = { path = "crates/subscription", version = "=2.0.4" }
150-
spacetimedb-query-builder = { path = "crates/query-builder", version = "=2.0.4" }
117+
spacetimedb = { path = "crates/bindings", version = "=2.0.5" }
118+
spacetimedb-auth = { path = "crates/auth", version = "=2.0.5" }
119+
spacetimedb-bindings-macro = { path = "crates/bindings-macro", version = "=2.0.5" }
120+
spacetimedb-bindings-sys = { path = "crates/bindings-sys", version = "=2.0.5" }
121+
spacetimedb-cli = { path = "crates/cli", version = "=2.0.5" }
122+
spacetimedb-client-api = { path = "crates/client-api", version = "=2.0.5" }
123+
spacetimedb-client-api-messages = { path = "crates/client-api-messages", version = "=2.0.5" }
124+
spacetimedb-codegen = { path = "crates/codegen", version = "=2.0.5" }
125+
spacetimedb-commitlog = { path = "crates/commitlog", version = "=2.0.5" }
126+
spacetimedb-core = { path = "crates/core", version = "=2.0.5" }
127+
spacetimedb-data-structures = { path = "crates/data-structures", version = "=2.0.5" }
128+
spacetimedb-datastore = { path = "crates/datastore", version = "=2.0.5" }
129+
spacetimedb-durability = { path = "crates/durability", version = "=2.0.5" }
130+
spacetimedb-execution = { path = "crates/execution", version = "=2.0.5" }
131+
spacetimedb-expr = { path = "crates/expr", version = "=2.0.5" }
132+
spacetimedb-guard = { path = "crates/guard", version = "=2.0.5" }
133+
spacetimedb-lib = { path = "crates/lib", default-features = false, version = "=2.0.5" }
134+
spacetimedb-memory-usage = { path = "crates/memory-usage", version = "=2.0.5", default-features = false }
135+
spacetimedb-metrics = { path = "crates/metrics", version = "=2.0.5" }
136+
spacetimedb-paths = { path = "crates/paths", version = "=2.0.5" }
137+
spacetimedb-pg = { path = "crates/pg", version = "=2.0.5" }
138+
spacetimedb-physical-plan = { path = "crates/physical-plan", version = "=2.0.5" }
139+
spacetimedb-primitives = { path = "crates/primitives", version = "=2.0.5" }
140+
spacetimedb-query = { path = "crates/query", version = "=2.0.5" }
141+
spacetimedb-sats = { path = "crates/sats", version = "=2.0.5" }
142+
spacetimedb-schema = { path = "crates/schema", version = "=2.0.5" }
143+
spacetimedb-standalone = { path = "crates/standalone", version = "=2.0.5" }
144+
spacetimedb-sql-parser = { path = "crates/sql-parser", version = "=2.0.5" }
145+
spacetimedb-table = { path = "crates/table", version = "=2.0.5" }
146+
spacetimedb-vm = { path = "crates/vm", version = "=2.0.5" }
147+
spacetimedb-fs-utils = { path = "crates/fs-utils", version = "=2.0.5" }
148+
spacetimedb-snapshot = { path = "crates/snapshot", version = "=2.0.5" }
149+
spacetimedb-subscription = { path = "crates/subscription", version = "=2.0.5" }
150+
spacetimedb-query-builder = { path = "crates/query-builder", version = "=2.0.5" }
151151

152152
# Prevent `ahash` from pulling in `getrandom` by disabling default features.
153153
# Modules use `getrandom02` and we need to prevent an incompatible version

LICENSE.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ Business Source License 1.1
55
Parameters
66

77
Licensor: Clockwork Laboratories, Inc.
8-
Licensed Work: SpacetimeDB 2.0.4
8+
Licensed Work: SpacetimeDB 2.0.5
99
The Licensed Work is
1010
(c) 2023 Clockwork Laboratories, Inc.
1111

@@ -21,7 +21,7 @@ Additional Use Grant: You may make use of the Licensed Work provided your
2121
Licensed Work by creating tables whose schemas are
2222
controlled by such third parties.
2323

24-
Change Date: 2031-03-10
24+
Change Date: 2031-03-12
2525

2626
Change License: GNU Affero General Public License v3.0 with a linking
2727
exception

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ Unit F64
3939
)>
4040
{
4141
public static readonly AlgebraicType Unit = new Product([]);
42+
public const string QueryBuilderProductTypeTag = "__query__";
4243

4344
// Special AlgebraicType that can be recognised by the SpacetimeDB `generate` CLI as an Option<T>.
4445
internal static AlgebraicType MakeOption(AlgebraicType someType) =>
@@ -47,4 +48,8 @@ internal static AlgebraicType MakeOption(AlgebraicType someType) =>
4748
// Special AlgebraicType that can be recognised by the SpacetimeDB `generate` CLI as a Result<T, E>.
4849
internal static AlgebraicType MakeResult(AlgebraicType okType, AlgebraicType errType) =>
4950
new Sum([new("ok", okType), new("err", errType)]);
51+
52+
// Special AlgebraicType that can be recognised by the SpacetimeDB `generate` CLI as Query<T>.
53+
public static AlgebraicType MakeQueryBuilderProductType(Ref rowProductTypeRef) =>
54+
new Product([new(QueryBuilderProductTypeTag, rowProductTypeRef)]);
5055
}

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

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1636,10 +1636,9 @@ SpacetimeDB.BSATN.ITypeRegistrar registrar
16361636
IsPublic: true,
16371637
IsAnonymous: false,
16381638
Params: [],
1639-
ReturnType: new SpacetimeDB.BSATN.ValueOption<
1640-
PublicTable,
1641-
PublicTable.BSATN
1642-
>().GetAlgebraicType(registrar)
1639+
ReturnType: global::SpacetimeDB.BSATN.AlgebraicType.MakeQueryBuilderProductType(
1640+
new PublicTable.BSATN().GetAlgebraicType(registrar)
1641+
)
16431642
);
16441643

16451644
public byte[] Invoke(

crates/bindings-csharp/Codegen/Module.cs

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1122,6 +1122,7 @@ record ViewDeclaration
11221122
public readonly bool IsPublic;
11231123
public readonly bool ReturnsQuery;
11241124
public readonly TypeUse ReturnType;
1125+
public readonly TypeUse? QueryRowType;
11251126
public readonly EquatableArray<MemberDeclaration> Parameters;
11261127
public readonly Scope Scope;
11271128

@@ -1186,15 +1187,12 @@ method.ReturnType is INamedTypeSymbol
11861187
{
11871188
ReturnsQuery = true;
11881189
var rowType = TypeUse.Parse(method, queryRowType, diag);
1189-
var optType = queryRowType.IsValueType
1190-
? "SpacetimeDB.BSATN.ValueOption"
1191-
: "SpacetimeDB.BSATN.RefOption";
1192-
var opt = $"{optType}<{rowType.Name}, {rowType.BSATNName}>";
1193-
// Match Rust semantics: Query<T> is described as a nullable row (T?).
1194-
ReturnType = new ReferenceUse(opt, opt);
1190+
QueryRowType = rowType;
1191+
ReturnType = rowType;
11951192
}
11961193
else
11971194
{
1195+
QueryRowType = null;
11981196
ReturnType = TypeUse.Parse(method, method.ReturnType, diag);
11991197
}
12001198
Scope = new Scope(methodSyntax.Parent as MemberDeclarationSyntax);
@@ -1211,9 +1209,10 @@ method.ReturnType is INamedTypeSymbol
12111209
diag.Report(ErrorDescriptor.ViewContextParam, methodSyntax);
12121210
}
12131211

1214-
// Validate return type: must be List<T> or T?
1212+
// Validate return type: must be List<T>, T?, or IQuery<T>.
12151213
if (
1216-
!ReturnType.BSATNName.Contains("SpacetimeDB.BSATN.ValueOption")
1214+
!ReturnsQuery
1215+
&& !ReturnType.BSATNName.Contains("SpacetimeDB.BSATN.ValueOption")
12171216
&& !ReturnType.BSATNName.Contains("SpacetimeDB.BSATN.RefOption")
12181217
&& !ReturnType.BSATNName.Contains("SpacetimeDB.BSATN.List")
12191218
)
@@ -1229,17 +1228,22 @@ method.ReturnType is INamedTypeSymbol
12291228
);
12301229
}
12311230

1232-
public string GenerateViewDef(uint Index) =>
1233-
$$$"""
1231+
public string GenerateViewDef(uint Index)
1232+
{
1233+
var returnTypeExpr = ReturnsQuery
1234+
? $"global::SpacetimeDB.BSATN.AlgebraicType.MakeQueryBuilderProductType(new {QueryRowType!.BSATNName}().GetAlgebraicType(registrar))"
1235+
: $"new {ReturnType.BSATNName}().GetAlgebraicType(registrar)";
1236+
return $$$"""
12341237
new global::SpacetimeDB.Internal.RawViewDefV10(
12351238
SourceName: "{{{Name}}}",
12361239
Index: {{{Index}}},
12371240
IsPublic: {{{IsPublic.ToString().ToLower()}}},
12381241
IsAnonymous: {{{IsAnonymous.ToString().ToLower()}}},
12391242
Params: [{{{MemberDeclaration.GenerateDefs(Parameters)}}}],
1240-
ReturnType: new {{{ReturnType.BSATNName}}}().GetAlgebraicType(registrar)
1243+
ReturnType: {{{returnTypeExpr}}}
12411244
);
12421245
""";
1246+
}
12431247

12441248
/// <summary>
12451249
/// Generates the class responsible for evaluating a view.

crates/codegen/src/csharp.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -653,6 +653,13 @@ impl Lang for Csharp<'_> {
653653
}
654654
}
655655
}
656+
for (columns, constraints) in schema.backcompat_column_constraints() {
657+
if constraints.has_indexed() || constraints.has_unique() || constraints.has_primary_key() {
658+
for col_pos in columns.iter() {
659+
ix_col_positions.insert(col_pos.idx());
660+
}
661+
}
662+
}
656663

657664
writeln!(output, "public sealed class {cols_owner_name}Cols");
658665
indented_block(&mut output, |output| {

crates/codegen/tests/snapshots/codegen__codegen_typescript.snap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,7 @@ const proceduresSchema = __procedures(
289289
/** The remote SpacetimeDB module schema, both runtime and type information. */
290290
const REMOTE_MODULE = {
291291
versionInfo: {
292-
cliVersion: "2.0.4" as const,
292+
cliVersion: "2.0.5" as const,
293293
},
294294
tables: tablesSchema.schemaType.tables,
295295
reducers: reducersSchema.reducersType.reducers,

crates/core/src/host/instance_env.rs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -970,12 +970,16 @@ impl InstanceEnv {
970970

971971
/// Default timeout for HTTP requests performed by [`InstanceEnv::http_request`].
972972
///
973-
/// Value chosen arbitrarily by pgoldman 2025-11-18, based on little more than a vague guess.
974-
const HTTP_DEFAULT_TIMEOUT: Duration = Duration::from_millis(500);
973+
/// Applied when the module does not specify a timeout.
974+
/// 30 seconds is generous enough for most external API calls (including LLM APIs)
975+
/// without silently hanging forever on a broken endpoint.
976+
const HTTP_DEFAULT_TIMEOUT: Duration = Duration::from_secs(30);
975977
/// Maximum timeout for HTTP requests performed by [`InstanceEnv::http_request`].
976978
///
977979
/// If the user requests a timeout longer than this, we will clamp to this value.
978-
const HTTP_MAX_TIMEOUT: Duration = Duration::from_secs(10);
980+
/// 180 seconds accommodates long-running LLM and AI API calls,
981+
/// which routinely take 30-120 seconds for complex requests.
982+
const HTTP_MAX_TIMEOUT: Duration = Duration::from_secs(180);
979983
const BLOCKED_HTTP_ADDRESS_ERROR: &str = "refusing to connect to private or special-purpose addresses";
980984

981985
struct FilteredDnsResolver;

crates/smoketests/modules/Cargo.lock

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

0 commit comments

Comments
 (0)