feat: raw-request passthrough for webhook HMAC verification (COD-402) - #1
Conversation
Opt-in `raw_request: true` operation flag: the generated HTTP handler receives exact raw body bytes + a headers map instead of typed extraction, so consumers can verify signatures (webhook HMAC) over the wire representation while keeping handlers generated. - hydra-core: field + validation (http-only surface, unary, no body params) - hydra-codegen: GeneratedRawOperationInput, HeaderMap/Bytes handlers, http_raw_dispatch_fn config knob, conditional imports - examples/notes: echo_raw dogfood op + live byte-exactness test - tests: pinned pre-feature fixture proves default output byte-identical; iris + rite round-trips verified byte-identical
- Document header-map contract (lowercased names, non-UTF-8 values dropped, repeated headers last-wins) on the field, the generated struct, and README - Fix misleading header-casing comment in surfaces test - Add raw-request section + http_raw_dispatch_fn knob to README - Drop unused AppState/tokio from the structural absence test
🤖 Automated Review PanelDual-model review ran before the PR was opened. Both reviewers independently ran the test suite and verified the byte-identity fixture provenance against v0.1.0. Verdicts: CLEAN / CLEAN — no blockers or majors. All minor/nit findings addressed in e4c3ed1. Reviewer AVerdict: CLEAN Goal alignment: Yes. Rite's webhook can now be generated: Correctness findings:
Non-issues verified: extractor ordering correct ( Convention violations: None. Reviewer BVerdict: CLEAN Goal alignment: Correctness findings:
Convention violations: None. The Runner: archon · Issue: COD-402 · Branch: runner/cod-402-raw-request-passthrough |
Auto-Merge Gate — SKIP (policy) 2026-08-19Skipped by the gate, not on quality:
Ready for your review/merge. COD-402 is In Review and assigned to you. Rite's migration to a generated webhook handler remains follow-up work in the rite project. |
Auto-Merge Gate — Approval (2026-08-19)Confidence: 0.92 — MERGE (squash) PR goal (COD-402): opt-in Checks observed: CI Why it satisfies COD-402:
Review panel: dual-model, both CLEAN; all minors addressed in Policy check: repo Scope limits: 12 files +730/−22, purely additive feature flag in hydra-core/hydra-codegen + example + README. No secrets, no deployment, no destructive behavior, same-repo branch (owner TechGodHQ, author shivros). Self-authored PR — formal self-approval rejected by GitHub; this comment is the approval rationale and audit artifact. |
Summary
Opt-in
raw_request: trueoperation flag for hydra's HTTP surface (COD-402): the generated handler receives the exact raw body bytes + a header map instead of typed extraction, so consumers can verify signatures (webhook HMAC) over the wire representation while keeping handlers generated. This removes the last sanctioned handwritten-surface pattern — rite's GitHub webhook handler is the reference use case.Closes COD-402.
Design
raw_request: boolfield (#[serde(default)], opt-in — no name-based inference). Validation: raw ops must list exactlysurfaces: [http], stay unary (no SSE), and declare no body-location parameters.GeneratedRawOperationInput { path, query, headers, raw_body: Vec<u8> }and handlers shapedState → Path?/Query? → HeaderMap → Bytes(Bytes last — sole body-consuming extractor). New config knobhttp_raw_dispatch_fn(defaultsuper::execute_generated_raw_operation) keeps the raw lane separate from the existing dispatch.X-Hub-Signature-256) are ASCII single-valued — unaffected.Verification
cargo build/clippy -D warnings/test/fmt— all green; 19 codegen + 7 surfaces tests (5 new codegen tests, 2 new live surface tests).raw_request_delivers_exact_wire_bytes_and_headersPOSTs a payload with non-UTF-8 trailing bytes and asserts the echo matches byte-for-byte.tests/fixtures/notes-pre-raw-*, hash-verified against v0.1.0/f6ef2e6 artifacts); new generator + old definition = byte-identical.generated/artifacts byte-identically (verified via temp-dir diff — empty for all 6 files).Consumer impact (deliberate, minor-version bump)
GenerateConfiggainshttp_raw_dispatch_fn. iris and rite construct exhaustive struct literals, so their next hydra upgrade adds one field. They are tag-pinned to v0.1.0 — unaffected until they opt in. Rite's migration to a generated webhook handler is a separate follow-up in the rite project.Review panel
Dual-model review completed pre-PR; both reviewers returned CLEAN (no blockers/majors). Addressed findings: header-contract docs (field + generated struct + README), fixed a misleading test comment, README knob documentation. Full reviews posted as a PR comment.
Commits
ff6774dfeat: raw-request passthrough for HTTP webhook operations (COD-402)e4c3ed1docs: address review panel findings for raw-request (COD-402)