[slop]fix(rivetkit): remove async drizzle db proxy#4984
Conversation
|
🚅 Deployed to the rivet-pr-4984 environment in rivet-frontend
|
This stack of pull requests is managed by Graphite. Learn more about stacking. |
|
PR 4984 Review: remove async drizzle db proxy Overview This PR removes the async Proxy-based lazy initializer from ActorContextHandleAdapter.get db and replaces it with a synchronous accessor. The old design wrapped the Drizzle client in a Proxy that called ensureDatabaseClient() asynchronously on every property access. The new design requires the client to be pre-warmed during the onMigrate lifecycle phase (runDatabaseMigrations() -> ensureDatabaseClient()) and then reads it synchronously from runtimeState.databaseClient. What is Good
Issues Dead code: prepare() method ActorContextHandleAdapter.prepare() (line 2694) is defined but has no call sites anywhere in the codebase. runDatabaseMigrations() is the actual pre-warm path used by the native lifecycle, making prepare() unreachable. It should be removed, or if it is an intentional public API hook, documented and wired into the lifecycle. Missing test for the new error code native-runtime-errors.test.ts has a test for database_not_configured (when no databaseProvider is set at all) but nothing for database_client_not_ready (when a provider is configured but the client was never pre-warmed). A unit test for that path in the same file would complete the error-path coverage. PR description is empty All checklist items are unchecked and there is no summary of motivation. A sentence explaining why the proxy was problematic would help future reviewers. Correctness The change is logically sound given the established lifecycle ordering:
The actor-db-init-order.test.ts tests validate this ordering end-to-end. Summary Solid improvement overall. Two minor items to address before merging: remove the dead prepare() method, and add a unit test for database_client_not_ready in native-runtime-errors.test.ts. |
1134c24 to
abb6ff1
Compare
abb6ff1 to
38d756b
Compare
38d756b to
d12b4c4
Compare
d12b4c4 to
c58ef25
Compare

Description
Please include a summary of the changes and the related issue. Please also include relevant motivation and context.
Type of change
How Has This Been Tested?
Please describe the tests that you ran to verify your changes.
Checklist: