Skip to content

Commit f975b4e

Browse files
docs(Common): Refactor transport layer to trait-based abstraction
Update architecture documentation to reflect the shift from concrete transport implementations in Common to a trait-based `TransportStrategy` interface. The transport layer now defines only the trait surface and configuration types, with concrete implementations (`gRPCTransport`, `IPCTransport`, `WASMTransport`, `MistTransport`) delegated to the `Grove` element. Remove references to the deprecated transport modules (circuit breaker, metrics, dynamic selection) from Common's public API. The `IPCProvider` table entry simplifies to exclude 'establish' as connection lifecycle is now handled by the transport implementations. Documentation in `Documentation/GitHub/Architecture.md` and `README.md` updated to match the current architectural state. No code changes—purely documentation alignment.
1 parent 8827bf2 commit f975b4e

2 files changed

Lines changed: 14 additions & 17 deletions

File tree

Documentation/GitHub/Architecture.md

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ graph TB
3636
ENV["Environment / Requires<br/>compile-time DI"]
3737
DTO["Data Transfer Objects<br/>FileStat / InitData /<br/>TerminalOptions"]
3838
ERR["CommonError<br/>unified error enum"]
39-
TRANS["Transport Layer<br/>gRPC / IPC / WASM"]
39+
TRANS["Transport Layer<br/>TransportStrategy + Config"]
4040
TEL["Telemetry<br/>PostHog + OTLP"]
4141
4242
TRAITS --> AE
@@ -123,7 +123,7 @@ pub trait FileSystem: Send + Sync {
123123
| `Testing/` | `TestController` | Testing | run, discover, results |
124124
| `SourceControlManagement/` | `SourceControlManagementProvider` | SCM | status, commit, push, pull, diff |
125125
| `Synchronization/` | `SynchronizationProvider` | Sync | push, pull, merge, resolve |
126-
| `IPC/` | `IPCProvider` | Communication | establish, send, receive, proxy |
126+
| `IPC/` | `IPCProvider` | Communication | send, receive, proxy |
127127
| `Webview/` | `WebviewProvider` | Webviews | create, sendMessage, dispose |
128128
| `TreeView/` | `TreeViewProvider` | Tree views | getChildren, getParent, resolveItem |
129129
| `StatusBar/` | `StatusBarProvider` | Status bar | setItem, updateItem, removeItem |
@@ -243,7 +243,7 @@ Effect executed with concrete implementation
243243
| `ConfigurationTarget` | `Configuration` | Global, Workspace, WorkspaceFolder | Config ops |
244244
| `SearchOptions` | `Search` | pattern, include, exclude, maxResults | Search ops |
245245
| `WorkspaceEditDTO` | `DTO/` | edits, fileCreates, fileDeletes | Workspace edits |
246-
| `TransportConfig` | `Transport` | strategy, timeout, retry config | IPC configuration |
246+
| `TransportConfig` | `Transport` | timeout, retry config | Transport configuration |
247247

248248
---
249249

@@ -272,19 +272,17 @@ pub enum CommonError {
272272
`Common` provides a transport-agnostic communication interface:
273273

274274
```rust
275-
pub enum TransportStrategy {
276-
Grpc(GrpcConfig),
277-
Ipc(IpcConfig),
278-
Wasm(WasmConfig),
275+
pub trait TransportStrategy: Send + Sync {
276+
type Error: std::error::Error + Send + Sync + 'static;
277+
async fn connect(&self) -> Result<(), Self::Error>;
278+
async fn send(&self, request: &[u8]) -> Result<Vec<u8>, Self::Error>;
279+
async fn close(&self) -> Result<(), Self::Error>;
280+
fn is_connected(&self) -> bool;
281+
fn transport_type(&self) -> TransportType;
279282
}
280283
```
281284

282-
| Feature | Description |
283-
| ----------------- | ------------------------------------------------- |
284-
| Circuit breaker | Automatic failure detection and isolation |
285-
| Retry | Configurable retry with exponential backoff |
286-
| Metrics | Prometheus metrics for transport operations |
287-
| Dynamic selection | Runtime transport switching based on availability |
285+
`Common` defines the trait surface and `TransportConfig`; concrete transports (`gRPCTransport`, `IPCTransport`, `WASMTransport`, `MistTransport`) live in `Grove`.
288286

289287
---
290288

README.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -72,9 +72,8 @@ The DTO library provides all data structures used for IPC communication with
7272
across every service domain, making error handling consistent and predictable.
7373

7474
The `Transport` layer offers transport-agnostic communication through a unified
75-
`TransportStrategy` interface. It supports `gRPC`, `IPC`, and `WASM` with
76-
built-in circuit breaker, retry logic, metrics collection, and dynamic transport
77-
selection. The `Telemetry` module provides a dual-pipe (`PostHog` + `OTLP`) emit
75+
`TransportStrategy` trait. Concrete implementations (`gRPCTransport`, `IPCTransport`,
76+
`WASMTransport`, `MistTransport`) live in `Grove`. The `Telemetry` module provides a dual-pipe (`PostHog` + `OTLP`) emit
7877
surface shared across all `Rust` sidecars.
7978

8079
---
@@ -222,7 +221,7 @@ graph LR
222221
Errors["CommonError - unified error enum"]:::common
223222
end
224223
subgraph INFRA["Infrastructure"]
225-
Transport["Transport/ - TransportStrategy\ngRPC · IPC · WASM + circuit breaker"]:::transport
224+
Transport["Transport/ - TransportStrategy\ntrait + config types"]:::transport
226225
Telemetry["Telemetry/ - PostHog + OTLP\ndual-pipe emit surface"]:::common
227226
Env["Environment/ + Effect/\nApplicationRunTime trait\nDI via Requires / HasEnvironment"]:::common
228227
end

0 commit comments

Comments
 (0)