Repository navigation
refactor: drop the second vss client - #149
Conversation
KVStoreSync and KVStore both run their requests on the store's internal runtime, so the separate async read and write clients, kept to avoid sharing connections across runtimes, no longer serve a purpose. Reads and lists now share one client and writes and removes another, both over one reqwest client, so every request reuses the same connection. Verified: cargo test --lib io::vss_store (25 passed), cargo clippy --lib (no new warnings in vss_store.rs)
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
talosmachina
left a comment
There was a problem hiding this comment.
No findings. Collapses VssStore's four VssClients into one read client and one write client over a single reqwest client, since KVStoreSync and KVStore both already run their requests on the internal runtime. Reviewed f42caac, full tier.
What I checked, and 4 candidates I ruled out
Read in full: src/io/vss_store.rs at f42caac (constructor, both trait impls, Drop, VssStoreInner, the retry policies, connection_tests)
Call sites traced: every former blocking_client / async_client / *_write_client use (none left in src or tests), VssStoreInner::new (one caller)
CI: mobile-builds-unwind green; it does not run the unit tests
Build: build skipped: the author-permission check could not run on this repo, so this review is static and cargo test --lib io::vss_store was not run here
Ruled out
- Connections shared across two runtimes: the reason the second pair existed.
KVStoreSynccallsblock_in_place(|| internal_runtime.handle().block_on(fut))andKVStorecallsruntime.spawnon the same internal runtime, andnewdrives the schema-version request through that runtime's handle too, so every pooled connection's task lives on one runtime. - Retry policy leaking between reads and writes:
clientkeepsretry_policy(),write_clientkeepsno_retry_policy()withfenced_retrybounding writes, the same split as before; the policies are perVssClient, not per reqwest client. - Sync and async writes contending on one connection: reqwest's pool opens another connection when one is busy, so sharing a client changes reuse, not concurrency.
- Lazy removes on the shared client: still spawned on the internal runtime and still use the write client, so
Drop'sshutdown_backgroundtreats them as before.
Merge confidence: 4/5, no findings and first_write_reuses_the_read_connection covers the change, but CI does not run it and I could not run it here.
piotr-iohk
left a comment
There was a problem hiding this comment.
QA review
Scope: full PR diff against its merge base, at f42caac.
No new actionable code findings.
No actionable code findings. All VssStore operations (VssStore::new, KVStoreSync, and KVStore, including lazy removals) execute exclusively on internal_runtime, so sharing one reqwest::Client between client (with retry_policy() for schema version, reads, and lists) and write_client (with no_retry_policy() under fenced_retry for writes and removes) does not cross Tokio runtimes or weaken write fencing. No public Rust or UniFFI API contracts changed, so no downstream consumer or mobile-app changes are required.
Validation:
- Executed locally at f42caac (Rust stable 1.100.1,
--locked):io::vss_storeunit tests (25/25 passed), full--libunit test suite (164/164 passed), and 30/30 consecutive runs ofio::vss_store::connection_tests::first_write_reuses_the_read_connection. - PR CI check
mobile-builds-unwindsucceeded onf42caac, though it does not run Rust unit tests (rust.ymlandvss-integration.ymlare manualworkflow_dispatchworkflows). - Limitation:
#[cfg(vss_test)]integration tests (io::vss_store::testsandtests/integration_tests_vss.rs) require a running PostgreSQL +vss-serverinstance (TEST_VSS_BASE_URL) and were not executed in this review; run thevss-integration.ymlworkflow if live-server verification againstvss-serveris wanted before release.
Reviewer model: gemini-4-neon
Reasoning effort: high
|
Merging: approved, CI green on f42caac. |
Refs: #148, #147
Description
VssStorekept a second pair of clients forKVStoreso the outer and internal runtimes wouldn't share connections. BothKVStoreSyncandKVStorenow run their requests on the store's internal runtime, so that split no longer exists, as noted on #148. This drops the second pair: reads and lists use one client, writes and removes another, both over one reqwest client.Changes
VssStoreInner:clientandwrite_clientreplaceblocking_client,async_client,blocking_write_clientandasync_write_client.connection_tests::first_write_reuses_the_read_connectionnow expects one connection for sync and async reads and writes together.Test
cargo test --lib io::vss_store: 25 passed.Models used
Claude Opus 5.5(reasoning:medium)