Skip to content

refactor: drop the second vss client - #149

Merged
ovitrif merged 1 commit into
mainfrom
refactor/one-vss-client
Dec 1, 2026
Merged

ovitrif merged 1 commit into
mainfrom
refactor/one-vss-client

Conversation

@ovitrif

@ovitrif ovitrif commented Dec 1, 2026

Copy link
Copy Markdown
Collaborator

Refs: #148, #147

Description

VssStore kept a second pair of clients for KVStore so the outer and internal runtimes wouldn't share connections. Both KVStoreSync and KVStore now 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: client and write_client replace blocking_client, async_client, blocking_write_client and async_write_client.
  • connection_tests::first_write_reuses_the_read_connection now expects one connection for sync and async reads and writes together.

Test

  • cargo test --lib io::vss_store: 25 passed.

Models used

  • Planning/scoping: Not used
  • Implementation: Claude Opus 5.5 (reasoning: medium)
  • Review: Not performed

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)
@ovitrif ovitrif self-assigned this Dec 1, 2026
@ovitrif
ovitrif requested review from a team, jvsena42 and piotr-iohk and removed request for a team December 1, 2026 19:26
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Dec 1, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-12-01T19:30:12.340494Z f42caac PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@talosmachina talosmachina left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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. KVStoreSync calls block_in_place(|| internal_runtime.handle().block_on(fut)) and KVStore calls runtime.spawn on the same internal runtime, and new drives 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: client keeps retry_policy(), write_client keeps no_retry_policy() with fenced_retry bounding writes, the same split as before; the policies are per VssClient, 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's shutdown_background treats 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 piotr-iohk left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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_store unit tests (25/25 passed), full --lib unit test suite (164/164 passed), and 30/30 consecutive runs of io::vss_store::connection_tests::first_write_reuses_the_read_connection.
  • PR CI check mobile-builds-unwind succeeded on f42caac, though it does not run Rust unit tests (rust.yml and vss-integration.yml are manual workflow_dispatch workflows).
  • Limitation: #[cfg(vss_test)] integration tests (io::vss_store::tests and tests/integration_tests_vss.rs) require a running PostgreSQL + vss-server instance (TEST_VSS_BASE_URL) and were not executed in this review; run the vss-integration.yml workflow if live-server verification against vss-server is wanted before release.

Reviewer model: gemini-4-neon
Reasoning effort: high

@ovitrif

ovitrif commented Dec 1, 2026

Copy link
Copy Markdown
Collaborator Author

Merging: approved, CI green on f42caac.

@ovitrif
ovitrif merged commit a5c32cf into main Dec 1, 2026
1 check passed
@ovitrif
ovitrif deleted the refactor/one-vss-client branch December 1, 2026 21:10
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.

3 participants