|
| 1 | +<!-- maggus-id: baca5268-2d1b-422e-b801-4c8512dcd0df --> |
| 2 | +# Feature 002: HTTP/3 Configuration Foundation |
| 3 | + |
| 4 | +## Introduction |
| 5 | + |
| 6 | +HTTP/3's `Http3Options` is an empty placeholder class, while HTTP/2 has 5 configurable properties that flow through `ProtocolCoreBuilder` into `Http20Engine`. Additionally, `ProtocolCoreBuilder` applies HTTP/2's concurrency limits to HTTP/3 requests via a `Major >= 2` check. This feature populates `Http3Options`, wires it through the build pipeline, and decouples HTTP/3 limits from HTTP/2. |
| 7 | + |
| 8 | +### Architecture Context |
| 9 | + |
| 10 | +- **Vision alignment:** Configuration parity across protocol versions is a prerequisite for HTTP/3 reaching production quality (currently 75/100 in ARCHITECTURE.md) |
| 11 | +- **Components involved:** Client Layer (`Http3Options`, `TurboClientOptions`), Streams Layer (`ProtocolCoreBuilder`, `Http30Engine`, `Http30ConnectionStage`) |
| 12 | +- **No new patterns:** Follows the exact pattern established by `Http2Options` → `ProtocolCoreBuilder` → `Http20Engine` |
| 13 | +- **Architecture update needed:** Update ARCHITECTURE.md Implementation Status scores after completion |
| 14 | + |
| 15 | +## Goals |
| 16 | + |
| 17 | +- Populate `Http3Options` with QUIC/HTTP/3-equivalent configuration properties matching `Http2Options` coverage |
| 18 | +- Wire `Http3Options` values through `ProtocolCoreBuilder` into `Http30Engine` and `Http30ConnectionStage` |
| 19 | +- Decouple HTTP/3 concurrency and connection limits from HTTP/2 in `ProtocolCoreBuilder` |
| 20 | +- Update ARCHITECTURE.md to reflect configuration parity |
| 21 | + |
| 22 | +## Tasks |
| 23 | + |
| 24 | +### TASK-002-001: Populate Http3Options with configuration properties |
| 25 | +**Description:** As a library consumer, I want HTTP/3-specific configuration options so that I can tune QUIC connection behavior independently from HTTP/2. |
| 26 | + |
| 27 | +**Token Estimate:** ~25k tokens |
| 28 | +**Predecessors:** none |
| 29 | +**Successors:** TASK-002-002, TASK-002-003 |
| 30 | +**Parallel:** yes — can run alongside nothing (foundation task) |
| 31 | + |
| 32 | +**Acceptance Criteria:** |
| 33 | +- [ ] `Http3Options` has these properties with XML doc comments: |
| 34 | + - `MaxConnectionsPerServer` (int, default 4) — fewer than H2's 6 since QUIC multiplexes better |
| 35 | + - `QpackMaxTableCapacity` (int, default 4096) — QPACK dynamic table size |
| 36 | + - `QpackBlockedStreams` (int, default 100) — max streams blocked on encoder instructions |
| 37 | + - `MaxFieldSectionSize` (int, default 65536) — HTTP/3 equivalent of header size limits |
| 38 | + - `IdleTimeout` (TimeSpan, default 30s) — QUIC idle timeout |
| 39 | + - `MaxReconnectAttempts` (int, default 3) — reconnect limit for QUIC connection drops |
| 40 | +- [ ] Property style matches `Http2Options` (public getters/setters, summary comments referencing relevant RFCs) |
| 41 | +- [ ] `TurboClientOptions.Http3` property already exists and returns `Http3Options` — verify it works with new properties |
| 42 | +- [ ] Unit test validates defaults match documented values |
| 43 | +- [ ] Typecheck passes: `dotnet build --configuration Release ./src/TurboHTTP.sln` |
| 44 | + |
| 45 | +**Files to modify:** |
| 46 | +- `src/TurboHTTP/Http3Options.cs` |
| 47 | + |
| 48 | +**Reference files:** |
| 49 | +- `src/TurboHTTP/Http2Options.cs` (pattern to follow) |
| 50 | + |
| 51 | +--- |
| 52 | + |
| 53 | +### TASK-002-002: Wire Http3Options through ProtocolCoreBuilder and Http30Engine |
| 54 | +**Description:** As the streams layer, I want Http3Options values passed into Http30Engine so that QPACK table capacity and idle timeout are configurable at runtime. |
| 55 | + |
| 56 | +**Token Estimate:** ~35k tokens |
| 57 | +**Predecessors:** TASK-002-001 |
| 58 | +**Successors:** TASK-002-004 |
| 59 | +**Parallel:** yes — can run alongside TASK-002-003 |
| 60 | + |
| 61 | +**Acceptance Criteria:** |
| 62 | +- [ ] `ProtocolCoreBuilder.Build()` extracts `clientOptions.Http3.QpackMaxTableCapacity` and `clientOptions.Http3.IdleTimeout` |
| 63 | +- [ ] `Http30Engine` constructor signature updated: `Http30Engine(int maxTableCapacity, TimeSpan idleTimeout)` |
| 64 | +- [ ] `Http30Engine` passes `idleTimeout` to `Http30ConnectionStage` constructor |
| 65 | +- [ ] `ProtocolCoreBuilder` line `new Http30Engine()` changed to `new Http30Engine(clientOptions.Http3.QpackMaxTableCapacity, clientOptions.Http3.IdleTimeout)` |
| 66 | +- [ ] Default parameterless `Http30Engine()` constructor preserved for backward compatibility (delegates to new constructor with defaults) |
| 67 | +- [ ] All existing tests still pass unchanged |
| 68 | +- [ ] Typecheck passes |
| 69 | + |
| 70 | +**Files to modify:** |
| 71 | +- `src/TurboHTTP/Streams/ProtocolCoreBuilder.cs` (line 63) |
| 72 | +- `src/TurboHTTP/Streams/Http30Engine.cs` (constructor + field) |
| 73 | + |
| 74 | +**Reference files:** |
| 75 | +- `src/TurboHTTP/Streams/Http20Engine.cs` (pattern to follow — takes `initialWindowSize` + `maxConcurrentStreams`) |
| 76 | + |
| 77 | +--- |
| 78 | + |
| 79 | +### TASK-002-003: Decouple HTTP/3 concurrency limits from HTTP/2 |
| 80 | +**Description:** As a library consumer, I want HTTP/3 to use its own connection and concurrency limits so that tuning HTTP/2 doesn't inadvertently affect HTTP/3 behavior. |
| 81 | + |
| 82 | +**Token Estimate:** ~30k tokens |
| 83 | +**Predecessors:** TASK-002-001 |
| 84 | +**Successors:** TASK-002-004 |
| 85 | +**Parallel:** yes — can run alongside TASK-002-002 |
| 86 | + |
| 87 | +**Acceptance Criteria:** |
| 88 | +- [ ] `ProtocolCoreBuilder.Build()` extracts `maxConnsH3` from `clientOptions.Http3.MaxConnectionsPerServer` |
| 89 | +- [ ] `MaxSubstreamsPerKey()` has separate branch: `endpoint.Version.Major == 3 ? maxConnsH3` |
| 90 | +- [ ] `MaxConcurrencyPerSlot()` has separate branch: `endpoint.Version.Major == 3 ? int.MaxValue` (QUIC handles stream limits at transport level) |
| 91 | +- [ ] Existing `Major >= 2` changed to `Major == 2` for HTTP/2-only path |
| 92 | +- [ ] Unit test: H2 endpoint uses H2 limits, H3 endpoint uses H3 limits |
| 93 | +- [ ] All existing tests still pass |
| 94 | +- [ ] Typecheck passes |
| 95 | + |
| 96 | +**Files to modify:** |
| 97 | +- `src/TurboHTTP/Streams/ProtocolCoreBuilder.cs` (lines 28-50) |
| 98 | + |
| 99 | +--- |
| 100 | + |
| 101 | +### TASK-002-004: Update ARCHITECTURE.md Implementation Status |
| 102 | +**Description:** As a maintainer, I want ARCHITECTURE.md to reflect the current HTTP/3 configuration state so that the documentation stays accurate. |
| 103 | + |
| 104 | +**Token Estimate:** ~10k tokens |
| 105 | +**Predecessors:** TASK-002-002, TASK-002-003 |
| 106 | +**Successors:** none |
| 107 | +**Parallel:** no |
| 108 | +**Model:** haiku |
| 109 | + |
| 110 | +**Acceptance Criteria:** |
| 111 | +- [ ] ARCHITECTURE.md "Implementation Status" table: HTTP/3 score updated (was 75/100) |
| 112 | +- [ ] "Open gaps" list: remove "QUIC transport" if now wired, update QPACK status |
| 113 | +- [ ] `TurboClientOptions` description mentions `Http3Options` alongside `Http2Options` |
| 114 | + |
| 115 | +**Files to modify:** |
| 116 | +- `ARCHITECTURE.md` (lines 318-331) |
| 117 | + |
| 118 | +## Task Dependency Graph |
| 119 | + |
| 120 | +``` |
| 121 | +TASK-002-001 ──→ TASK-002-002 ──→ TASK-002-004 |
| 122 | + └──→ TASK-002-003 ──┘ |
| 123 | +``` |
| 124 | + |
| 125 | +| Task | Estimate | Predecessors | Parallel | Model | |
| 126 | +|------|----------|--------------|----------|-------| |
| 127 | +| TASK-002-001 | ~25k | none | — | — | |
| 128 | +| TASK-002-002 | ~35k | 001 | yes (with 003) | — | |
| 129 | +| TASK-002-003 | ~30k | 001 | yes (with 002) | — | |
| 130 | +| TASK-002-004 | ~10k | 002, 003 | no | haiku | |
| 131 | + |
| 132 | +**Total estimated tokens:** ~100k |
| 133 | + |
| 134 | +## Functional Requirements |
| 135 | + |
| 136 | +- FR-1: `Http3Options` must expose `MaxConnectionsPerServer`, `QpackMaxTableCapacity`, `QpackBlockedStreams`, `MaxFieldSectionSize`, `IdleTimeout`, `MaxReconnectAttempts` with sensible defaults |
| 137 | +- FR-2: `ProtocolCoreBuilder` must pass `Http3Options` values to `Http30Engine` construction |
| 138 | +- FR-3: HTTP/3 endpoint substreams must use `Http3Options.MaxConnectionsPerServer` (not HTTP/2's value) |
| 139 | +- FR-4: HTTP/3 concurrency per slot must be independent of `Http2Options.MaxConcurrentStreams` |
| 140 | + |
| 141 | +## Non-Goals |
| 142 | + |
| 143 | +- No reconnection logic implementation (Feature 003) |
| 144 | +- No StateMachine extraction (Feature 003) |
| 145 | +- No new test files beyond unit tests for options/builder (Feature 004) |
| 146 | +- No changes to QUIC transport layer |
| 147 | + |
| 148 | +## Technical Considerations |
| 149 | + |
| 150 | +- `Http30ConnectionStage` already accepts `idleTimeout` in constructor — just needs wiring from options |
| 151 | +- `Http30Engine` already accepts `maxTableCapacity` — just needs the second parameter added |
| 152 | +- `ProtocolCoreBuilder` change from `>= 2` to `== 2` is a semantic fix, not just a refactor — test thoroughly |
| 153 | + |
| 154 | +## Success Metrics |
| 155 | + |
| 156 | +- All 6 `Http3Options` properties are configurable and flow through to the engine/stage |
| 157 | +- HTTP/3 and HTTP/2 connection limits are fully independent |
| 158 | +- Zero regressions in existing test suites |
| 159 | + |
| 160 | +## Open Questions |
| 161 | + |
| 162 | +None — all questions resolved. |
0 commit comments