Skip to content

Conversation

@cloutiertyler
Copy link
Contributor

@cloutiertyler cloutiertyler commented Nov 21, 2025

Description of Changes

Fixes #3729

I genuinely don't know what came over me.

API and ABI breaking changes

None

Expected complexity level and risk

1.5 very straightforward but not strictly trivial

Testing

Adds automated integration tests (written in Rust and run with cargo test, although note this comment from @matklad about integration tests for the future https://internals.rust-lang.org/t/running-test-crates-in-parallel/15639/2):

  • Can publish an updated module if no migration is required
  • Can publish an updated module if auto-migration is required (with the yes-break flag true/false)
  • Cannot publish if a manual migration is required
  • Can publish if a manual migration is required but the user specified --delete-data
  • Can publish if a manual migration is required by the user specified --delete-data=on-conflict
  • No data deletion occurs if no migration is required and --delete-data=on-conflict is specified

@cloutiertyler cloutiertyler changed the title tyler/fix-on-conflict Fixes issues with --delete-data=on-conflict Nov 21, 2025
bfops
bfops previously requested changes Nov 21, 2025
Copy link
Collaborator

@bfops bfops left a comment

Choose a reason for hiding this comment

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

From a black box perspective, I would like you to test the following cases, with each value of --delete-data:

  • no migration required
  • auto-migrateable (with the yes-break flag true/false)
  • manual migration required

Edit: I would like to consider making these into automated tests!

Given the original issue, please also spot-test spacetime dev.

@jdetter
Copy link
Collaborator

jdetter commented Nov 21, 2025

Shall we do a hotfix release with this?

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR fixes issues with the --delete-data=on-conflict flag in the SpacetimeDB CLI's publish command. The main problem was that the data deletion prompt and logic were being executed at the wrong time in the publish flow, and the flag wasn't being properly respected when auto-migration was possible.

Key changes:

  • Fixed the logic for --delete-data=on-conflict to only delete data when a manual migration is required, not when auto-migration is available
  • Moved data deletion prompts and logic into the apply_pre_publish_if_needed function where migration decisions are made
  • Added support for --features flag to enable building Rust modules with different feature sets for testing
  • Added comprehensive integration tests to verify all migration scenarios

Reviewed changes

Copilot reviewed 15 out of 16 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
crates/cli/src/subcommands/publish.rs Refactored data deletion logic to occur within migration decision flow, fixed handling of --delete-data=on-conflict
crates/cli/src/subcommands/build.rs Added --features flag support for Rust builds
crates/cli/src/tasks/rust.rs Updated build function to accept and pass features to cargo
crates/cli/src/tasks/mod.rs Added features parameter and validation for non-Rust modules
crates/cli/tests/publish.rs Added comprehensive integration tests for all publish/migration scenarios
crates/cli/tests/util.rs Added utility for spawning SpacetimeDB instances in tests
crates/cli/tests/server.rs Added basic server connectivity test
modules/module-test/src/lib.rs Added conditional compilation features for testing migrations
modules/module-test/Cargo.toml Added feature flags for migration testing
crates/testing/src/modules.rs Updated to pass new features parameter
crates/cli/src/subcommands/dev.rs Updated to use new build API with features parameter
crates/codegen/tests/snapshots/*.snap Updated snapshots to include generated code for new test table

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@bfops bfops added release-any To be landed in any release window bugfix Fixes something that was expected to work differently labels Nov 24, 2025
@jdetter jdetter added release-1.10.0 and removed release-any To be landed in any release window labels Nov 24, 2025
Copy link
Collaborator

@jdetter jdetter left a comment

Choose a reason for hiding this comment

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

Just one question but no objections from me on this, thanks for cleaning this one up Zeke 🙏

I have not tested this myself but this was in last week's release and we haven't seen any complaints about this issue since the last release.

@bfops bfops enabled auto-merge December 4, 2025 17:34
@bfops bfops added this pull request to the merge queue Dec 4, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Dec 4, 2025
@bfops bfops added this pull request to the merge queue Dec 4, 2025
@bfops bfops removed this pull request from the merge queue due to a manual request Dec 4, 2025
@bfops bfops added this pull request to the merge queue Dec 4, 2025
@jdetter jdetter removed this pull request from the merge queue due to a manual request Dec 4, 2025
@cloutiertyler cloutiertyler added this pull request to the merge queue Dec 4, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Dec 4, 2025
@bfops bfops added this pull request to the merge queue Dec 4, 2025
@bfops bfops removed this pull request from the merge queue due to a manual request Dec 4, 2025
@bfops bfops added this pull request to the merge queue Dec 4, 2025
Merged via the queue into master with commit 46f3e07 Dec 4, 2025
51 of 54 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bugfix Fixes something that was expected to work differently release-1.10.0 release-1.11.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Spacetime Dev fails on publish args mistake 1.9

5 participants