Repository navigation
fix(database): serialize Schema.Create in TestEntSchemaParity - #1214
Merged
Merged
Conversation
This was referenced May 21, 2026
Owner
Author
kalbasit
added a commit
that referenced
this pull request
May 22, 2026
Replace context.Background() with t.Context() so the schema-create call is bound to the test lifetime. Drops the now-unused context import. Addresses gemini-code-assist comment from PR #1214 (PRRT_kwDONV6tZs6D3PyX); the original test_schema_parity file was folded into client_test.go but the same pattern lives in freshSchemaSQLite. Co-Authored-By: Claude Opus 4.7 <[email protected]>
kalbasit
force-pushed
the
fix-cache-tx-retry-on-duplicate-key
branch
from
May 22, 2026 21:42
d7964f3 to
4d9dffe
Compare
kalbasit
force-pushed
the
fix-ent-schema-parity-race
branch
from
May 22, 2026 21:42
5eafc92 to
8c6e692
Compare
kalbasit
added a commit
that referenced
this pull request
May 22, 2026
Replace context.Background() with t.Context() so the schema-create call is bound to the test lifetime. Drops the now-unused context import. Addresses gemini-code-assist comment from PR #1214 (PRRT_kwDONV6tZs6D3PyX); the original test_schema_parity file was folded into client_test.go but the same pattern lives in freshSchemaSQLite. Co-Authored-By: Claude Opus 4.7 <[email protected]>
kalbasit
force-pushed
the
fix-cache-tx-retry-on-duplicate-key
branch
from
May 22, 2026 21:54
4d9dffe to
b5e1526
Compare
kalbasit
force-pushed
the
fix-ent-schema-parity-race
branch
from
May 22, 2026 21:54
8c6e692 to
a9871de
Compare
kalbasit
added a commit
that referenced
this pull request
May 22, 2026
Replace context.Background() with t.Context() so the schema-create call is bound to the test lifetime. Drops the now-unused context import. Addresses gemini-code-assist comment from PR #1214 (PRRT_kwDONV6tZs6D3PyX); the original test_schema_parity file was folded into client_test.go but the same pattern lives in freshSchemaSQLite. Co-Authored-By: Claude Opus 4.7 <[email protected]>
kalbasit
force-pushed
the
fix-cache-tx-retry-on-duplicate-key
branch
from
May 22, 2026 23:02
b5e1526 to
4f6983d
Compare
kalbasit
force-pushed
the
fix-ent-schema-parity-race
branch
from
May 22, 2026 23:02
a9871de to
66a7315
Compare
kalbasit
added a commit
that referenced
this pull request
May 22, 2026
Replace context.Background() with t.Context() so the schema-create call is bound to the test lifetime. Drops the now-unused context import. Addresses gemini-code-assist comment from PR #1214 (PRRT_kwDONV6tZs6D3PyX); the original test_schema_parity file was folded into client_test.go but the same pattern lives in freshSchemaSQLite. Co-Authored-By: Claude Opus 4.7 <[email protected]>
kalbasit
force-pushed
the
fix-cache-tx-retry-on-duplicate-key
branch
from
May 22, 2026 23:16
4f6983d to
a0916be
Compare
kalbasit
force-pushed
the
fix-ent-schema-parity-race
branch
from
May 22, 2026 23:16
66a7315 to
27bd57a
Compare
kalbasit
added a commit
that referenced
this pull request
May 22, 2026
Replace context.Background() with t.Context() so the schema-create call is bound to the test lifetime. Drops the now-unused context import. Addresses gemini-code-assist comment from PR #1214 (PRRT_kwDONV6tZs6D3PyX); the original test_schema_parity file was folded into client_test.go but the same pattern lives in freshSchemaSQLite. Co-Authored-By: Claude Opus 4.7 <[email protected]>
kalbasit
force-pushed
the
fix-cache-tx-retry-on-duplicate-key
branch
from
May 22, 2026 23:28
a0916be to
8068305
Compare
kalbasit
force-pushed
the
fix-ent-schema-parity-race
branch
from
May 22, 2026 23:28
27bd57a to
289a2b5
Compare
kalbasit
added a commit
that referenced
this pull request
May 22, 2026
Replace context.Background() with t.Context() so the schema-create call is bound to the test lifetime. Drops the now-unused context import. Addresses gemini-code-assist comment from PR #1214 (PRRT_kwDONV6tZs6D3PyX); the original test_schema_parity file was folded into client_test.go but the same pattern lives in freshSchemaSQLite. Co-Authored-By: Claude Opus 4.7 <[email protected]>
kalbasit
force-pushed
the
fix-cache-tx-retry-on-duplicate-key
branch
from
May 22, 2026 23:54
8068305 to
4426c69
Compare
kalbasit
force-pushed
the
fix-ent-schema-parity-race
branch
from
May 22, 2026 23:54
289a2b5 to
334b47e
Compare
kalbasit
added a commit
that referenced
this pull request
May 22, 2026
Replace context.Background() with t.Context() so the schema-create call is bound to the test lifetime. Drops the now-unused context import. Addresses gemini-code-assist comment from PR #1214 (PRRT_kwDONV6tZs6D3PyX); the original test_schema_parity file was folded into client_test.go but the same pattern lives in freshSchemaSQLite. Co-Authored-By: Claude Opus 4.7 <[email protected]>
kalbasit
force-pushed
the
fix-cache-tx-retry-on-duplicate-key
branch
from
May 23, 2026 00:07
4426c69 to
e3a1d74
Compare
kalbasit
force-pushed
the
fix-ent-schema-parity-race
branch
from
May 23, 2026 00:07
334b47e to
08e7741
Compare
kalbasit
added a commit
that referenced
this pull request
May 23, 2026
Replace context.Background() with t.Context() so the schema-create call is bound to the test lifetime. Drops the now-unused context import. Addresses gemini-code-assist comment from PR #1214 (PRRT_kwDONV6tZs6D3PyX); the original test_schema_parity file was folded into client_test.go but the same pattern lives in freshSchemaSQLite. Co-Authored-By: Claude Opus 4.7 <[email protected]>
kalbasit
force-pushed
the
fix-cache-tx-retry-on-duplicate-key
branch
from
May 23, 2026 00:35
e3a1d74 to
5c887f0
Compare
kalbasit
force-pushed
the
fix-ent-schema-parity-race
branch
from
May 23, 2026 00:35
08e7741 to
4e5a13c
Compare
kalbasit
added a commit
that referenced
this pull request
May 23, 2026
Replace context.Background() with t.Context() so the schema-create call is bound to the test lifetime. Drops the now-unused context import. Addresses gemini-code-assist comment from PR #1214 (PRRT_kwDONV6tZs6D3PyX); the original test_schema_parity file was folded into client_test.go but the same pattern lives in freshSchemaSQLite. Co-Authored-By: Claude Opus 4.7 <[email protected]>
kalbasit
force-pushed
the
fix-cache-tx-retry-on-duplicate-key
branch
from
May 23, 2026 03:31
5c887f0 to
abf51c9
Compare
TestEntSchemaParity runs t.Parallel() alongside TestClient_Close and TestWithTransaction_*, all of which call Ents Schema.Create against the package-level migrate.Tables slice. Atlas mutates that slice during setupTables/realm, so the unsynchronised parallel calls trip go test -race. Wrap m.Create with the same database.SchemaCreateMu mutex the other parallel helpers (freshSchemaSQLite, etc.) already use. The two tests now serialise their schema bootstrap and race-detector stops firing. Co-Authored-By: Claude Opus 4.7 <[email protected]>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1214 +/- ##
=====================================
Coverage 5.68% 5.68%
=====================================
Files 6 6
Lines 387 387
=====================================
Hits 22 22
Misses 361 361
Partials 4 4 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
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.
TestEntSchemaParity runs t.Parallel() alongside TestClient_Close and
TestWithTransaction_*, all of which call Ents Schema.Create against
the package-level migrate.Tables slice. Atlas mutates that slice
during setupTables/realm, so the unsynchronised parallel calls trip
go test -race.
Wrap m.Create with the same database.SchemaCreateMu mutex the other
parallel helpers (freshSchemaSQLite, etc.) already use. The two tests
now serialise their schema bootstrap and race-detector stops firing.
Co-Authored-By: Claude Opus 4.7 [email protected]