Skip to content

feat(http-client): add byte-level sendSecure/sendRaw and Crypto sha256/hmacSha256/toHex primitives - #905

Open
stepandra wants to merge 6 commits into
neohaskell:mainfrom
stepandra:s3/pr0-http-client-ext
Open

stepandra wants to merge 6 commits into
neohaskell:mainfrom
stepandra:s3/pr0-http-client-ext

Conversation

@stepandra

@stepandra stepandra commented Oct 6, 2026 •

Copy link
Copy Markdown
Contributor

NeoHaskell integrations can send raw bytes with PUT, HEAD, DELETE, POST and PATCH, and read status codes and headers without treating every non-2xx response as an exception. Existing GET callers keep their behavior. The accompanying SHA-256, HMAC-SHA256 and hex helpers let protocol clients sign requests through Core instead of importing cryptography internals.

Review follow-up

  • Change 016 classifies the six Warp-backed HTTP examples as integration / http:real, with exact selectors and fixture names in test-surfaces.json. Pure method/URL checks remain unit / none. The refused-connection example stays unit / none: no server fixture answers it.
  • CI now captures the Core test report and combines it with the service report before checking integration criteria. Missing reports fail the job. The service job waits for Core; rerun both jobs if the one-day report artifact has expired.
  • Change 021's quoted example names now resolve exactly. Change 016's promised method signatures use the generated signature format.

Verification

Local macOS checks with the pinned toolchain:

  • Full nhcore-test-core: 1109 examples, 0 failures, 3 pending. Includes 37 HTTP and 24 Crypto examples.
  • Exact integration probes and combined-report validation: 6 locators pass. A service-only report and a missing Core report fail as expected.
  • Lint, spec validation, criterion resolution, signature drift, codemap, release fragments, expectation guard and whitespace checks pass.
  • Workflow checks/self-tests pass; actionlint passes with shellcheck disabled. Shellcheck reports four unchanged warnings in existing PostgreSQL startup loops.

These tests use real HTTP over local loopback, not external services. The full PostgreSQL/Hurl suite was not rerun. This remains a draft; this update does not claim final maintainer approval.

Migration: none. Specs: 016, 021. #906 depends on these APIs.

Generalize the existing getSecure/getRaw GET path into one method-agnostic
primitive: raw Bytes body, non-throwing status codes, response headers, same
redirect/proxy/TLS/size defaults. getSecure and getRaw become Get
specializations. Spec: docs/changes/016-http-client-byte-level-methods.md.
@coderabbitai

coderabbitai Bot commented Oct 6, 2026

Copy link
Copy Markdown
Contributor

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true

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.

…ent Http.Client helpers

Protocol code inside nhcore (the S3 signer in change 017, FileUpload's content
hash) needs the raw digest, a chainable HMAC and hex encoding, and today reaches
for crypton/Data.ByteArray and Bytes.unwrap directly. Per the neohaskell#748 review
("add it to the Bytes/Core module instead of unwrapping"), the primitives now
live in Crypto, which already owns that boundary. signWith is re-expressed on
hmacSha256 + toHex (one implementation; output unchanged, pinned by a test).

Known-answer tests: FIPS 180-4 SHA-256 vectors, RFC 4231 HMAC case 2, hex.
Spec: docs/changes/021-crypto-sha256-hmac-hex.md (touches core-primitives).

Also adds the one-line Haddock the doc-ratchet wants on Http.Client's
existing helpers and regenerates codemap: undocumented_exports 560 -> 545,
undocumented_doctest_modules 315 -> 314.

Gates: ./dev check 0; ./dev test Crypto 24/0; ./dev test Http.Client 37/0;
./dev doctest 0 failures; ./dev lint No hints; ./dev codemap-check OK;
./dev spec-check 021 OK; git diff --check 0.
@stepandra stepandra changed the title feat(http-client): add byte-level sendSecure/sendRaw for PUT/HEAD/DELETE feat(http-client): add byte-level sendSecure/sendRaw and Crypto sha256/hmacSha256/toHex primitives Oct 6, 2026
@NickSeagull

Copy link
Copy Markdown
Member

Hey, thanks for this PR! One evidence correction:

  1. Change 016 marks the HTTP examples unit / none, but the PUT test starts Warp and sends a real loopback request. Reclassify the real-HTTP examples as integration / http:real and attest their exact selectors in test-surfaces.json; leave the pure method and URL checks at unit / none. A broken wire path would fail those examples, so the current boundary label is misleading.

Thanks!

…tion

ClientRawSpec's sendRaw and getRaw status examples send real loopback HTTP
to an in-process Warp server, so they are integration / http:real with
exact selector attestations in test-surfaces.json. The scheme check,
methodName and the closed-port network error stay unit / none.

Amp-Thread-ID: https://ampcode.com/threads/T-01a11c53-f9bd-70df-81b8-4369dbfd3e1b
… so 021 selectors resolve

The C1/C2 locators named "abc" and "Jefe" in quotes, but the hspec
source escapes them, so the exact-title selector never matched. Rename the
two example titles and their locators; every assertion is unchanged.

Amp-Thread-ID: https://ampcode.com/threads/T-01a11c53-f9bd-70df-81b8-4369dbfd3e1b
Integration criteria may name nhcore-test-core locators (change 016), but
the --criteria-runtime --report gate in test-service read only the service
report, so every core locator failed report mode. test-core now tees its
direct output to nhcore-test-core.report under pipefail and uploads it
fail-closed; test-service needs test-core, downloads that artifact and
gates on the concatenation of both reports. workflow-check contract 6
freezes the wiring with self-test regressions.

Amp-Thread-ID: https://ampcode.com/threads/T-01a11c53-f9bd-70df-81b8-4369dbfd3e1b
@NickSeagull
NickSeagull marked this pull request as ready for review October 12, 2026 09:52
@NickSeagull
NickSeagull enabled auto-merge (squash) October 12, 2026 09:55

This branch has not been deployed

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants