Skip to content

chore(depot-client): split sqlite vfs transports#4922

Closed
NathanFlurry wants to merge 1 commit into05-03-feat_rivetkit_support_gateway_bypass_probesfrom
sqlite-soak/sqlite-transport-trait
Closed

chore(depot-client): split sqlite vfs transports#4922
NathanFlurry wants to merge 1 commit into05-03-feat_rivetkit_support_gateway_bypass_probesfrom
sqlite-soak/sqlite-transport-trait

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 4, 2026

Warning

This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
Learn more

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

@claude
Copy link
Copy Markdown
Contributor

claude Bot commented May 4, 2026

PR 4922 Review: chore(depot-client) split sqlite vfs transports

Overview

This PR refactors the SQLite VFS transport layer from a concrete enum-based design to a trait-based design. The key motivation is removing the rivet-envoy-client dependency from depot-client, which unblocks WASM builds. The three concrete transports become:

  • EnvoySqliteTransport (in rivetkit-core) -- wraps EnvoyHandle for actor-side use
  • EmbeddedDepotSqliteTransport (in depot-client/src/transport.rs) -- same-process Depot calls, formerly the Conveyer variant
  • DirectDepotTransport / DirectMirrorTransport (test-only in vfs_support.rs) -- replace the old Direct enum variant and strict_mode flag

Strengths

  • Clean architecture: Moving from an open enum with cfg(test) arms scattered through production code to a trait is a clear quality improvement.
  • Correct WASM unblocking: Removing rivet-envoy-client from depot-client is the right fix.
  • Strict-mode removal: Replacing the runtime AtomicBool flag with transport-type selection encodes behavior in the type, not runtime state.
  • Deduplication: open_database_from_embedded_depot now delegates to open_database_from_transport, removing duplicated VFS registration logic.
  • Debug assertions: The new cfg(debug_assertions) checks for pages within db_size_pages are useful for catching correctness bugs in dev.
  • decode_serverless_actor_start_payload de-indentation: The function was accidentally nested inside impl EnvoyHandle -- legitimate fix.

Issues

1. Potential unused-variable warnings in release builds

Variables only used inside cfg(debug_assertions) blocks will be unused in release builds:

  • db_size_pages in io_read (extracted alongside file_size but only used in the debug block)
  • existing_db_size_pages in io_write (only consumed by the debug if let Some(...))
  • db_size_pages returned from the tuple in resolve_pages

These will warn (or error under -W warnings) in release/clippy passes. Fix with an _ = discard, allow(unused_variables), or _-prefix on the binding.

2. sqlite_error_reason duplicated across modules

sqlite_error_reason now exists in both depot-client/src/transport.rs (private) and tests/inline/vfs_support.rs. Consider a pub(crate) utility in a shared location.

3. seed_page_as_cold_ref poison byte ordering

Dirty pages prioritize snapshot.pages over fetched_by_pgno. If the poisoned pgno is already in snapshot.pages, the fetched_by_pgno.entry(pgno).or_insert(bytes) inserts the poison bytes but the snapshot copy takes priority -- poison bytes are silently discarded. In practice strict_direct_reopen_ignores_poisoned_mirror_and_reads_depot still passes because DirectDepotTransport never reads mirrors, but the contract of poison_mirror_page is now fragile. A comment clarifying this behavior would help.

4. DirectDepotTransport.commit no longer seeds the mirror

The old non-strict Direct transport called apply_commit after depot commit to update the in-memory mirror. DirectDepotTransport skips this entirely. The new DirectMirrorTransport covers that path, but the divergence should be documented in vfs_support.rs.

5. register_with_transport (test-only) called without initial page fetch for DirectDepotTransport

Tests like direct_engine_marks_vfs_dead_after_transport_errors call the cfg(test)-gated register_with_transport without fetching an initial page, differing from production. Fine for error-injection tests but a comment noting the omission would help.

Minor

  • Duplicated debug warning blocks: The db_size_pages mismatch check is copy-pasted for flush and atomic commit paths.
  • worker.rs formatting change: Correct but a drive-by unrelated to the core change.
  • server.ts diagnostics guard: Defensive and reasonable, but TypeScript should catch missing diagnostics upstream.

Verdict

The core architecture change is correct and the test adaptations are solid. Main actionable items before merge:

  1. Address potential unused-variable warnings for db_size_pages / existing_db_size_pages in release builds.
  2. Add a comment in seed_page_as_cold_ref about snapshot-priority behavior for poisoned pages.
  3. Document the DirectDepotTransport mirror-skip semantics in vfs_support.rs.

The WASM unblocking and transport trait introduction are the right direction.

@NathanFlurry NathanFlurry changed the base branch from sqlite-soak/serverless-start-limits to graphite-base/4922 May 4, 2026 00:54
@NathanFlurry NathanFlurry force-pushed the sqlite-soak/sqlite-transport-trait branch from f1c981f to a7e3f91 Compare May 4, 2026 00:54
@NathanFlurry NathanFlurry changed the base branch from graphite-base/4922 to 05-03-feat_rivetkit_support_gateway_bypass_probes May 4, 2026 00:54
@NathanFlurry NathanFlurry force-pushed the sqlite-soak/sqlite-transport-trait branch from a7e3f91 to 3df0cfa Compare May 4, 2026 01:09
@NathanFlurry NathanFlurry marked this pull request as ready for review May 4, 2026 01:51
@NathanFlurry NathanFlurry force-pushed the sqlite-soak/sqlite-transport-trait branch from 3df0cfa to 2b8b055 Compare May 4, 2026 01:54
@NathanFlurry NathanFlurry force-pushed the sqlite-soak/sqlite-transport-trait branch from 2b8b055 to 48fb65d Compare May 4, 2026 02:59
@NathanFlurry NathanFlurry force-pushed the 05-03-feat_rivetkit_support_gateway_bypass_probes branch from 5425291 to 7143a97 Compare May 4, 2026 03:01
@NathanFlurry NathanFlurry force-pushed the sqlite-soak/sqlite-transport-trait branch from 48fb65d to 48cc3bb Compare May 4, 2026 03:01
@NathanFlurry NathanFlurry force-pushed the sqlite-soak/sqlite-transport-trait branch from 48cc3bb to e650129 Compare May 4, 2026 04:13
@NathanFlurry NathanFlurry force-pushed the 05-03-feat_rivetkit_support_gateway_bypass_probes branch from 7143a97 to c47914d Compare May 4, 2026 04:13
@NathanFlurry
Copy link
Copy Markdown
Member Author

Landed in main via stack-merge fast-forward push. Commits are in main; closing to match.

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.

1 participant