|
| 1 | +<!-- maggus-id: e6292fba-8caa-4626-8dc9-62addb3ef33b --> |
| 2 | +# Feature 046: Transport Layer Split (Tcp/, Quic/, Connection/) |
| 3 | + |
| 4 | +## Introduction |
| 5 | + |
| 6 | +Splits the flat `TurboHttp.Transport` namespace into three component-based sub-namespaces: |
| 7 | +`Tcp/`, `Quic/`, and `Connection/`. Currently all 15 transport files share a single |
| 8 | +`TurboHttp.Transport` namespace, making it impossible to distinguish TCP concerns from |
| 9 | +QUIC concerns from connection-management concerns at a glance. |
| 10 | + |
| 11 | +This is the lowest-risk batch of the production code restructuring because `Transport/` is |
| 12 | +an internal layer with a small, well-defined set of consumers (Streams engines and test files). |
| 13 | + |
| 14 | +### Architecture Context |
| 15 | + |
| 16 | +- **Vision alignment:** Makes the transport layer navigable by protocol (TCP vs. QUIC) and |
| 17 | + responsibility (connection lifecycle), matching how contributors think about the problem. |
| 18 | +- **Components involved:** `TurboHttp.Transport` (all 15 files), `TurboHttp.Streams` (engines |
| 19 | + that import transport types), `TurboHttp.Tests.Transport` (8 test files) |
| 20 | +- **New namespaces introduced:** `TurboHttp.Transport.Tcp`, `TurboHttp.Transport.Quic`, |
| 21 | + `TurboHttp.Transport.Connection` |
| 22 | +- **Prerequisite for:** Feature 047–052 (those batches may reference transport types) |
| 23 | + |
| 24 | +--- |
| 25 | + |
| 26 | +## Goals |
| 27 | + |
| 28 | +- Move 15 transport files into `Tcp/`, `Quic/`, and `Connection/` subfolders |
| 29 | +- Update namespace declarations in all moved files |
| 30 | +- Update all `using` directives across the solution (Streams engines, test files) |
| 31 | +- Build green and all tests pass after the move |
| 32 | + |
| 33 | +--- |
| 34 | + |
| 35 | +## File Mapping |
| 36 | + |
| 37 | +### Tcp/ (3 files) |
| 38 | +| File | Old namespace | New namespace | |
| 39 | +|------|--------------|---------------| |
| 40 | +| `TcpConnectionStage.cs` | `TurboHttp.Transport` | `TurboHttp.Transport.Tcp` | |
| 41 | +| `TcpOptionsFactory.cs` | `TurboHttp.Transport` | `TurboHttp.Transport.Tcp` | |
| 42 | +| `DirectConnectionFactory.cs` | `TurboHttp.Transport` | `TurboHttp.Transport.Tcp` | |
| 43 | + |
| 44 | +### Quic/ (5 files) |
| 45 | +| File | Old namespace | New namespace | |
| 46 | +|------|--------------|---------------| |
| 47 | +| `QuicConnectionStage.cs` | `TurboHttp.Transport` | `TurboHttp.Transport.Quic` | |
| 48 | +| `QuicConnectionManager.cs` | `TurboHttp.Transport` | `TurboHttp.Transport.Quic` | |
| 49 | +| `QuicClientProvider.cs` | `TurboHttp.Transport` | `TurboHttp.Transport.Quic` | |
| 50 | +| `QuicOptions.cs` | `TurboHttp.Transport` | `TurboHttp.Transport.Quic` | |
| 51 | +| `StreamDirection.cs` | `TurboHttp.Transport` | `TurboHttp.Transport.Quic` | |
| 52 | + |
| 53 | +### Connection/ (7 files) |
| 54 | +| File | Old namespace | New namespace | |
| 55 | +|------|--------------|---------------| |
| 56 | +| `IClientProvider.cs` | `TurboHttp.Transport` | `TurboHttp.Transport.Connection` | |
| 57 | +| `ClientByteMover.cs` | `TurboHttp.Transport` | `TurboHttp.Transport.Connection` | |
| 58 | +| `ClientState.cs` | `TurboHttp.Transport` | `TurboHttp.Transport.Connection` | |
| 59 | +| `ConnectionHandle.cs` | `TurboHttp.Transport` | `TurboHttp.Transport.Connection` | |
| 60 | +| `ConnectionLease.cs` | `TurboHttp.Transport` | `TurboHttp.Transport.Connection` | |
| 61 | +| `ConnectionManagerActor.cs` | `TurboHttp.Transport` | `TurboHttp.Transport.Connection` | |
| 62 | +| `AbruptCloseException.cs` | `TurboHttp.Transport` | `TurboHttp.Transport.Connection` | |
| 63 | + |
| 64 | +--- |
| 65 | + |
| 66 | +## Tasks |
| 67 | + |
| 68 | +### TASK-046-001: Audit Transport/ Consumers |
| 69 | +**Description:** As a developer, I want to know every file outside `Transport/` that imports |
| 70 | +`TurboHttp.Transport` types so that no `using` directive is missed during the move. |
| 71 | + |
| 72 | +**Token Estimate:** ~10k tokens |
| 73 | +**Predecessors:** none |
| 74 | +**Successors:** TASK-046-002 |
| 75 | +**Parallel:** no — audit output gates the migration |
| 76 | +**Model:** haiku |
| 77 | + |
| 78 | +**Acceptance Criteria:** |
| 79 | +- [ ] Run Roslyn Navigator `find_references` on `IClientProvider`, `ClientByteMover`, |
| 80 | + `ConnectionLease`, `ConnectionManagerActor`, `TcpConnectionStage`, `QuicConnectionStage` |
| 81 | +- [ ] Produce a list of all files that carry `using TurboHttp.Transport;` |
| 82 | +- [ ] Confirm the list matches expectation (Streams engines + test files only) |
| 83 | +- [ ] No external public API surface imports transport types directly |
| 84 | + |
| 85 | +--- |
| 86 | + |
| 87 | +### TASK-046-002: Move and Re-namespace Transport Files |
| 88 | +**Description:** As a developer, I want all 15 transport files physically moved into |
| 89 | +`Tcp/`, `Quic/`, and `Connection/` subfolders and their namespace declarations updated |
| 90 | +so that the folder structure matches the code organisation. |
| 91 | + |
| 92 | +**Token Estimate:** ~30k tokens |
| 93 | +**Predecessors:** TASK-046-001 |
| 94 | +**Successors:** TASK-046-003 |
| 95 | +**Parallel:** no |
| 96 | + |
| 97 | +**Acceptance Criteria:** |
| 98 | +- [ ] `src/TurboHttp/Transport/Tcp/` contains exactly 3 files |
| 99 | +- [ ] `src/TurboHttp/Transport/Quic/` contains exactly 5 files |
| 100 | +- [ ] `src/TurboHttp/Transport/Connection/` contains exactly 7 files |
| 101 | +- [ ] `src/TurboHttp/Transport/` root contains no `.cs` files |
| 102 | +- [ ] Every moved file declares the correct new namespace |
| 103 | +- [ ] No file content changes other than the `namespace` line |
| 104 | + |
| 105 | +--- |
| 106 | + |
| 107 | +### TASK-046-003: Update All `using` Directives |
| 108 | +**Description:** As a developer, I want every consumer of transport types to import the |
| 109 | +correct new sub-namespace so that the solution compiles without errors. |
| 110 | + |
| 111 | +**Token Estimate:** ~20k tokens |
| 112 | +**Predecessors:** TASK-046-002 |
| 113 | +**Successors:** TASK-046-004 |
| 114 | +**Parallel:** no |
| 115 | + |
| 116 | +**Acceptance Criteria:** |
| 117 | +- [ ] All `using TurboHttp.Transport;` replaced with the appropriate sub-namespace(s) |
| 118 | + in every consumer file identified by TASK-046-001 |
| 119 | +- [ ] No `using TurboHttp.Transport;` remains anywhere in the solution |
| 120 | +- [ ] No logic changes — only `using` directive updates |
| 121 | + |
| 122 | +--- |
| 123 | + |
| 124 | +### TASK-046-004: Build and Test Verification |
| 125 | +**Description:** As a developer, I want the full build and test suite to pass after the |
| 126 | +Transport split so that the migration is confirmed safe. |
| 127 | + |
| 128 | +**Token Estimate:** ~10k tokens |
| 129 | +**Predecessors:** TASK-046-003 |
| 130 | +**Successors:** none |
| 131 | +**Parallel:** no |
| 132 | +**Model:** haiku |
| 133 | + |
| 134 | +**Acceptance Criteria:** |
| 135 | +- [ ] `dotnet build ./src/TurboHttp.sln` — zero errors, zero warnings introduced |
| 136 | +- [ ] `dotnet test --project TurboHttp.Tests/TurboHttp.Tests.csproj` — green |
| 137 | +- [ ] `dotnet test --project TurboHttp.StreamTests/TurboHttp.StreamTests.csproj` — green |
| 138 | +- [ ] `dotnet test --project TurboHttp.IntegrationTests/TurboHttp.IntegrationTests.csproj` — green |
| 139 | + |
| 140 | +--- |
| 141 | + |
| 142 | +## Task Dependency Graph |
| 143 | + |
| 144 | +``` |
| 145 | +TASK-046-001 ──→ TASK-046-002 ──→ TASK-046-003 ──→ TASK-046-004 |
| 146 | +``` |
| 147 | + |
| 148 | +| Task | Estimate | Predecessors | Parallel | Model | |
| 149 | +|------|----------|--------------|----------|-------| |
| 150 | +| TASK-046-001 | ~10k | none | no | haiku | |
| 151 | +| TASK-046-002 | ~30k | 001 | no | — | |
| 152 | +| TASK-046-003 | ~20k | 002 | no | — | |
| 153 | +| TASK-046-004 | ~10k | 003 | no | haiku | |
| 154 | + |
| 155 | +**Total estimated tokens:** ~70k |
| 156 | + |
| 157 | +--- |
| 158 | + |
| 159 | +## Functional Requirements |
| 160 | + |
| 161 | +- FR-1: All 15 transport files land in exactly one of `Tcp/`, `Quic/`, or `Connection/` |
| 162 | +- FR-2: No `.cs` file remains in `Transport/` root after completion |
| 163 | +- FR-3: The public contract of all transport types is unchanged — no method, property, |
| 164 | + or constructor signatures modified |
| 165 | +- FR-4: Build produces zero errors and zero new warnings |
| 166 | +- FR-5: Full test suite (unit + stream + integration) passes unchanged |
| 167 | + |
| 168 | +## Non-Goals |
| 169 | + |
| 170 | +- No logic changes of any kind |
| 171 | +- No changes to `Streams/` folder structure |
| 172 | +- No changes to `Protocol/` (covered by Features 047–052) |
| 173 | +- No public API surface changes |
| 174 | + |
| 175 | +## Success Metrics |
| 176 | + |
| 177 | +- `src/TurboHttp/Transport/*.cs` directory is empty |
| 178 | +- CI build green on first run after merge |
| 179 | + |
| 180 | +## Open Questions |
| 181 | + |
| 182 | +*(none)* |
0 commit comments