Skip to content

Commit cf57ff4

Browse files
committed
TASK-053-003: Update Obsidian — Protocol Layer (after Features 047-052)
1 parent 3a5d784 commit cf57ff4

5 files changed

Lines changed: 176 additions & 132 deletions

File tree

.maggus/COMMIT.md

Lines changed: 33 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,33 @@
1-
## TASK-044-001: Migrate TurboHttp.Tests RFC9112 → Http11/
2-
3-
Migrated all 26 HTTP/1.1 unit test files from `TurboHttp.Tests/RFC9112/` to the
4-
component-based `Http11/` structure (Feature 040 convention).
5-
6-
**Encoder specs** (7) → `Http11/Encoder/`
7-
- Http11EncoderRequestLineSpec, Http11EncoderHostHeaderSpec, Http11EncoderHeaderSpec
8-
- Http11EncoderConnectionSpec, Http11EncoderBodySpec, Http11EncoderRangeRequestSpec
9-
- Http11EncoderLegacySpec
10-
11-
**Decoder specs** (7) → `Http11/Decoding/`
12-
- Http11DecoderStatusLineSpec, Http11DecoderHeaderSpec, Http11DecoderHeaderLimitsSpec
13-
- Http11DecoderBodySpec, Http11DecoderNoBodySpec, Http11DecoderFragmentationSpec
14-
- Http11DecoderConnectSpec
15-
16-
**Chunking specs** (3) → `Http11/Chunking/`
17-
- Http11RoundTripChunkedSpec, Http11DecoderChunkTrailerSpec
18-
- Http11DecoderChunkExtensionSpec
19-
20-
**Round-trip / security specs** (9) → `Http11/` (flat)
21-
- Http11RoundTripMethodSpec, Http11RoundTripStatusCodeSpec, Http11RoundTripPipeliningSpec
22-
- Http11RoundTripNoBodySpec, Http11RoundTripBodySpec, Http11RoundTripFragmentationSpec
23-
- Http11NegativePathSpec, Http11SecuritySpec, Http11LegacySpec
24-
25-
**Convention changes per Feature 040:**
26-
- Class names: `Spec` suffix, `sealed`
27-
- Method names: BDD style `Subject_should_behavior_when_condition()`
28-
- RFC traceability: `[Trait("RFC", "RFC9112-X.X")]` replaces `DisplayName` RFC tags
29-
- `[Fact(Timeout = 5000)]` on all async tests
30-
31-
**Namespace fix:** `Http11/Encoding/` renamed to `Http11/Encoder/` to avoid C# namespace
32-
collision between `TurboHttp.Tests.Http11.Encoding` (subfolder) and `System.Text.Encoding`.
33-
34-
**Verified:** 3641 tests, 0 failures.
1+
## TASK-053-003: Update Obsidian — Protocol Layer (after Features 047-052)
2+
3+
Updated three Obsidian vault notes to reflect the component-based Protocol folder
4+
structure introduced by Features 047-052. All RFC-number folder names removed;
5+
component-based names (Http10/, Http11/, Http2/, Http3/, Semantics/, Caching/,
6+
Cookies/) used throughout.
7+
8+
**`notes/Architecture/Layers/16-PROTOCOL_LAYER.md`:**
9+
- Rewrote Component Folder Structure tree: was completely scrambled (e.g. Http11Encoder.cs
10+
listed under Http2/, Http3Encoder.cs under Semantics/); now shows actual filesystem
11+
layout with correct files under each folder
12+
- `HuffmanCodec.cs`, `WellKnownHeaders.cs`, `HttpDecodeResult.cs` shown at Protocol/ root
13+
- `QuicVarInt.cs` shown in `Protocol/Http3/` (not `Http3/Qpack/`)
14+
- Namespace mapping table retained and correct
15+
- Description frontmatter updated: "RFC subfolder structure" → "component folder structure"
16+
17+
**`notes/Architecture/Status/04-CURRENT_STATE_SUMMARY.md`:**
18+
- Protocol Layer Organization tree: added `WellKnownHeaders.cs` at root
19+
- Testing section: "organized by RFC" → "organized by component"
20+
- Build command example: `--filter-namespace "TurboHttp.Tests.RFC9113"`
21+
component-based namespace + `--filter "Trait~RFC9113"` alternative shown
22+
- Development workflow step 3: DisplayName convention → `[Trait("RFC", ...)]`
23+
- Quality gate: DisplayName requirement → `[Trait("RFC", ...)]` for RFC traceability
24+
- Recent Changes section updated to reflect 2026-04 work (Features 040-052)
25+
26+
**`notes/Architecture/00-ONBOARDING.md`:**
27+
- Protocol/ entry in Repository Layout: "RFC subfolders" → "component subfolders"
28+
- Added full component subfolder tree (Http10/, Http11/, Http2/, Http3/, Semantics/,
29+
Caching/, Cookies/) nested under Protocol/ entry
30+
- Removed obsolete `planning/` entry from repo layout
31+
32+
**Verification:** No RFC-number-based folder names remain in the updated notes.
33+
No code, tests, or build configuration changed.

.maggus/features/feature_053.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -143,13 +143,13 @@ Protocol/
143143
| `TurboHttp.Protocol.RFC9204` | `TurboHttp.Protocol.Http3.Qpack` |
144144

145145
**Acceptance Criteria:**
146-
- [ ] No RFC-number folder names appear in `16-PROTOCOL_LAYER.md`
147-
- [ ] No RFC-number folder names appear in `04-CURRENT_STATE_SUMMARY.md`
148-
- [ ] `00-ONBOARDING.md` Protocol layout shows component folder names
149-
- [ ] Namespace mapping table present and correct in `16-PROTOCOL_LAYER.md`
150-
- [ ] `HuffmanCodec.cs` and `WellKnownHeaders.cs` shown at Protocol/ root (not in a subfolder)
151-
- [ ] `QuicVarInt.cs` shown in `Http3/` (not `Http3/Qpack/`)
152-
- [ ] No logic or implementation content changed — structural descriptions only
146+
- [x] No RFC-number folder names appear in `16-PROTOCOL_LAYER.md`
147+
- [x] No RFC-number folder names appear in `04-CURRENT_STATE_SUMMARY.md`
148+
- [x] `00-ONBOARDING.md` Protocol layout shows component folder names
149+
- [x] Namespace mapping table present and correct in `16-PROTOCOL_LAYER.md`
150+
- [x] `HuffmanCodec.cs` and `WellKnownHeaders.cs` shown at Protocol/ root (not in a subfolder)
151+
- [x] `QuicVarInt.cs` shown in `Http3/` (not `Http3/Qpack/`)
152+
- [x] No logic or implementation content changed — structural descriptions only
153153

154154
---
155155

notes/Architecture/00-ONBOARDING.md

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,14 @@ src/
4545
│ ├── Handlers/ # TurboHandler (HttpMessageHandler bridge)
4646
│ ├── Hosting/ # DI registration extensions
4747
│ ├── Streams/ # GraphStages: Encoding/, Decoding/, Features/, Routing/
48-
│ ├── Protocol/ # Encoders/Decoders, HPACK/QPACK, RFC subfolders
48+
│ ├── Protocol/ # Encoders/Decoders, HPACK/QPACK, component subfolders
49+
│ │ ├── Http10/ # HTTP/1.0 (RFC 1945)
50+
│ │ ├── Http11/ # HTTP/1.1 (RFC 9112)
51+
│ │ ├── Http2/ # HTTP/2 + Hpack/ (RFC 9113, RFC 7541)
52+
│ │ ├── Http3/ # HTTP/3 + Qpack/ (RFC 9114, RFC 9204)
53+
│ │ ├── Semantics/ # HTTP semantics: redirect, retry, compression (RFC 9110)
54+
│ │ ├── Caching/ # HTTP caching (RFC 9111)
55+
│ │ └── Cookies/ # Cookie management (RFC 6265)
4956
│ └── Transport/ # Actor-free connection pool, Channels
5057
│ ├── Connection/ # ConnectionPool, ConnectionLease, IConnectionScope, ConnectionStage
5158
│ ├── Tcp/ # TcpTransportHandler, ClientState, ClientByteMover
@@ -56,7 +63,6 @@ src/
5663
└── TurboHttp.sln # Solution file
5764
notes/ # This vault — single source of truth for non-code knowledge
5865
docs/ # VitePress documentation site
59-
planning/ # Feature plans, release notes, memory
6066
```
6167

6268
## Build Commands

notes/Architecture/Layers/16-PROTOCOL_LAYER.md

Lines changed: 95 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
---
22
title: Protocol Layer Architecture
33
description: >-
4-
Encoder/decoder patterns, HPACK/QPACK internals, RFC subfolder structure, and
5-
wire-format handling for HTTP/1.x, HTTP/2, and HTTP/3
4+
Encoder/decoder patterns, HPACK/QPACK internals, component folder structure,
5+
and wire-format handling for HTTP/1.x, HTTP/2, and HTTP/3
66
tags:
77
- architecture
88
- protocol
@@ -15,7 +15,7 @@ tags:
1515

1616
## Purpose
1717

18-
The Protocol layer (`src/TurboHttp/Protocol/`) implements wire-format encoding and decoding for all supported HTTP versions. Each RFC gets its own subfolder containing encoders, decoders, and version-specific business logic. Shared compression codecs (HPACK, QPACK, Huffman) live in dedicated RFC subfolders and are consumed by multiple protocol versions.
18+
The Protocol layer (`src/TurboHttp/Protocol/`) implements wire-format encoding and decoding for all supported HTTP versions. Each HTTP version and cross-cutting concern gets its own component subfolder containing encoders, decoders, and version-specific business logic. Shared codecs (HPACK under `Http2/Hpack/`, QPACK under `Http3/Qpack/`, Huffman at the root) are consumed by multiple protocol versions.
1919

2020
This layer sits **below** the Streams layer (which orchestrates stage graphs) and **above** the Transport layer (which moves raw bytes). Protocol types convert between `HttpRequestMessage`/`HttpResponseMessage` and the `IOutputItem`/`IInputItem` message protocol used by the pipeline.
2121

@@ -27,24 +27,25 @@ This layer sits **below** the Streams layer (which orchestrates stage graphs) an
2727

2828
| Component | Path | Role |
2929
|-----------|------|------|
30-
| HTTP/1.1 Encoder | `Protocol/RFC9112/Http11Encoder.cs` | Serialises requests to HTTP/1.1 wire format |
31-
| HTTP/1.1 Decoder | `Protocol/RFC9112/Http11Decoder.cs` | Parses HTTP/1.1 responses from byte stream |
32-
| HTTP/1.0 Encoder | `Protocol/RFC9112/Http10Encoder.cs` | HTTP/1.0 request serialisation (no chunked) |
33-
| HTTP/1.0 Decoder | `Protocol/RFC9112/Http10Decoder.cs` | HTTP/1.0 response parsing (Content-Length only) |
34-
| HTTP/2 Encoder | `Protocol/RFC9113/Http2Encoder.cs` | Frames requests into HTTP/2 binary format |
35-
| HTTP/2 Decoder | `Protocol/RFC9113/Http2Decoder.cs` | Parses HTTP/2 frames into response events |
36-
| HTTP/2 Settings | `Protocol/RFC9113/Http2Settings.cs` | SETTINGS frame parameter handling |
37-
| HTTP/2 Flow Control | `Protocol/RFC9113/Http2FlowControl.cs` | Window update tracking per stream/connection |
38-
| HTTP/3 Encoder | `Protocol/RFC9114/Http3Encoder.cs` | QUIC-based HTTP/3 frame encoding |
39-
| HTTP/3 Decoder | `Protocol/RFC9114/Http3Decoder.cs` | HTTP/3 frame parsing from QUIC streams |
40-
| HPACK Encoder | `Protocol/RFC7541/HpackEncoder.cs` | HTTP/2 header compression (RFC 7541) |
41-
| HPACK Decoder | `Protocol/RFC7541/HpackDecoder.cs` | HTTP/2 header decompression |
42-
| QPACK Encoder | `Protocol/RFC9204/QpackEncoder.cs` | HTTP/3 header compression (RFC 9204) |
43-
| QPACK Decoder | `Protocol/RFC9204/QpackDecoder.cs` | HTTP/3 header decompression |
44-
| Huffman Codec | `Protocol/RFC7541/HuffmanCodec.cs` | Shared Huffman encoding/decoding for HPACK/QPACK |
45-
| Dynamic Table | `Protocol/RFC7541/DynamicTable.cs` | HPACK dynamic header table |
46-
| Static Table | `Protocol/RFC7541/StaticTable.cs` | HPACK static header table (61 entries) |
47-
| Decode Result | `Protocol/Shared/HttpDecodeResult.cs` | Discriminated union for decoder output states |
30+
| HTTP/1.1 Encoder | `Protocol/Http11/Http11Encoder.cs` | Serialises requests to HTTP/1.1 wire format |
31+
| HTTP/1.1 Decoder | `Protocol/Http11/Http11Decoder.cs` | Parses HTTP/1.1 responses from byte stream |
32+
| HTTP/1.0 Encoder | `Protocol/Http10/Http10Encoder.cs` | HTTP/1.0 request serialisation (no chunked) |
33+
| HTTP/1.0 Decoder | `Protocol/Http10/Http10Decoder.cs` | HTTP/1.0 response parsing (Content-Length only) |
34+
| HTTP/2 Request Encoder | `Protocol/Http2/Http2RequestEncoder.cs` | Frames requests into HTTP/2 binary format |
35+
| HTTP/2 Frame Decoder | `Protocol/Http2/Http2FrameDecoder.cs` | Parses HTTP/2 frames into response events |
36+
| HTTP/3 Request Encoder | `Protocol/Http3/Http3RequestEncoder.cs` | QUIC-based HTTP/3 request encoding |
37+
| HTTP/3 Response Decoder | `Protocol/Http3/Http3ResponseDecoder.cs` | HTTP/3 response parsing from QUIC streams |
38+
| HTTP/3 Frame Encoder | `Protocol/Http3/Http3FrameEncoder.cs` | Low-level HTTP/3 frame serialisation |
39+
| HTTP/3 Frame Decoder | `Protocol/Http3/Http3FrameDecoder.cs` | Low-level HTTP/3 frame parsing |
40+
| QUIC Variable-Length Int | `Protocol/Http3/QuicVarInt.cs` | QUIC variable-length integer codec |
41+
| HPACK Encoder | `Protocol/Http2/Hpack/HpackEncoder.cs` | HTTP/2 header compression (RFC 7541) |
42+
| HPACK Decoder | `Protocol/Http2/Hpack/HpackDecoder.cs` | HTTP/2 header decompression |
43+
| QPACK Encoder | `Protocol/Http3/Qpack/QpackEncoder.cs` | HTTP/3 header compression (RFC 9204) |
44+
| QPACK Decoder | `Protocol/Http3/Qpack/QpackDecoder.cs` | HTTP/3 header decompression |
45+
| Huffman Codec | `Protocol/HuffmanCodec.cs` | Shared Huffman encoding/decoding for HPACK/QPACK |
46+
| Well-Known Headers | `Protocol/WellKnownHeaders.cs` | Shared header name constants across all versions |
47+
| Decode Result | `Protocol/HttpDecodeResult.cs` | Discriminated union for decoder output states |
48+
| Http Decoder Error | `Protocol/HttpDecoderException.cs` | Decoder exception carrying `HttpDecodeError` enum |
4849

4950
---
5051

@@ -179,51 +180,95 @@ HPACK relies on TCP ordering — encoder and decoder see frames in the same orde
179180

180181
---
181182

182-
## RFC Subfolder Structure
183+
## Component Folder Structure
183184

184185
```text
185186
src/TurboHttp/Protocol/
186-
├── RFC7541/ # HPACK (HTTP/2 header compression)
187-
│ ├── HpackEncoder.cs
188-
│ ├── HpackDecoder.cs
189-
│ ├── DynamicTable.cs
190-
│ ├── StaticTable.cs
191-
│ └── HuffmanCodec.cs
192-
├── RFC9110/ # HTTP Semantics (shared across versions)
193-
│ └── (status codes, method handling, content negotiation)
194-
├── RFC9112/ # HTTP/1.1 Message Syntax and Routing
195-
│ ├── Http11Encoder.cs
196-
│ ├── Http11Decoder.cs
187+
├── HuffmanCodec.cs # Shared — HPACK + QPACK (RFC 7541 Appendix B)
188+
├── WellKnownHeaders.cs # Shared header name constants across all versions
189+
├── HttpDecodeResult.cs # Discriminated union: NeedMoreData/HeadersComplete/Complete/Error
190+
├── HttpDecoderException.cs # Decoder exception carrying HttpDecodeError enum
191+
├── HttpDecoderError.cs # Error code enum
192+
├── Http10/ # HTTP/1.0 (RFC 1945)
197193
│ ├── Http10Encoder.cs
198194
│ └── Http10Decoder.cs
199-
├── RFC9113/ # HTTP/2
200-
│ ├── Http2Encoder.cs
201-
│ ├── Http2Decoder.cs
202-
│ ├── Http2Settings.cs
203-
│ └── Http2FlowControl.cs
204-
├── RFC9114/ # HTTP/3
205-
│ ├── Http3Encoder.cs
206-
│ ├── Http3Decoder.cs
207-
│ └── (QUIC stream management)
208-
├── RFC9204/ # QPACK (HTTP/3 header compression)
209-
│ ├── QpackEncoder.cs
210-
│ ├── QpackDecoder.cs
211-
│ └── (encoder/decoder stream handling)
212-
└── Shared/ # Cross-version types
213-
└── HttpDecodeResult.cs
195+
├── Http11/ # HTTP/1.1 (RFC 9112)
196+
│ ├── Http11Encoder.cs
197+
│ ├── Http11Decoder.cs
198+
│ ├── ConnectionReuseDecision.cs
199+
│ └── ConnectionReuseEvaluator.cs
200+
├── Http2/ # HTTP/2 (RFC 9113)
201+
│ ├── Http2RequestEncoder.cs
202+
│ ├── Http2FrameDecoder.cs
203+
│ ├── Http2Frame.cs
204+
│ ├── Http2Exception.cs
205+
│ └── Hpack/ # HPACK header compression (RFC 7541)
206+
│ ├── HpackEncoder.cs
207+
│ ├── HpackDecoder.cs
208+
│ └── HpackException.cs
209+
├── Http3/ # HTTP/3 (RFC 9114)
210+
│ ├── Http3RequestEncoder.cs
211+
│ ├── Http3ResponseDecoder.cs
212+
│ ├── Http3FrameEncoder.cs
213+
│ ├── Http3FrameDecoder.cs
214+
│ ├── Http3Frame.cs
215+
│ ├── Http3Settings.cs
216+
│ ├── Http3Exception.cs
217+
│ ├── Http3ErrorCode.cs
218+
│ ├── Http3StreamType.cs
219+
│ ├── Http3ControlStream.cs
220+
│ ├── Http3UniStream.cs
221+
│ ├── Http3RequestStream.cs
222+
│ ├── QuicVarInt.cs # QUIC variable-length integer codec (RFC 9000 §16)
223+
│ └── Qpack/ # QPACK header compression (RFC 9204)
224+
│ ├── QpackEncoder.cs
225+
│ ├── QpackDecoder.cs
226+
│ ├── QpackDynamicTable.cs
227+
│ ├── QpackStaticTable.cs
228+
│ ├── QpackIntegerCodec.cs
229+
│ ├── QpackStringCodec.cs
230+
│ ├── QpackTableSync.cs
231+
│ └── …
232+
├── Semantics/ # HTTP Semantics (RFC 9110)
233+
│ ├── RedirectPolicy.cs
234+
│ ├── RetryPolicy.cs
235+
│ ├── ContentEncodingEncoder.cs
236+
│ ├── ContentEncodingDecoder.cs
237+
│ └── …
238+
├── Caching/ # HTTP Caching (RFC 9111)
239+
│ ├── CacheStore.cs
240+
│ ├── CacheFreshnessEvaluator.cs
241+
│ └── …
242+
└── Cookies/ # Cookie management (RFC 6265)
243+
├── CookieJar.cs
244+
└── CookieParser.cs
214245
```
215246

247+
### Namespace Mapping
248+
249+
| Component Folder | Namespace | RFC(s) |
250+
|-----------------|-----------|--------|
251+
| `Protocol/Http10/` | `TurboHttp.Protocol.Http10` | RFC 1945 |
252+
| `Protocol/Http11/` | `TurboHttp.Protocol.Http11` | RFC 9112 |
253+
| `Protocol/Http2/` | `TurboHttp.Protocol.Http2` | RFC 9113 |
254+
| `Protocol/Http2/Hpack/` | `TurboHttp.Protocol.Http2.Hpack` | RFC 7541 |
255+
| `Protocol/Http3/` | `TurboHttp.Protocol.Http3` | RFC 9114 |
256+
| `Protocol/Http3/Qpack/` | `TurboHttp.Protocol.Http3.Qpack` | RFC 9204 |
257+
| `Protocol/Semantics/` | `TurboHttp.Protocol.Semantics` | RFC 9110 |
258+
| `Protocol/Caching/` | `TurboHttp.Protocol.Caching` | RFC 9111 |
259+
| `Protocol/Cookies/` | `TurboHttp.Protocol.Cookies` | RFC 6265 |
260+
216261
### Naming Convention
217262

218263
- Encoders: `Http{version}Encoder.cs` — one per wire-format version
219264
- Decoders: `Http{version}Decoder.cs` — paired with encoder
220-
- RFC subfolder name matches the RFC number (e.g., `RFC9113/` for HTTP/2)
265+
- Component subfolder name matches the protocol version (e.g., `Http2/` for HTTP/2, `Semantics/` for cross-cutting concerns)
221266

222267
---
223268

224269
## Design Decisions
225270

226-
1. **RFC-per-folder organisation** — Each RFC gets its own namespace and folder, making compliance tracking straightforward. Cross-cutting concerns (Huffman, shared types) live in the lowest-numbered RFC that defines them.
271+
1. **Component-per-folder organisation** — Each HTTP version and cross-cutting concern gets its own component subfolder, making compliance tracking straightforward. Shared codecs (HPACK under `Http2/Hpack/`, QPACK under `Http3/Qpack/`, Huffman at the root) are nested under their primary consumer.
227272

228273
2. **Stateless encoders, stateful decoders** — Encoders are largely stateless (HPACK/QPACK state is injected). Decoders maintain parsing state machines because responses can arrive incrementally across multiple `IInputItem` deliveries.
229274

0 commit comments

Comments
 (0)