Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 0 additions & 20 deletions quest/m0/test-flakes-3/cli-fetch-rust.md

This file was deleted.

24 changes: 24 additions & 0 deletions quest/m1/local-env-file.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# [XS] A local suite's environment does not depend on where it starts

## Goal

A suite run through `sh/local.sh` gets the same environment whichever
directory it starts from, so a local run reproduces CI's logging and timing.

## Plan

Found 2026-11-16 while reproducing
[the interop FETCH flake](https://github.com/moq-dev/moq/pull/8894):
`sh/local.sh` runs `sh/local.ts` under `bun`, which loads `.env` from the
working directory. The repository's `.env` sets `RUST_LOG="debug"` and
`RUST_BACKTRACE=1`, so a suite started from the repository root runs every
Rust process at debug, while `just test interop` (whose recipes run in `test/`)
and CI run at the default info. Debug logging slows every relay and client
enough to change which races a run can hit.

Recommendation: run `sh/local.ts` with `bun --no-env-file`, as `quest` itself
runs, and delete the root `.env` if nothing else reads it (it dates from
[moq-dev/moq#928](https://github.com/moq-dev/moq/pull/928)). A developer who
wants debug output sets `RUST_LOG` in their shell.

Public API: none. Wire: none.
22 changes: 16 additions & 6 deletions test/interop/interop.sh
Original file line number Diff line number Diff line change
Expand Up @@ -984,10 +984,13 @@ else
METRICS_URL="http://127.0.0.1:${HARNESS_PORT}/metrics"
printf '\n[internal]\nlisten = "127.0.0.1:%s"\n\n[stats]\nenabled = true\n' "$HARNESS_PORT" >>"$HARNESS_RUN/relay.toml"
fi
# Connection spans and clean closes must survive an inherited warn-only filter. The route key lane
# reads the relay's debug line for each verified proof.
# info stays the base, ahead of the inherited RUST_LOG so its own level still wins: a filter naming
# only targets, such as quinn=debug, would otherwise silence every other warning, such as why the
# relay refused a request. Connection spans and clean closes must survive an
# inherited warn-only filter. The route key lane reads the relay's debug line for each verified proof,
# and the idle-out check its upstream subscribe and fetch starts.
harness_spawn relay "$HARNESS_RUN/relay.log" env \
"RUST_LOG=${RUST_LOG:+$RUST_LOG,}moq_relay::connection=info,moq_relay::relay=info,moq_net::lite::setup=debug" \
"RUST_LOG=info,${RUST_LOG:+$RUST_LOG,}moq_relay::connection=info,moq_relay::relay=info,moq_net::lite::setup=debug,moq_net::lite::subscriber=debug" \
"$RELAY" "$HARNESS_RUN/relay.toml"
if ! harness_ready "$URL/certificate.sha256" 30 "$HARNESS_PID"; then
echo "relay never became ready" >&2
Expand Down Expand Up @@ -1035,7 +1038,7 @@ subscribe_grant() {
}

# moq-cli logs each grant it receives over AUTH at debug, under `moq_net::auth`.
CLI_LOG="${RUST_LOG:-info},moq_net::auth=debug"
CLI_LOG="info,${RUST_LOG:+$RUST_LOG,}moq_net::auth=debug"

# The lite version with AUTH, which no client offers by default. The clients the
# harness reads a grant or a refusal from dial it. Compat dials its pinned version.
Expand Down Expand Up @@ -2109,7 +2112,7 @@ run_fetch_round() {
local pub="$1" sub="$2" mode="${3:-cached}" pid from version
local name="fetch-$1-$2${3:+-$3}" fifo="$LOGS/fetch-ack" broadcast="fetch-$1-$$-$RANDOM"
local label="CLI FETCH${3:+ $3}"
local started=$SECONDS why=""
local started=$SECONDS why="" fetch_failed=0
local cell=(case="$label" publisher="$pub" subscriber="$sub" log="$LOGS/$name-sub.log")
# The relay fills its miss with an upstream FETCH, which a JS publisher refuses on
# moq-transport by design: it serves FETCH only over moq-lite.
Expand Down Expand Up @@ -2146,6 +2149,7 @@ run_fetch_round() {
why="incorrect or missing FETCH payload"
overall=1
cat "$LOGS/$name-pub.log" "$LOGS/$name-sub.log"
fetch_failed=1
harness_reap "$pid"
fi
exec 9>&-
Expand All @@ -2155,6 +2159,11 @@ run_fetch_round() {
why="${why:-a relay connection negotiated another version}"
overall=1
fi
# The run's last lines may be a later round's, so print the relay's side of this one. Printed
# after check_idle_outs waited for the round's connections, so it includes how each closed.
if ((fetch_failed)); then
relay_log_since "$from" | sed 's/^/ relay: /'
fi
cell+=(seconds=$((SECONDS - started)))
if [[ -z "$why" ]]; then record pass "${cell[@]}"; else record fail "${cell[@]}" detail="$why"; fi
}
Expand All @@ -2166,7 +2175,8 @@ run_fetch_subscriber() {
grep -qx 'fetch clean group=1 frames=3 bytes=196608' "$LOGS/$name-sub.log"
return
fi
timeout -k 3 "$TIMEOUT" "$MOQ" --connect "$(token_url --subscribe "$(subscribe_grant "$broadcast")")" ${version:+--connect-version "$version"} \
# At debug, a failed fetch says whether it went on the wire and how the relay answered it.
RUST_LOG="info,${RUST_LOG:+$RUST_LOG,}moq_net=debug" timeout -k 3 "$TIMEOUT" "$MOQ" --connect "$(token_url --subscribe "$(subscribe_grant "$broadcast")")" ${version:+--connect-version "$version"} \
--broadcast "$broadcast" fetch tail --group 1 --json >"$LOGS/$name.json" 2>"$LOGS/$name-sub.log" &&
python3 - "$LOGS/$name.json" <<'PYCODE'
import base64, json, sys
Expand Down