Commit Graph
684 Commits
Author SHA1 Message Date
renovate[bot] 7b7cb6042e chore(deps): maintain cargo lockfile 2026-08-17 02:55:09 +00:00
Nils Andreas Svee 444ec3dd6a Merge pull request #115 from Lochnair/fix/break-client-server-dev-dep-cycle
fix(tests): break the irtt-client/irtt-server dev-dependency cycle
irtt-cli/v0.5.0 irtt-server/v0.5.0 irtt-proto/v0.5.0 irtt-client/v0.5.0 irtt-stats/v0.5.0
2026-08-17 09:53:49 +07:00
Nils Andreas Svee 3f1ac88989 fix(deny): add a license field to irtt-integration-tests
cargo-deny's licenses check requires a license expression even on an
unpublished crate; add the workspace's Apache-2.0 license so the check
passes rather than treating irtt-integration-tests as unlicensed.
2026-08-17 09:51:03 +07:00
Nils Andreas Svee 1753e91d5f fix(tests): break the irtt-client/irtt-server dev-dependency cycle
irtt-client and irtt-server mutually dev-depended on each other for
cross-crate integration tests. That cycle blocks `cargo publish` for
either crate whenever the other doesn't already exist on the registry
at the required version, which is exactly the situation for a crate's
first-ever release (irtt-server has never been published before).

Introduce a new `irtt-integration-tests` crate (publish = false, no
library target) to own tests whose actual subject is the interaction
between two or more irtt-* production crates:

  crate-local behavior          -> crate's own tests/
  cross-crate/system behavior   -> irtt-integration-tests

Move every test that imports both irtt_client and irtt_server there:
the client-side support harness (hmac, large_packets, protocol_options,
fill_negotiation) and the server-side real-socket tests that drive a
real AsyncClient against a real Server (async_client, negotiation_policy,
fill_wire_bytes, traffic_class, wildcard_source). server_set.rs stays in
irtt-server/tests since it only uses irtt_proto as test machinery to
drive irtt-server directly, which is a normal one-directional test
dependency, not a peer relationship.

irtt-server's dev-dependency on irtt-client is dropped entirely now
that nothing under crates/irtt-server/tests needs it, which fully
breaks the cycle from that side.

irtt-client keeps a one-directional dev-dependency on irtt-server: a
handful of white-box unit tests in src/async_client/tests.rs assert on
private AsyncClient internals (socket, remote, test_hooks) while also
needing a real in-tree server for blocking/async equivalence checks, so
they can't move to an external crate without losing that access. Their
InTreeServer helper is duplicated locally rather than shared, matching
the existing precedent of irtt-cli's own tests/support/in_tree_server.rs.
2026-08-17 09:49:32 +07:00
Nils Andreas Svee e120cca9bc Merge pull request #114 from Lochnair/chore/independent-crate-versioning
chore(release): independent per-crate versioning, first 0.5.0 releases
2026-08-17 09:32:39 +07:00
Nils Andreas Svee d66b5ed8de chore(release): move to independent per-crate versioning at 0.5.0
Each workspace crate now owns its own version instead of the previous
lockstep scheme; irtt-proto, irtt-client, irtt-server, irtt-stats, and
irtt-cli all become 0.5.0 as the first independently-versioned release.
Workspace dependency requirements are bumped to match.

Add a root CHANGELOG.md with a real per-crate 0.5.0 section drawn from
archaeology of every merge since v0.4.0, not just path-filtered commits.

Move cargo-dist to a crate-qualified `irtt-cli/vX.Y.Z` tag namespace so
only irtt-cli (the one dist-able application) triggers a GitHub Release;
library crate tags (irtt-proto/irtt-client/irtt-server/irtt-stats) exist
purely to pin the source for a crates.io release and no longer risk
tripping the release workflow. Regenerate the renamed
irtt-cli-release.yml via `dist generate` and update the few other files
that referenced the old release.yml path by name. Also fix a stale
`features = ["full"]` in dist-workspace.toml left over from a feature-flag
refactor that dropped the "full" feature entirely, which was silently
breaking every dist build.

Rescope semver.yml's tag trigger to the same five crate-qualified tags
so semver checks keep running under the new convention.
2026-08-17 09:29:25 +07:00
renovate[bot] 6722093120 chore(deps): update github actions to ff2f1c6 2026-08-16 17:35:43 +00:00
Nils Andreas Svee 046e1f52f1 Merge pull request #111 from Lochnair/fix/linux-receive-eintr
fix(io): retry interrupted receives
2026-08-17 00:35:19 +07:00
Nils Andreas Svee a598dbdc5c fix(io): address review feedback on interrupted-receive retries
- Error-queue drain: an interrupted MSG_ERRQUEUE read no longer ends
  the bounded drain early as if the queue were empty (which could
  strand a still-queued TX timestamp past the point its probe is
  looked up and removed). It now reports ErrorQueueRecord::Ignored,
  consuming one attempt of the drain's existing per-call work budget
  and retrying the same slot instead.
- Fake-server recv_from test helpers (client_multi_target.rs and
  tests/support/mod.rs) now keep one absolute deadline across
  interruptions, re-applying only the remaining time on each retry
  and restoring the configured timeout afterward, mirroring the
  production blocking-receive fix these tests exist to guard rather
  than restarting the full timeout on every interruption.
2026-08-17 00:32:37 +07:00
Nils Andreas Svee ca2389174f fix(io): retry interrupted receives
Real signal delivery on Linux (observed via x86_64-musl workspace
testing) can interrupt blocking and nonblocking recv/recvmsg calls
with EINTR. Several production and test receive paths treated that as
a fatal error rather than a transient interruption:

- Client::open's blocking receive loop and Client::recv_once/
  recv_available's blocking receive returned ClientError::Socket on
  Interrupted instead of retrying within their existing timeout
  budget.
- AsyncClient::poll_open and poll_recv's nonblocking recvmsg path
  (Linux ancillary) failed the same way instead of retrying through
  the existing readiness/work-budget machinery.
- The server's ancillary receive loop could terminate the listener on
  an interrupted nonblocking recvmsg.
- The client's MSG_ERRQUEUE TX-timestamp drain turned an interrupted
  read of optional metadata into a fatal ClientError::Socket.
- Fake-server test helpers panicked or misclassified EINTR as a
  timeout instead of retrying it.

Interrupted is now retried transparently everywhere a receive can
observe it, while preserving each path's existing timing contract:

- Blocking Open reuses its already-absolute per-attempt deadline, so
  interruptions resume within the same attempt without retransmitting
  or extending the deadline.
- recv_once/recv_available compute one absolute deadline per logical
  receive (when a timeout is configured) so repeated interruptions
  cannot extend it past the configured timeout, and restore the
  socket's configured read timeout afterward so a later call in the
  same recv_available budget is unaffected.
- AsyncClient's poll_open already bounds its retry loop with
  OPEN_POLL_WORK_BUDGET; poll_recv gains an equivalent
  RECV_POLL_WORK_BUDGET, since unlike WouldBlock, Interrupted does not
  clear Tokio's readiness state, so an unbounded retry loop was
  otherwise possible under sustained signal delivery.
- The server's receive loop retries Interrupted the same way it
  already retries WouldBlock, yielding to the runtime after a bounded
  number of consecutive interruptions for the same reason.
- The error-queue drain treats an interrupted read as no record
  obtained this drain (deferring to the next natural drain point)
  rather than a socket error, matching its existing EWOULDBLOCK
  handling.

Deterministic regression tests use a small test-only injection hook
(mirroring existing send-injection test hooks) rather than real signal
timing, covering: Open completing despite interruptions with no
retransmit, Open's deadline not extending under repeated
interruptions, recv_once classifying a reply normally despite
interruptions, recv_once's timeout not extending under repeated
interruptions, and the AsyncClient equivalents for open and recv.

No protocol, session, or timeout-classification behavior changes; no
new dependencies; send-side EINTR handling is unchanged and out of
scope.
2026-08-17 00:23:24 +07:00
Nils Andreas Svee e3815fdeed Merge pull request #110 from Lochnair/fix/server-i686-timespec-test
test(server): use native timespec bounds
2026-08-16 22:06:29 +07:00
Nils Andreas Svee 0793a7e1c5 test(server): use native timespec bounds 2026-08-16 22:03:03 +07:00
Nils Andreas Svee c1d75ba4cc Merge pull request #109 from Lochnair/fix/managed-terminal-reconcile
fix(managed): restart resubmitted terminal targets
2026-08-15 22:56:44 +07:00
Nils Andreas Svee 1d799c4ca0 fix(managed): restart resubmitted terminal targets 2026-08-15 22:50:19 +07:00
Nils Andreas Svee 00bba12746 Merge pull request #108 from Lochnair/refactor/positional-target-labels
refactor(cli): unify target argument syntax
2026-08-15 21:08:07 +07:00
Nils Andreas Svee a03004b22f refactor(cli): unify target argument syntax 2026-08-15 20:56:12 +07:00
Nils Andreas Svee 79d3b9350c Merge pull request #107 from Lochnair/fix/client-target-output
fix(cli): preserve target identity in default output
2026-08-15 20:25:55 +07:00
Nils Andreas Svee e4e6d63ef1 fix(cli): preserve target identity in default output 2026-08-15 20:21:04 +07:00
Nils Andreas Svee 6d7adf52a7 Merge pull request #106 from Lochnair/fix/client-post-send-timestamp
fix(client): timestamp probes after successful send
2026-08-15 20:02:51 +07:00
Nils Andreas Svee aac5247f01 fix(stats): clamp loss windowing timestamp to its own sent_at
timeout_at is pre-send anchored (F-04), so it can precede the same
probe's post-send sent_at when probe_timeout is small relative to the
send-call duration. Rolling-window eviction assumes non-decreasing
event timestamps, so clamp the internal StatsEvent::Loss windowing
value without changing the public EchoLoss.timeout_at field. Also
correct an AGENTS.md claim that sent_at feeds the downstream one-way
delay, which it does not.
2026-08-15 19:46:19 +07:00
Nils Andreas Svee e7b0632239 docs(client): correct IPDV claim in AGENTS.md
The post-send sent_at change does shift the upstream IPDV component's
endpoint, since ReplySample copies sent_at into client_send_mono/wall
for send_ipdv_ns. Document the shift instead of claiming IPDV is
unaffected.
2026-08-15 19:33:36 +07:00
Nils Andreas Svee a3896376da fix(client): timestamp probes after successful send
Moves the client userspace probe sent_at measurement to immediately
after a successful UDP send, improving raw RTT and the userspace
upstream-OWD fallback by excluding the socket send-call interval and
the small amount of local work preceding it.

All fallible probe-commit preflight (timeout deadline checked_add,
capacity/collision checks) still runs before the send, from a private
pre-send anchor (SessionMachine::finalize_probe_commit). The public
sent_at is now supplied afterward to an infallible
SessionMachine::commit_probe_sent, so DurationOverflow still guarantees
nothing was transmitted and a WouldBlock try_send still commits
nothing.

The operational probe timeout deadline stays anchored to the pre-send
timestamp on purpose, not to the new post-send sent_at, preserving
existing timeout/loss timing. Linux kernel TX_SOFTWARE plausibility
keeps its own pre-send wall-clock lower bound
(PendingProbe::tx_not_before_wall) instead of the post-send sent_at,
since a legitimate TX_SOFTWARE timestamp can be generated while the
send syscall is still in flight and would otherwise be wrongly
rejected.

Also flags (without touching production code) that irtt-stats'
ReplySample::from_reply_parts feeds the public sent_at directly into
IpdvSample.client_send_mono/client_send_wall_ns, so the upstream/send
IPDV component naturally shifts along with the sent_at semantics
change; per scope this is reported rather than compensated for.
2026-08-15 19:26:57 +07:00
Nils Andreas Svee 0ca36f2192 Merge pull request #105 from Lochnair/fix/client-kernel-tx-owd
fix(client): use kernel transmit time for upstream OWD
2026-08-15 19:01:13 +07:00
Nils Andreas Svee 1066d5df72 fix(client): use kernel transmit time for upstream OWD
Upstream one-way delay now prefers the correlated Linux TX_SOFTWARE wall
timestamp retained by PendingProbe when it is locally plausible (sent_at
<= kernel_tx <= received_at, all on the client's own wall clock), falling
back to the userspace sent_at.wall sample otherwise. RTT, downstream OWD,
IPDV, and timeout/scheduling semantics are unchanged.
2026-08-15 18:54:41 +07:00
Nils Andreas Svee 1dc18588e7 Merge pull request #104 from Lochnair/feat/client-kernel-tx-capture
feat(client): capture kernel transmit timestamps
2026-08-15 18:41:37 +07:00
Nils Andreas Svee 9e3477e617 feat(client): capture kernel transmit timestamps
On Linux, best-effort upgrade the socket's SO_TIMESTAMPING flags to
TX_SOFTWARE | OPT_ID | OPT_TSONLY after a successful Open and before the
first Echo probe. Promote the #103 error-queue foundation to production:
MSG_ERRQUEUE is drained opportunistically with a fixed per-call budget at
several natural choke points (after a probe send, before processing a
reply, before evaluating timeouts), and each automatic OPT_ID timestamp is
correlated directly with wire_seq — safe because Linux rolls back its
speculative sk_tskey increment on every send failure, wire_seq and the
kernel counter start together at every Open, and a socket can never be
reopened for a second session. The observed kernel TX wall timestamp is
retained on PendingProbe (surviving pending -> timed-out retention) as
dormant metadata only; RTT, OWD, and IPDV are unchanged and continue to use
the userspace send timestamp exclusively. Capability failure is fully
non-fatal and RX timestamping is unaffected either way. Non-Linux and
non-ancillary builds are unchanged.
2026-08-15 15:58:48 +07:00
Nils Andreas Svee 504d290bd2 Merge pull request #103 from Lochnair/refactor/client-linux-timestamping
refactor(client): unify Linux software timestamping
2026-08-15 15:13:42 +07:00
Nils Andreas Svee 12b4816e14 fix(client): align the error-queue control buffer
The MSG_ERRQUEUE control buffer was a plain [u8; N], which only
guarantees byte alignment. recvmsg's cmsgs() walks cmsghdr references
out of that storage and requires cmsghdr alignment, so this mirrors
the parent module's #[repr(align(8))] ControlBuffer instead of relying
on incidental stack alignment.
2026-08-15 15:08:30 +07:00
Nils Andreas Svee 97b094539f refactor(client): unify Linux software timestamping
Migrate the Linux client's receive kernel timing from SO_TIMESTAMPNS to
SO_TIMESTAMPING with RX_SOFTWARE + SOFTWARE, reported via
SCM_TIMESTAMPING instead of SCM_TIMESTAMPNS. Linux documents fallback
quirks when SO_TIMESTAMP[NS] and SO_TIMESTAMPING are both enabled on a
socket, so this establishes one unambiguous software-timestamp facility
before client TX timestamp work builds on the same API.
ReceiveMeta.kernel_rx_timestamp semantics, PacketMeta propagation, and
all PR #100 downstream OWD/RTT/IPDV behavior are unchanged. The receive
control buffer is now sized deliberately from cmsg_space::<T>() instead
of an unexplained fixed constant.

Also add safe, test-only Linux primitives that a follow-up change needs
for client TX timestamping: SO_TIMESTAMPING TX flag construction,
nonblocking MSG_ERRQUEUE parsing, and extended-error classification
that distinguishes a genuine send-timestamp completion from a malformed
timestamp record and from a real socket/network error. Production
sockets do not enable SOF_TIMESTAMPING_TX_SOFTWARE and nothing drains
the error queue in production; these primitives only run under
#[cfg(test)].
2026-08-15 14:57:21 +07:00
Nils Andreas Svee 10e0a38a48 Merge pull request #102 from Lochnair/fix/server-kernel-rx-wall
fix(server): use kernel receive time for wall timestamps
2026-08-15 14:10:52 +07:00
Nils Andreas Svee d3f93a9370 fix(server): use kernel receive time for wall timestamps
An echo reply's receive wall timestamp now prefers the kernel arrival
reading the Linux listener captured, where that reading is plausible for
the datagram it describes. That removes socket-queue and runtime wakeup
latency from the upstream one-way delay a client computes, and it is the
only thing the observation is allowed to change.

The runtime reaches the core through a crate-private entry point taking
the optional observation as an explicit per-datagram argument; the public
ServerCore::handle_datagram is unchanged in signature and in behavior, and
both run one implementation. There is no "next receive timestamp" side
channel and no clock wrapper.

ClockSample stays one paired userspace instant: the preferred wall value
is carried beside it on the classified echo, never inside it. Lifecycle,
rate and maximum-duration policy remain on received_at.mono_ns, midpoints
remain the mean of the paired userspace samples, and no monotonic instant
is estimated from a wall reading. A reading that does not convert, that is
later than the core's own sample, or that lags it by more than one second
falls back to the userspace wall; it is never a reason to drop a datagram.
2026-08-15 13:46:29 +07:00
Nils Andreas Svee e6491a1f70 Merge pull request #101 from Lochnair/feat/server-kernel-rx-capture
feat(server): capture kernel receive timestamps
2026-08-15 13:18:55 +07:00
Nils Andreas Svee 1b0fc2cabe feat(server): capture kernel receive timestamps 2026-08-15 13:13:07 +07:00
Nils Andreas Svee c80edb460b Merge pull request #100 from Lochnair/fix/client-kernel-rx-owd
fix(client): use kernel receive time for downstream OWD
2026-08-15 12:53:41 +07:00
Nils Andreas Svee c28929bb78 fix(client): use kernel receive time for downstream OWD 2026-08-15 12:44:16 +07:00
Nils Andreas Svee 277fbfcb57 Merge pull request #99 from Lochnair/refactor/server-receive-drop-policy
refactor(server): centralize receive drop policy
2026-08-15 11:33:43 +07:00
Nils Andreas Svee 435315a8c0 test(server): assert oversized receives never reach the core 2026-08-15 11:30:53 +07:00
Nils Andreas Svee 7df85767ad refactor(server): centralize receive drop policy 2026-08-15 11:24:30 +07:00
Nils Andreas Svee ce462fd37b Merge pull request #98 from Lochnair/refactor/stats-exact-medians
refactor(stats): retain exact finite timing samples
2026-08-15 11:13:37 +07:00
Nils Andreas Svee 71b5819366 docs(stats): scope the exact-median contract to the cumulative snapshot
Rolling snapshots are recomputed with `SampleMode::RunningOnly` regardless
of the configured sample mode, so the new `SampleMode::Exact` wording — that
every timing metric a `Snapshot` exposes reports a median — was not true of
`rolling_count()` and `rolling_time()`.

Scope the promise to the cumulative snapshot and say plainly on both rolling
accessors that they use running statistics only and report no median, since
a rolling window is a bounded recent view rather than the run's retained
history. A test pins both halves so the wording cannot quietly go stale.

Rolling retention behavior itself is unchanged.
2026-08-15 10:48:45 +07:00
Nils Andreas Svee db9bd515bb refactor(stats): retain exact finite timing samples
`SampleMode::Exact` retained exact samples for eight of the eleven public
timing metrics. Send call, timer error, and server processing always built
their `TimeMetric` with retention disabled, so a finite run reported no
median for them even though they are the same public `TimeStats` type and
appear in the same summary table with a Median column.

Derive one `retain_exact` decision from the sample mode in `CoreStats::new`
and apply it to every timing metric, so exact mode means the same thing for
all of them. Running-only mode is unchanged and still retains none of them.

The retention estimator counted eight exact sample streams per measurable
reply. Rename it to the eleven exact samples an ordinary successful probe
can retain and document the wider optional-measurement upper bound, which
raises the finite estimate on this target from 668 to 764 bytes per probe.
A test counts the metrics a fully measured probe actually retains and
compares it against that constant, so retention and its estimate cannot
drift apart unnoticed.

No new median-capability type was needed: `TimeStats::median_ns` already
distinguishes a retained median from an absent one, and an optional
measurement the server never supplied still produces no samples at all.
2026-08-15 10:41:17 +07:00
Nils Andreas Svee 76dc904da1 Merge pull request #97 from Lochnair/refactor/stats-retention-estimate
refactor(stats): own retention memory estimates
2026-08-15 10:30:44 +07:00
Nils Andreas Svee b93e6d0ab7 refactor(stats): own retention memory estimates 2026-08-15 10:25:04 +07:00
Nils Andreas Svee 44026068cf Merge pull request #96 from Lochnair/test/client-driver-conformance
test(client): expand blocking and async conformance coverage
2026-08-15 10:11:37 +07:00
Nils Andreas Svee 0c3acce36a Merge pull request #95 from Lochnair/refactor/managed-target-locality
refactor(client): centralize managed target accounting
2026-08-15 10:06:18 +07:00
Nils Andreas Svee 006add3648 Merge pull request #94 from Lochnair/refactor/shared-target-preparation
refactor(cli): centralize managed target preparation
2026-08-15 10:05:43 +07:00
Nils Andreas Svee 50e4633c7a refactor(cli): centralize managed target preparation
Both client applets duplicated the step from parsed arguments to a runnable
managed setup: target specs, managed target preparation, a ClientConfig
built from an arbitrary primary target, pacing conversion, and an identical
ManagedClientConfig skeleton with its own copy of the event-capacity
constant. The primary-target step was the worst of it, since the managed
driver replaces server_addr per target, so the address the applets went out
of their way to find was immediately discarded.

shared::client::prepare now performs that step once: it validates the target
set first, then returns the validated targets, one target-free ClientConfig
template, and the pacing, with managed_config()/managed_targets() for the
driver. CommonClientArgs::to_client_config no longer takes a server address.

Applet-specific semantics are unchanged: each command keeps its own duration
default and help text, the client still accepts no target for
--list-columns, and the TUI still rejects an empty target list at parse
time.
2026-08-15 10:04:08 +07:00
Nils Andreas Svee c2666d776e Merge pull request #93 from Lochnair/test/tui-rendering
test(tui): add off-screen render coverage
2026-08-15 09:55:09 +07:00
Nils Andreas Svee ed8d212a17 Merge pull request #92 from Lochnair/refactor/stats-late-reply-policy
refactor(stats): make late-reply sampling explicit
2026-08-15 09:50:01 +07:00
Nils Andreas Svee 61fdff5c98 Merge pull request #91 from Lochnair/refactor/cli-scalar-formatting
refactor(cli): unify scalar presentation formatting
2026-08-15 09:49:50 +07:00