Event tables: datastore tests, migration validation, and bootstrap fix #4251
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description of Changes
Cherry-picks the core event table implementation (
fa83d6d40,07d57a552) and adds:Bootstrap fix: Register
st_event_tableinbootstrap_system_tables()— it was missing from the cherry-picked commit, causing event table creation to fail at runtime when inserting intoST_EVENT_TABLE_ID.4 datastore unit tests covering event table behaviors:
replay_insertis a no-op for event tables (commitlog replay doesn't rebuild state)Migration validation:
ChangeTableEventFlagerror inauto_migrate.rsprevents changing a table's event flag (event→non-event or vice versa) via auto-migration. Includes tests for both directions and a positive test that identical flags are accepted.Test fixture updates: Bootstrap test expectations updated for the new
st_event_tablesystem table (table row, column, index ID 23, constraint ID 19). Enabledspacetimedb-schema/testfeature in datastore dev-deps to fix pre-existing test compilation issue withfor_testmethods.API and ABI breaking changes
None. The
ChangeTableEventFlagerror variant is added to the internalAutoMigrateErrorenum but this is not a public API.Expected complexity level and risk
1 — Straightforward additions. The bootstrap fix is a one-liner that was simply missing from the cherry-pick. The tests exercise existing behavior without changing it. The migration guard follows the exact same pattern as the existing
ChangeTableTypecheck.Testing
cargo test -p spacetimedb-datastore— 77 tests pass (73 existing + 4 new)cargo test -p spacetimedb-schema --features test --lib— 98 tests pass (96 existing + 2 new)cargo check --workspace --exclude view-client— compiles clean (view-clienthas a pre-existing issue withCanBeLookupTablefrom the cherry-pick)