fix(rivetkit): hide pending connections during preflight#4969
fix(rivetkit): hide pending connections during preflight#4969NathanFlurry merged 1 commit intomainfrom
Conversation
Code Review: PR #4969 — fix(rivetkit): hide pending connections during preflightOverviewThis PR introduces a preflight phase in the connection lifecycle. Connections are now hidden from The mechanism is a new CorrectnessLifecycle reordering in // Before: insert → prepare → open
// After: preflight → insert → open
self.emit_connection_preflight(&conn, params.clone(), request.clone()).await?;
self.insert_existing(conn.clone());
if let Err(error) = self.emit_connection_open(&conn, request).await { ... }The removal of the
ActorEvent::ConnectionOpen { .. } => {
unreachable!("ConnectionOpen is handled by Events")
}This is safe because Timeout composition in let timeout_duration = config
.on_before_connect_timeout
.saturating_add(config.create_conn_state_timeout);This outer timeout is the sum of both inner timeouts (which are enforced individually inside the NAPI/WASM handlers). This is correct: in the worst case both callbacks consume their full budget. Potential Issues
Style / Convention
Test Coverage
SummaryThe change is logically sound, well-structured, and correctly threads the lifecycle change through all four runtimes. Two callouts worth addressing before merge:
|
cf92296 to
c7dee23
Compare
660b761 to
8cd9dea
Compare
c7dee23 to
e590e33
Compare
8cd9dea to
0cdeda4
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: