Skip to content

refactor(depot-client): split embedded depot transport#4970

Merged
NathanFlurry merged 1 commit intomainfrom
depot-client/split-embedded-transport
May 5, 2026
Merged

refactor(depot-client): split embedded depot transport#4970
NathanFlurry merged 1 commit intomainfrom
depot-client/split-embedded-transport

Conversation

@NathanFlurry
Copy link
Copy Markdown
Member

Description

Please include a summary of the changes and the related issue. Please also include relevant motivation and context.

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

How Has This Been Tested?

Please describe the tests that you ran to verify your changes.

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes

Copy link
Copy Markdown
Member Author

NathanFlurry commented May 5, 2026

This stack of pull requests is managed by Graphite. Learn more about stacking.

@claude
Copy link
Copy Markdown
Contributor

claude Bot commented May 5, 2026

Code Review: refactor(depot-client): split embedded depot transport

Overview

This PR extracts EmbeddedDepotSqliteTransport (and its open_database_from_embedded_depot helper) out of depot-client into a new depot-client-embedded crate. The stated motivation -- keeping the engine-internal depot dependency out of the base depot-client crate that NAPI uses -- is sound and the split is clean.

The PR also removes rivet-pools from rivetkit-core, replacing pooled reqwest client calls with Client::builder().build().


What works well

  • Correct dependency boundary. depot-client no longer depends on the engine-internal depot crate. The new crate is small and focused.
  • Module doc comment in depot-client-embedded/src/lib.rs is clear and explains why the split exists.
  • Workspace member ordering groups the three depot-client* crates together alphabetically.
  • Call-site update in pegboard-envoy/src/ws_to_tunnel_task.rs is minimal and correct.

Issues / observations

1. Reqwest client lifecycle change (minor)

rivet_pools::reqwest::client() is a global singleton (OnceCell) that sets user_agent: RivetEngine/{version}, a 30-second global timeout, and shares a single connection pool across all callers.

The replacement Client::builder().build() creates a new client on every call with no shared state, no user agent, and no global timeout.

Correctness risk is low: both probe_existing_engine and wait_for_engine_health already set per-request timeouts (1 s each), and ensure_local_normal_runner_config is a one-shot startup call. But connection reuse between the three startup callers is lost. If this is intentional, a LazyLock<reqwest::Client> local to those files would restore connection reuse without re-adding the rivet-pools dependency.

2. Redundant [lib] section in depot-client-embedded/Cargo.toml (nit)

crate-type = ["lib"] is the Cargo default and can be dropped entirely.

3. No test coverage noted

The new crate is essentially a move-and-rename, so existing integration tests through pegboard-envoy should still cover it. The PR template test section is blank -- worth noting which tests exercise open_database_from_embedded_depot so the refactor is verifiably safe.


Summary

The dependency split is the right architectural call and the implementation is clean. The main follow-up is whether the per-call reqwest client creation vs. the old shared-pool behavior is intentional. Otherwise this is a good change.

@NathanFlurry NathanFlurry marked this pull request as ready for review May 5, 2026 11:33
@NathanFlurry NathanFlurry force-pushed the conn-preflight/hide-pending-conns branch from 660b761 to 8cd9dea Compare May 5, 2026 11:53
@NathanFlurry NathanFlurry force-pushed the depot-client/split-embedded-transport branch from ad3a166 to 6409fea Compare May 5, 2026 11:53
@NathanFlurry NathanFlurry force-pushed the depot-client/split-embedded-transport branch from 6409fea to f89fcba Compare May 5, 2026 12:09
@NathanFlurry NathanFlurry changed the base branch from conn-preflight/hide-pending-conns to graphite-base/4970 May 5, 2026 13:14
@NathanFlurry NathanFlurry force-pushed the depot-client/split-embedded-transport branch from f89fcba to c636bc6 Compare May 5, 2026 13:15
@NathanFlurry NathanFlurry changed the base branch from graphite-base/4970 to actor-persist/legacy-v4-args-fallback May 5, 2026 13:15
@NathanFlurry NathanFlurry force-pushed the actor-persist/legacy-v4-args-fallback branch from 33cc9e7 to 1f35f57 Compare May 5, 2026 13:40
@NathanFlurry NathanFlurry force-pushed the depot-client/split-embedded-transport branch from c636bc6 to 16bba5e Compare May 5, 2026 13:40
Base automatically changed from actor-persist/legacy-v4-args-fallback to main May 5, 2026 14:58
@NathanFlurry NathanFlurry merged commit 16bba5e into main May 5, 2026
6 of 12 checks passed
@NathanFlurry NathanFlurry deleted the depot-client/split-embedded-transport branch May 5, 2026 14:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants