Skip to content

feat(http): rebuild bounded HTTP/1.1 authority on current main - #37

Open
seonghobae wants to merge 230 commits into
mainfrom
feat/http11-semantics-main
Open

feat(http): rebuild bounded HTTP/1.1 authority on current main#37
seonghobae wants to merge 230 commits into
mainfrom
feat/http11-semantics-main

Conversation

@seonghobae

@seonghobae seonghobae commented Aug 9, 2026

Copy link
Copy Markdown
Contributor

Purpose

Canonical non-destructive reconstruction of issue #9 / historical PR #11: one bounded reusable originweave-http HTTP/1.1 authority over an existing authenticated TLS stream, with strict framing, resource budgets, integrity/MIME/disposition evidence, realistic loopback tests, ADRs, and repository quality contracts.

Current protected-base topology

Protected base is main@87c4daa1830bac5a5228b6036752ad5633232085 (#286). Current exact head is 1e2f41072854edcdbaf0f9ecf14697a3bfd62195, open, Ready, mergeable, and directly based on current protected main. This branch contains no scheduled-writer .github/**, ruleset, secret, provider/model, tag, release, or publication mutation.

Content-Length persistence repair

RFC 9112 §§6.2–6.3 make a valid Content-Length self-delimiting for the current HTTP/1.1 message: closure/timeout makes the response incomplete only when it occurs before the declared octet count. The realistic TLS regression persistent_content_length.rs returns Content-Length: 5, exactly hello, then keeps TLS open for 350 ms while the exchange deadline is 100 ms. Test-only f70a81d8da15ab418c7c667db9c727dd089bd472 exposed the prior post-length sentinel wait. Minimal production repair b21bfd6b7b766df31dc1e43733a183249fc6230d removes only that sentinel read. Fewer-than-declared bytes, already-buffered surplus, Transfer-Encoding/Content-Length ambiguity, bounded content decoding, and no-content semantic checks remain fail closed.

The older segmented-surplus test had depended on the removed sentinel after the current response was already complete. 5f339088c652e51b630d05f2a352c983d9e5fb32 retains the realistic delayed-byte TLS scenario but asserts the RFC-correct current-message result and then disposes the single-use connection; OriginWeave does not pool, cache, forward, or parse the delayed byte as another response.

docs/doctoring/http-content-length-persistence.md records the RFC decision and evidence boundary. 6e2c7b9d26a38341247c141354f44e15f96d99e8 established the changelog documentation RED, 28721edcc67bb5379ffb11a259d746396ac7ae03 added the Unreleased record, and current 1e2f41072854edcdbaf0f9ecf14697a3bfd62195 is the formatting-only repair. All currently returned inline review threads are resolved.

Exact-current hosted evidence

The formerly queued exact-current repository lanes are now terminal on the unchanged head:

  • CI 33946243438: success;
  • Security Scan 33946243410: success;
  • SAST Semgrep 33946243423: success;
  • CodeQL PR 33946243437: failure.

The CodeQL failure is the organization central-dispatch/verdict control-plane pattern rather than an observed HTTP source finding. Detect-languages job 101252742547 succeeded. Actions 101285593221, python 101285593227, and javascript-typescript 101285593246 each successfully completed Request current-head CodeQL scan dispatch and then failed at Release runner or enforce current-head CodeQL verdict. This recurrence, together with #50 and #229, is handed to canonical organization issue ContextualWisdomLab/.github#712 in comment 5555411125. Keep the repository leaf fail-closed; do not duplicate central scanning or blind-rerun the unchanged head.

Exact-current eligible independent approval and live ruleset satisfaction remain separate. No predecessor, queued, skipped, absent, model-only, author-only, or status-only evidence is promoted to passing acceptance.

Authority boundary

This PR owns bounded HTTP/1.1 semantics over an already authenticated TLS stream; it does not own destination authorization, DNS freshness, TLS authentication, browser control, workflow control, or release authority. Keep Ready but unmerged until the central required verdict and live review/ruleset gates are satisfied. No self-approval, bypass, force-push, destructive rebase, workflow/ruleset/secret mutation, tag, release, or publication is authorized. Issue #9 remains open until this canonical HTTP authority reaches protected main through normal governance.

@coderabbitai

coderabbitai Bot commented Aug 9, 2026

Copy link
Copy Markdown

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

Changes

Bounded HTTP/1.1 교환

Layer / File(s) Summary
정책 및 요청 계약
Cargo.toml, crates/originweave-http/Cargo.toml, crates/originweave-http/src/{error,policy,request,target,field}.rs
워크스페이스에 originweave-http를 추가했습니다. 요청 대상, 필드, 메서드, 정책 제한 및 구조화된 HttpError를 구현했습니다.
응답 파싱 및 본문 디코딩
crates/originweave-http/src/{response_head,framing,chunked,content}.rs
엄격한 HTTP 응답 헤드와 본문 framing을 추가했습니다. chunked/trailer 파싱과 identity·gzip·deflate 디코딩에 제한을 적용했습니다.
무결성 및 응답 메타데이터
crates/originweave-http/src/{integrity,mime,disposition}.rs
SHA-256·SHA-512 digest 검증, MIME 분류, 안전한 파일명 검증 및 redirect 메타데이터 처리를 추가했습니다.
TLS 교환 오케스트레이션
crates/originweave-http/src/{exchange,evidence,lib}.rs
인증된 TLS 연결에서 단일 HTTP/1.1 교환을 실행하고, deadline·ALPN·framing·디코딩·메타데이터와 불변 증거를 처리했습니다.
통합 검증 및 거버넌스
crates/originweave-http/src/tests/*, crates/originweave-http/tests/*, tests/*, docs/adr/*, docs/doctoring/*, docs/superpowers/*
계약 테스트, loopback TLS 통합 테스트, 회귀 테스트, ADR, 설계 문서 및 저장소 거버넌스 검사를 추가했습니다.

Estimated code review effort: 5 (Critical) | ~120 minutes

Possibly related PRs

  • ContextualWisdomLab/OriginWeave#5: HttpExchangePlan이 인증된 TLS 연결과 TCP 연결 모델의 전송·피어 증거를 사용하므로 관련성이 있습니다.
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Linked Issues check ⚠️ Warning #9의 핵심 구현과 테스트는 포함되지만, Mermaid 흐름도와 정확한 100% 프로덕션 커버리지 근거는 변경 요약에서 확인되지 않습니다. #9의 Mermaid 아키텍처 흐름도를 추가하고, 프로덕션 코드 100% 커버리지를 입증하는 설정과 검증 근거를 포함하세요.
✅ Passed checks (4 passed)
Check name Status Explanation
Out of Scope Changes check ✅ Passed 변경 사항은 HTTP 구현, 테스트, 관련 문서, 거버넌스 및 CI 개선으로 PR 목표와 #9의 범위에 있습니다.
Docstring Coverage ✅ Passed Docstring coverage is 80.73% which is sufficient. The required threshold is 80.00%.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed 제목은 현재 main 기준 bounded HTTP/1.1 구현을 재구축한다는 주요 변경 사항을 정확히 요약합니다. 간결하고 변경 범위와 목적이 명확합니다.
  • Fix all pre-merge checks with AI
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/http11-semantics-main

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@seonghobae seonghobae changed the title feat(http): rebuild HTTP/1.1 authority on current main feat(http): rebuild bounded HTTP/1.1 authority on current main Aug 9, 2026
@seonghobae
seonghobae marked this pull request as ready for review August 9, 2026 18:14
Commit-Message-Assisted-by: Claude (via Claude Code)
Signed-off-by: Seongho Bae <me@seonghobae.me>
@seonghobae

Copy link
Copy Markdown
Contributor Author

Exact-head repair and verification for 357fa97dc3cd4a3afff78c29151392b50be6f50a: RFC 9110 §15.3.6 says a 205 Reset Content response cannot generate content. The prior framing table treated 205 as an ordinary Content-Length/chunked/close-delimited response, so a GET could expose bytes that status semantics forbid. A focused RED reproduced ContentLength(999) instead of NoContent; the minimal fix adds 205 to the existing no-content status set, with doctoring and changelog updates. Fresh local verification passed 165 Python repository tests, rustfmt, all workspace/all-target Rust tests (including 144 originweave-http unit tests and integration tests), strict Clippy, rustdoc with warnings denied, and exact 100% production function/line/region/branch coverage. Hosted exact-head checks are queued and REVIEW_REQUIRED remains, so no merge is claimed.

@seonghobae seonghobae left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Exact-head framing finding on 357fa97dc3cd4a3afff78c29151392b50be6f50a: the new 205 repair currently conflates representation/content semantics with HTTP/1.1 message-body framing.

RFC 9110 §15.3.6 says a server MUST NOT generate content in a 205 response. However RFC 9112 §6.3's framing precedence lists only HEAD, 1xx, 204, and 304 as responses terminated at the header boundary regardless of framing fields; 205 is not in that exception. For 205, Transfer-Encoding / Content-Length / close-delimiting still determine the HTTP/1.1 message-body boundary, after which the semantic rule can reject any non-empty content.

Current determine_body_framing() instead places 205 beside 204/304 and returns BodyFraming::NoContent before applying a valid Content-Length/Transfer-Encoding framing result. read_network_response() then checks only body_prefix and returns success immediately without another read. A malicious/non-conforming peer can therefore send 205 + Content-Length: 1, flush the headers, delay one byte, and have OriginWeave return a successful zero-content response before the prohibited byte arrives. Because evidence then records NoContent, this is an evidence-integrity defect even though the connection object is single-use.

Please make the next step a realistic TLS loopback RED: send HTTP/1.1 205 Reset Content\r\nContent-Length: 1...\r\n\r\n, flush only the head, delay, then send one byte. The exact current implementation should demonstrate the premature-success failure before production repair. Minimal causal direction: keep RFC 9112 wire framing separate from a 205 forbids content semantic invariant; read the declared/chunked/close-delimited message correctly, then reject non-empty 205 content rather than treating 205 as the same framing class as 204/304. Also correct docs/doctoring/http11-security-evidence.md, whose current statement that 205 status semantics determine no wire content ahead of RFC 9112 framing is not accurate for HTTP/1.1.

Do not weaken the existing HEAD/1xx/204/304 framing protections or surplus-byte fail-closed behavior. Current hosted checks are non-terminal, so this is a repair finding, not a request to close the valid HTTP delta.

Read Reset Content responses according to HTTP/1.1 wire framing, then reject non-empty content so segmented payloads cannot produce premature success.

Commit-Message-Assisted-by: Claude (via Claude Code)
Signed-off-by: Seongho Bae <me@seonghobae.me>
@seonghobae

Copy link
Copy Markdown
Contributor Author

현재 head dbff45d26291a9a1482494b46790ae9e433e669d에서 205 framing 결함을 test-first로 수정했습니다. 실제 TLS loopback 서버가 Content-Length: 1 헤더를 flush한 뒤 본문 1바이트를 지연 전송하는 테스트는 이전 head에서 조기 성공으로 RED였고, 현재 head는 RFC 9112 wire framing으로 본문을 끝까지 읽은 뒤 RFC 9110의 205 non-empty content 금지를 UnexpectedResponseBytes로 적용합니다. Content-Length: 0 성공 경계도 고정했습니다. Python 165개, fmt, workspace all-target tests, Clippy -D warnings, rustdoc -D warnings, exact function/line/region/branch 100%, diff check 모두 통과했습니다. 새 head의 hosted checks와 eligible approval은 별도 필수입니다.

seonghobae added a commit that referenced this pull request Sep 5, 2026
Bind the live gap baseline to PR #269's fixed observation primitive and repair stale exact-head inventory assertions for the already-recorded #37 and #288 updates.\n\nCommit-Message-Assisted-by: Claude (via Claude Code)

Signed-off-by: Seongho Bae <me@seonghobae.me>
Add a realistic TLS loopback regression proving a complete Content-Length response finishes without waiting for HTTP/1.1 transport closure.

Signed-off-by: Seongho Bae <me@seonghobae.me>
@seonghobae
seonghobae marked this pull request as draft September 5, 2026 02:04
@seonghobae
seonghobae marked this pull request as ready for review September 5, 2026 02:04
Record the RFC 9112 framing and persistence evidence behind the realistic keep-alive regression so the Ready synchronize generation receives repository-native verification.

Signed-off-by: Seongho Bae <me@seonghobae.me>

@seonghobae seonghobae left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Exact-head review for e645df91f1f591f462a8ec09e2f4d57b5fb0def9: valid framing finding remains open. RFC 9112 §6.2/§6.3 makes a valid Content-Length the response-message boundary; §9.3 permits the transport to remain persistent after a self-delimited message. Current read_exact_content() still performs an extra terminator read after receiving the declared octets, so a normal persistent response can time out after it is already complete. The new TLS loopback regression holds the connection open beyond the HTTP deadline to exercise that exact behavior. First test commit ran under Draft and native Rust/coverage jobs were skipped; this Ready synchronize generation has fresh CI/Security/Semgrep/CodeQL queued. Do not repair production or claim RED/GREEN until repository-native execution is terminal. Minimal eventual fix: return after exact Content-Length bytes, retain incomplete-body and already-buffered surplus rejection, never reinterpret trailing bytes as a second response.

@seonghobae seonghobae left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Exact-head review for fa34a696e4ed9b2529a65a7d6a45ac8b72ecefb3: the Content-Length persistence repair is source-minimal and preserves the reviewed framing/security boundaries. read_exact_content() no longer waits for TLS EOF after the exact declared octet count; incomplete bodies and already-buffered surplus still fail closed, and 205 semantic rejection remains downstream of ordinary wire framing. The realistic TLS keep-alive regression remains the causal acceptance test. No GREEN is claimed until repository-native CI/coverage/security materialize and finish on this unchanged head. CHANGELOG.md still needs a narrow Unreleased persistence note before documentation completion.

seonghobae added a commit that referenced this pull request Sep 5, 2026
Advance the live Ready-root evidence to PR #37 exact head fa34a69 and preserve the Content-Length message-boundary contract in the executable baseline.

Commit-Message-Assisted-by: Claude (via Claude Code)
Signed-off-by: Seongho Bae <me@seonghobae.me>

@seonghobae seonghobae left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Exact-head review for 5f339088c652e51b630d05f2a352c983d9e5fb32: the stale segmented-surplus contract has been reconciled with the same RFC 9112 self-delimiting message boundary as the production repair. The realistic TLS server still sends Content-Length: 1, the exact x body, delays, and attempts a later y; the client must complete the single-use response at the declared boundary and must never reinterpret later bytes as current content or a second response. This does not weaken already-buffered surplus rejection or incomplete-body handling. Current exact CI/security runs are non-terminal, so no GREEN is claimed. CHANGELOG.md still needs the narrow Unreleased persistence note.

@seonghobae seonghobae left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Exact-head review for 28721edcc67bb5379ffb11a259d746396ac7ae03: the missing Content-Length persistence release-note boundary is now guarded test-first by tests/test_http_content_length_persistence_documentation_contract.py and recorded under Unreleased. The contract remains tied to RFC 9112 §§6.2/6.3 and the existing real TLS regression (100 ms HTTP deadline, 350 ms peer hold, BodyFraming::ContentLength(5)). This documentation generation does not change HTTP runtime semantics or authority. Fresh CI 33940886121, Security 33940886172, Semgrep 33940886124, and CodeQL 33940886119 are non-terminal, so no GREEN/merge claim transfers from predecessor heads.

Commit-Message-Assisted-by: Claude (via Claude Code)
Signed-off-by: Seongho Bae <me@seonghobae.me>
@seonghobae

Copy link
Copy Markdown
Contributor Author

Exact-head repair and verification: 1e2f4107b25b8e2fe3f311b47bf51331c3da87ae.

The current head reproduced a Rust 1.97.1 cargo fmt --check failure in content_length_segmented_surplus.rs; the only source delta is canonical formatting. On the repaired exact head, formatting, locked workspace check/test, strict Clippy, rustdoc, 167 Python repository contracts, and pinned-nightly function/line/region/branch coverage all pass at 100%.

Hosted exact-head checks and an eligible approval remain required; this is not merge authorization.

@seonghobae seonghobae left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Exact-head review for 1e2f41072854edcdbaf0f9ecf14697a3bfd62195: the delta from 28721ed... is formatting-only in content_length_segmented_surplus.rs; it does not alter HTTP framing, timeout, policy, browser authority, or workflow semantics. The Content-Length persistence acceptance remains exact declared-byte completion without transport-EOF dependence, while short bodies and already-buffered surplus remain fail closed. Current CI/Security/Semgrep/CodeQL are non-terminal, so predecessor evidence does not transfer and no GREEN/approval claim is made.

@opencode-agent

opencode-agent Bot commented Sep 6, 2026

Copy link
Copy Markdown
Contributor

Scheduled review-feedback autofix for this PR head.

  • Head SHA: 1e2f41072854edcdbaf0f9ecf14697a3bfd62195

@opencode-agent

opencode-agent Bot commented Sep 7, 2026

Copy link
Copy Markdown
Contributor

Scheduled review-feedback autofix for this PR head.

  • Head SHA: 1e2f41072854edcdbaf0f9ecf14697a3bfd62195

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant