A replay consumer now has a 5s idle heartbeat, and the row stream ends at the first consumer error instead of skipping it. When the server drops the consumer, as on a restart, two missed heartbeats end the SSE response and the browser reconnects with Last-Event-ID. Before, the response stayed open and delivered nothing. A Last-Event-ID above the stream's newest sequence now replays as a fresh reader. The server accepts a start past the end and delivers nothing until the stream reaches it, so a stale id stalled the replay. swarm-controller's stream tests run against a real nats-server on loopback (`test_nats`, binary from HIVE_NATS_SERVER, exported by checks.nix and devshell.nix). They cover: ensuring the stream twice, an existing stream with other limits being opened as it is, the replay arriving before live rows, a reconnect getting every later row exactly once, and a dropped consumer ending the row stream. The limits test now compares against the subagent stream's own config. Two comments that described the agent's terminal route as live-only are corrected.
54 lines
2.5 KiB
Nix
54 lines
2.5 KiB
Nix
# Dev shell: the rust toolchain plus the exact native build inputs
|
|
# the crane derivations use (git, sqlite, pkg-config, cmake — see
|
|
# ../rust.nix), so a plain `cargo build` / `cargo test` in the shell
|
|
# sees the same toolchain shape as CI.
|
|
{ pkgs, rust }:
|
|
{
|
|
default = pkgs.mkShell {
|
|
# Same list the daemons are handed and the same one `checks.nix` gives
|
|
# the test derivation — `nix/reserved-names.nix`. Without it here, a
|
|
# plain `cargo test` in the shell would panic on the drift test, so a
|
|
# developer's local run and CI would disagree about a test that exists
|
|
# precisely to stop two spellings of one fact from drifting.
|
|
HIVE_RESERVED_NAMES = pkgs.lib.concatStringsSep " " (import ./reserved-names.nix);
|
|
# The `nats-server` swarm-controller's stream tests start, the same one
|
|
# `checks.nix` gives the test derivation. Those tests panic without it.
|
|
HIVE_NATS_SERVER = "${pkgs.nats-server}/bin/nats-server";
|
|
packages =
|
|
rust.nativeBuildInputs
|
|
++ (with pkgs; [
|
|
cargo
|
|
cargo-llvm-cov
|
|
clippy
|
|
rust-analyzer
|
|
rustc
|
|
rustfmt
|
|
shellcheck
|
|
# The two "prose lint (vale)" CI jobs run vale over docs/. `vale
|
|
# sync` must run once before `vale docs` and writes styles to
|
|
# $XDG_DATA_HOME, so point that at the repo like CI does:
|
|
# `XDG_DATA_HOME=$PWD/.vale-data nix develop -c sh -c 'vale sync && vale docs'`.
|
|
vale
|
|
]);
|
|
|
|
# `cargo llvm-cov` shells out to `llvm-profdata` and `llvm-cov`,
|
|
# which it expects to find as rustup's `llvm-tools-preview` beside
|
|
# the rustc toolchain. Nixpkgs has no such component, so without
|
|
# these it aborts with "failed to find llvm-tools-preview" — a
|
|
# message that reads like a missing install rather than a path the
|
|
# shell simply has to name.
|
|
#
|
|
# ⚠️ Both the variable names and the package were wrong on the first
|
|
# attempt and only the tool itself said so: it reads `LLVM_COV` /
|
|
# `LLVM_PROFDATA` (no `_PATH` suffix), and the binaries live in
|
|
# `llvmPackages.llvm` — `llvmPackages.bintools` is the linker
|
|
# wrapper and ships neither.
|
|
#
|
|
# Coverage is deliberately NOT part of `nix flake check`: an
|
|
# instrumented build cannot reuse the normal test artifacts, so it
|
|
# roughly doubles a test job. It runs on manual dispatch — see
|
|
# .forgejo/workflows/coverage.yml for why that rather than nightly.
|
|
LLVM_PROFDATA = "${pkgs.llvmPackages.llvm}/bin/llvm-profdata";
|
|
LLVM_COV = "${pkgs.llvmPackages.llvm}/bin/llvm-cov";
|
|
};
|
|
}
|