Skip to content

Fix some default column value bugs - #5630

Merged
bfops merged 6 commits into
bfops/consolidate-default-testsfrom
bfops/fix-defaults
Jul 31, 2026
Merged

Fix some default column value bugs#5630
bfops merged 6 commits into
bfops/consolidate-default-testsfrom
bfops/fix-defaults

Conversation

@bfops

@bfops bfops commented Jul 30, 2026

Copy link
Copy Markdown
Collaborator

Description of Changes

Fixes #5623
Fixes #5624
Fixes #5627
Fixes #5622

API and ABI breaking changes

No. Fixes bugs with things that won't working (two build failures, one publish failure, and one incorrect default value)

Expected complexity level and risk

2

Testing

  • Further smoketest cases have been enabled
    • modules in those smoketests are building and publishing successfully

@bfops bfops changed the title Fix two default value bugs Fix some default column value bugs Jul 30, 2026
@bfops bfops linked an issue Jul 30, 2026 that may be closed by this pull request
Comment thread crates/bindings/tests/defaults.rs Outdated
@bfops
bfops marked this pull request as ready for review July 30, 2026 13:23
@bfops bfops mentioned this pull request Jul 30, 2026
2 tasks
@bfops
bfops requested a review from gefjon July 30, 2026 13:28
Comment on lines 5 to 34
const EXPECTED_DEFAULTS: &[(&str, &str)] = &[
("bool_value", "true"),
("u8_value", "8"),
// TODO: uncomment this once negative defaults are fixed in Rust
// https://github.com/clockworklabs/SpacetimeDB/issues/5622
//("i8_value", "-8"),
("u16_value", "16"),
// TODO: uncomment this once negative defaults are fixed in Rust
// https://github.com/clockworklabs/SpacetimeDB/issues/5622
//("i16_value", "-16"),
("u32_value", "32"),
// TODO: uncomment this once negative defaults are fixed in Rust
// https://github.com/clockworklabs/SpacetimeDB/issues/5622
//("i32_value", "-32"),

// TODO: uncomment once u64s are fixed.
// https://github.com/clockworklabs/SpacetimeDB/issues/5623
//("u64_value", "64"),

("u64_value", "64"),
// TODO: uncomment this once negative defaults are fixed in Rust
// https://github.com/clockworklabs/SpacetimeDB/issues/5622
//("i64_value", "-64"),

// TODO: uncomment once floats are fixed in C# and f32s are fixed in Rust
// https://github.com/clockworklabs/SpacetimeDB/issues/5624
// https://github.com/clockworklabs/SpacetimeDB/issues/5627
//("f32_positive_value", "32.5"),

// TODO: uncomment once floats are fixed in C#, f32s are fixed in Rust, and negative defaults are fixed in Rust
// https://github.com/clockworklabs/SpacetimeDB/issues/5624
// https://github.com/clockworklabs/SpacetimeDB/issues/5627
("f32_positive_value", "32.5"),
// TODO: uncomment once negative defaults are fixed in Rust
// https://github.com/clockworklabs/SpacetimeDB/issues/5622
//("f32_negative_value", "-32.5"),
("f64_positive_value", "64.25"),
// TODO: uncomment once negative defaults are fixed in Rust
// https://github.com/clockworklabs/SpacetimeDB/issues/5622
//("f64_negative_value", "-64.25"),

// TODO: uncomment this once string default values are fixed in Rust
//("string_value", r#""default string""#),
];

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I uncommented the negative value tests and ran locally and they passed. I believe the problem with negative values was:

  • #val.serialize(...) expanded to e.g. -32.serialize(...).
  • After macroexpansion, that parsed as - (32.serialize(...)).

You change makes it so that the macro now correctly constructs the negation operator to the integer first, and then converts it into AlgebraicValue, instead of trying to apply the negation operator afterwards.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

oh fantastic! thank you

Comment thread crates/bindings/tests/defaults.rs Outdated
@bfops bfops linked an issue Jul 30, 2026 that may be closed by this pull request
@bfops
bfops merged commit 4c982b0 into bfops/consolidate-default-tests Jul 31, 2026
35 of 38 checks passed
@bfops
bfops deleted the bfops/fix-defaults branch July 31, 2026 07:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

3 participants