From b8a7b7f760374cab0d0fcf48d1a1827ca75b0e82 Mon Sep 17 00:00:00 2001 From: Elia <83713217+eliahilse@users.noreply.github.com> Date: Thu, 20 Aug 2026 19:41:56 +0200 Subject: [PATCH] =?UTF-8?q?feat:=20publish=20groundwork=20=E2=80=94=20docs?= =?UTF-8?q?,=20package=20metadata,=20decoder=20fuzzing?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Everything needed before `npm publish` except the publish itself. Docs. packages/hyperfly had no README, so the npm page would have shipped blank; it now covers the two-line usage, plans and profiles, serving over the negotiation protocol, and the benchmark table with its caveats. Python and Rust get equivalent front doors, the root README stops claiming nothing is benchmarked, and the site's dead "docs — soon" button points at the README. Packaging. Verified by building the tarball and installing it into a scratch project as a consumer: all three entry points resolve, encode and decode round trip, training works, and the HTTP layer negotiates — the check that usually catches a broken exports map. prepublishOnly now runs lint, types, tests and a fresh build, so a stale or failing build cannot be published. Added keywords, homepage, bugs, and provenance. Fuzzing. The decoder is the one component that eats bytes from the network, and it had property tests for valid input but nothing for hostile input. The new suite throws roughly thirty-four thousand inputs at it across both plans — random bytes, bit-mutations of valid output, truncation at every offset, arbitrary dictionary codes, hostile envelopes — and requires that every one either raises a typed HyperflyError or normalizes to a stable fixed point. Its first run failed, and the implementation was right: a mutated input decoded to values where delta and raw modes tie on size, so the encoder correctly chose the lower mode byte and re-encoded to different bytes. Plan section 4 makes canonicality an encoder obligation and explicitly lets decoders accept any valid mode, so byte identity only holds for output a conforming encoder produced. The assertion is now the invariant that actually holds — decode, re-encode, and require a fixed point — which still catches a decoder that loses or invents information. Co-Authored-By: Claude Opus 5 Claude-Session: https://claude.ai/code/session_hf1 --- README.md | 66 +++++++--- apps/web/app/page.tsx | 12 +- packages/hyperfly/README.md | 150 +++++++++++++++++++++ packages/hyperfly/package.json | 23 +++- packages/hyperfly/test/fuzz.test.ts | 197 ++++++++++++++++++++++++++++ python/README.md | 83 +++++++++++- rust/README.md | 41 ++++++ 7 files changed, 544 insertions(+), 28 deletions(-) create mode 100644 packages/hyperfly/README.md create mode 100644 packages/hyperfly/test/fuzz.test.ts create mode 100644 rust/README.md diff --git a/README.md b/README.md index c50f83c..5394b26 100644 --- a/README.md +++ b/README.md @@ -2,37 +2,67 @@ Binary compression for typed APIs at the edge of entropy. -Typed APIs already know what their data can contain. Production traffic reveals what the data -usually contains. Hyperfly intends to use both to generate specialized binary protocols for a -route, instead of shipping generic JSON over a generic compressor. +Typed APIs already know what their data can contain. Production traffic reveals what +the data usually contains. Hyperfly uses both to compile a binary protocol for one +exact route, instead of shipping generic JSON through a generic compressor. -Pre-release. Nothing here is benchmarked yet. +**Pre-release.** The wire format is specified, three implementations agree on it +byte-for-byte, and the benchmarks below are reproducible — but nothing is published +and nothing is stable. + +## What it costs on the wire + +Bytes per message, averaged over 500-message corpora (`bun run bench`): + +| route | JSON | JSON+Brotli | Protobuf | Hyperfly | + Brotli | Profiled | +|---|---|---|---|---|---|---| +| audit events | 12,687 | 2,512 | 7,190 | 2,109 | 2,054 | **823** | +| device telemetry | 7,994 | 1,422 | 2,007 | 896 | 818 | **638** | +| social feed | 6,863 | 2,294 | 4,396 | 1,908 | 1,902 | **1,535** | +| single order | 782 | 408 | 388 | 271 | 273 | **188** | +| OHLCV candles | 3,225 | 842 | 2,034 | 496 | **372** | 372 | + +Read the spread rather than the best row. Training is worth 57% on audit logs, where +the same user agents recur on every request, and nothing at all on candles, whose +only string sits outside the array. The corpora are synthetic — shaped like real +routes, not captured from one — and no production traffic has been measured yet. ## Repository ``` -spec/ wire format spec + golden vectors (the cross-language authority) -packages/hyperfly TypeScript reference implementation — core codec + zod adapter -apps/web hyperfly.dev — landing page (Next.js on OpenNext / Cloudflare Workers) -apps/bench private benchmark harness (JSON, gzip, Brotli baselines) -packages/lb legacy load balancer, previously published as `hyperfly@0.1.x` -packages/tooling shared eslint and typescript configs +spec/ the authority: wire format, plans, negotiation, golden vectors +packages/hyperfly TypeScript reference implementation, zod adapter, HTTP layer +python/ Python implementation and pydantic adapter +rust/ Rust core +apps/interop a TS server and a Python client over real HTTP, run by CI +apps/bench corpora and the benchmark harness +apps/web hyperfly.dev +packages/lb legacy load balancer, previously published as `hyperfly@0.1.x` ``` +The specifications are normative and the implementations are not. A fourth +implementation ports against [the golden vectors](spec/vectors), not against this +code. + +- [wire v0](spec/wire-v0.md) — envelope, varints, bitmaps, node encodings, canonical + artifacts, decoder limits +- [plan columnar v3](spec/plan-columnar-v3.md) — column layout, delta and XOR and + scaled-decimal numerics, packed text, trained dictionaries +- [negotiation v1](spec/negotiation-v1.md) — how peers agree on binary, how a client + bootstraps, how a profile rotates without a cutover + ## Development ```bash bun install -bun run dev # all apps -bun run build # all packages -bun run check-types +bun run test # TypeScript +pytest python/tests -q # Python +cargo test --manifest-path rust/Cargo.toml +cd apps/bench && bun run bench ``` -## Deploy - -```bash -cd apps/web && bun run deploy -``` +CI runs all three suites, a Python version matrix, and the cross-language interop +exchange on every push. ## License diff --git a/apps/web/app/page.tsx b/apps/web/app/page.tsx index 36156f1..5594b98 100644 --- a/apps/web/app/page.tsx +++ b/apps/web/app/page.tsx @@ -105,9 +105,15 @@ export default function Home() { github - - docs — soon - + + docs + +