Skip to content

Fix invalid speed measurements and bound test runs - #304

Open
code-inflation wants to merge 1 commit into
masterfrom
fix/p1-measurement-correctness
Open

Fix invalid speed measurements and bound test runs#304
code-inflation wants to merge 1 commit into
masterfrom
fix/p1-measurement-correctness

Conversation

@code-inflation

@code-inflation code-inflation commented Sep 13, 2026

Copy link
Copy Markdown
Owner

Incomplete downloads could be counted as full transfers, HTTP error responses could become latency samples, and runs with no successful throughput measurements could exit successfully. This change validates measurements and gives runs explicit outcomes and bounded execution.

  • Reject truncated, incorrectly sized, and timed-out download bodies, plus upload response-body errors. Preserve the upload timing boundary at response headers.
  • Report unavailable latency as N/A/null, with sample counts and errors; preserve valid zero-latency measurements.
  • Return complete/partial/failed reports instead of exiting the host process from the library. Treat invalid or unavailable metadata as optional enrichment and emit CLI diagnostics on stderr.
  • Share a 120-second default deadline and 30-second cumulative retry-wait budget across the run. Support HTTP-date Retry-After values and graceful cancellation that retains completed samples.
  • Calculate quartiles consistently by excluding the middle observation from both halves for odd sample counts.

The CLI adds --max-duration, --max-retry-wait, and --server. Exit codes are 0 for complete, 1 for failed, 3 for partial, and 130 for cancellation. An in-flight blocking request may finish at its remaining request timeout before cancellation completes.

Compatibility: existing successful measurement fields and CSV columns remain available. JSON adds run status, stop reason, and structured errors. Legacy latency wrappers return NaN rather than zero when no valid measurement exists; fetch_metadata returns MeasurementError to represent metadata validation failures. README documents these changes.

Validation:

  • Reproduced the core failures with red tests before implementing the fixes, including an additional upload timeout regression.
  • All 75 tests pass, including 26 new tests covering transfer validation, latency failures, exit codes, metadata, retry dates, shared budgets, deadlines, cancellation, CSV output, and quartiles.
  • Formatting, Clippy across all targets/features with warnings denied, documentation generation, and the locked release build pass.
  • Small live release-binary smoke test completed through ZRH with three valid latency probes and one successful 100 KB transfer in each direction.

@code-inflation
code-inflation force-pushed the fix/p1-measurement-correctness branch from 55b6a2f to 2d5235f Compare September 13, 2026 07:42
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.

1 participant