Skip to content

fix(probes): Bound responses with a ten-byte compatibility ceiling - #46

Merged
korya merged 3 commits into
masterfrom
korya-bound-probe-responses
Sep 10, 2026
Merged

fix(probes): Bound responses with a ten-byte compatibility ceiling#46
korya merged 3 commits into
masterfrom
korya-bound-probe-responses

Conversation

@korya

@korya korya commented Sep 10, 2026

Copy link
Copy Markdown
Owner

Problem

Misconfigured probe endpoints can consume arbitrary response bodies while reporting valid latency samples and charging only a fixed traffic estimate.

An endpoint returning 1 MiB is currently drained as a successful probe despite a 5000-byte foreign or 1000-byte self estimate. Empty responses also count as measurements.

Solution

Accept only complete probe bodies of 1–10 bytes, discard invalid samples, and report bounded warnings while retaining valid measurements and continuing load.

Ten bytes preserves Cloudflare's deployed endpoint alongside the draft's one-byte response. The ceiling is fixed, with no caller override; the compatibility change is called out under Changed in the changelog. LAT-11 and the README record the deviation. Dated config and bounded-GET checks confirm Apple returned one byte and Cloudflare ten on 2026-09-10; these observations are not vendor guarantees.

Response Handling
Complete, nonempty, 1–10 bytes Accept latency sample
Declared length above 10 Reject before reading payload
Unknown length Read at most 11 bytes to detect overflow
Ten bytes without completion Wait for the existing deadline; no premature success
Empty, truncated, read failure, or oversize Discard sample and close its response body

Closing a rejected self-probe body preserves the shared HTTP/2 load stream. Size warnings are limited to one for idle and one per foreign/self kind in each direction; an idle timeout and size failure share one diagnostic. Parent cancellation retains precedence. Load continues within the configured budgets even if all probes fail, retaining capacity measurements with absent loaded latency and zero RPM. Failed loaded attempts still charge their fixed estimates, which remain separate from throughput. LIM-2 and LIM-10 explicitly describe transport buffering and the absence of an exact wire-byte cap.

Validation: go test -race -count=3 ./... passed, including soak tests; the added byte-cap regression also passed with three race-enabled repetitions. Build, vet, formatting and golangci-lint passed. Real HTTP/1.1 and HTTP/2 tests cover known/unknown sizes, stalls, truncation, status precedence, multiplexed load survival, partial results, warning deduplication, accounting and CLI JSON/human/events output. Result schema and algorithm cost fixtures remain unchanged. The CLI byte-cap output case now uses a one-byte accounting cap and a separate five-second watchdog, removing its previous 1 MB / 300 ms transfer-rate assumption. That case passed 30 race-enabled repetitions; the complete CLI package passed three repetitions.

The built CLI was exercised against the same local fixture before and after: one valid one-byte response followed by two eleven-byte responses. The new build keeps one idle sample, warns, and completes download with exit 0. Screenshots render the captured CLI transcript.

Before After
Three responses counted as samples One valid sample retained with a size warning

Known pre-existing CLI limitation found during end-to-end validation: when a throughput lower-bound window exists without any completed loaded probes, human output can print <= 0 RPM as an upper bound; JSON omits the unavailable bound. This formatter issue remains a separate follow-up.

Related:

korya and others added 3 commits September 10, 2026 00:15
Reject empty and oversized probe responses before they can distort latency
or drain arbitrary payloads against a fixed accounting estimate. Accept
complete 1-10 byte bodies to preserve Apple and Cloudflare compatibility.

Retain valid idle samples, report bounded size warnings per phase and probe
kind, and preserve shared HTTP/2 load streams on rejection. Document the
read limit separately from estimated costs and transport buffering.

Add real HTTP/1.1 and HTTP/2 boundary, cancellation, isolation, accounting,
warning and CLI coverage, with matching specs and matrix rows.

Closes #40

Co-Authored-By: GPT-6 <noreply@openai.com>
State that the ten-byte response ceiling has no caller override and that
load measurements continue when probes fail. Keep the approved runtime policy.

Separate the compatibility change from the bounded-read fix in release notes.
Record dated config and small-response observations for Apple and Cloudflare,
with commands to repeat the checks without generating load traffic.

Co-Authored-By: GPT-6 <noreply@openai.com>
The truncation-output test required a 1 MB transfer within a 300 ms deadline.
On a contended Windows race runner, the duration cap won and the correct CLI
output failed the byte-cap assertion.

Use a one-byte accounting cap with a five-second watchdog so the assertion
checks truncation reporting without a minimum transfer-rate requirement.
Keep the exact byte-cap reason and warning checks.

Co-Authored-By: GPT-6 <noreply@openai.com>
@korya
korya marked this pull request as ready for review September 10, 2026 19:14
@korya
korya merged commit f85bfc9 into master Sep 10, 2026
12 checks passed
@korya
korya deleted the korya-bound-probe-responses branch September 10, 2026 19:14
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.

Bound small probe responses before they bypass byte accounting

1 participant