chore: refactor migration code and tests#3222
Open
miparnisari wants to merge 2 commits into
Open
Conversation
Codecov Report❌ Patch coverage is 📢 Thoughts on this report? Let us know! |
There was a problem hiding this comment.
⚠️ Performance Alert ⚠️
Possible performance regression was detected for benchmark.
Benchmark result of this commit is worse than the previous benchmark result exceeding threshold 2.
| Benchmark suite | Current: 31135a8 | Previous: cbdf06c | Ratio |
|---|---|---|---|
BenchmarkDatastoreDriver/cockroachdb-overlap-static/TestTuple/SnapshotReverseRead (github.com/authzed/spicedb/internal/datastore/benchmark) |
34635145 ns/op 172560 B/op 20195 allocs/op |
6805173 ns/op 172708 B/op 20195 allocs/op |
5.09 |
BenchmarkDatastoreDriver/cockroachdb-overlap-static/TestTuple/SnapshotReverseRead (github.com/authzed/spicedb/internal/datastore/benchmark) - ns/op |
34635145 ns/op |
6805173 ns/op |
5.09 |
BenchmarkDatastoreDriver/cockroachdb-overlap-insecure/TestTuple/SnapshotReverseRead (github.com/authzed/spicedb/internal/datastore/benchmark) |
34055916 ns/op 172667 B/op 20196 allocs/op |
6853237 ns/op 172793 B/op 20195 allocs/op |
4.97 |
BenchmarkDatastoreDriver/cockroachdb-overlap-insecure/TestTuple/SnapshotReverseRead (github.com/authzed/spicedb/internal/datastore/benchmark) - ns/op |
34055916 ns/op |
6853237 ns/op |
4.97 |
BenchmarkDatastoreDriver/cockroachdb-overlap-insecure/TestTuple/Create (github.com/authzed/spicedb/internal/datastore/benchmark) |
5176124 ns/op 19541 B/op 281 allocs/op |
2004369 ns/op 19414 B/op 281 allocs/op |
2.58 |
BenchmarkDatastoreDriver/cockroachdb-overlap-insecure/TestTuple/Create (github.com/authzed/spicedb/internal/datastore/benchmark) - ns/op |
5176124 ns/op |
2004369 ns/op |
2.58 |
This comment was automatically generated by workflow using github-action-benchmark.
miparnisari
force-pushed
the
refactor-migrations
branch
from
July 10, 2026 05:02
9834eea to
31135a8
Compare
Engine builders move from pkg/cmd/datastore into their engine packages, registering themselves via the new leaf package pkg/cmd/datastore/dsconfig, which also takes over the Config type and its options; pkg/cmd/datastore re-exports everything, so callers are unaffected. Binaries link all in-repo engines through a blank import of internal/datastore/engines. This removes the static engine imports from the server-construction path, so that shared test code can stand up a SpiceDB server without creating an import cycle with the engines' own tests. Adding a new engine no longer requires editing pkg/cmd/datastore.
Migratable engines can now list every migration they support, in order, and declare the earliest migration the current code can operate against. The datastore test suite's TestMigration uses this to apply every migration one at a time from an empty database, standing up a SpiceDB server at the earliest supported revision and verifying schema writes and reads through its API across each remaining migration.
miparnisari
force-pushed
the
refactor-migrations
branch
from
July 16, 2026 20:09
31135a8 to
916899e
Compare
miparnisari
marked this pull request as ready for review
July 16, 2026 20:11
ecordell
approved these changes
Jul 16, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Two changes individually reviewable:
enginebuilder.goregisters with the new leaf packagepkg/cmd/datastore/dsconfig. The server-construction path no longer statically imports any engine.TestMigrationuses this to apply every migration one at a time from an empty database, standing up a real SpiceDB server at that earliest supported revision and verifying via the riteSchema/ReadSchema API that each remaining migration preserves the schema written before it.