You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
context collectors: revision-dependent facts split history #97
I have one main comment, which is that bx compare may not run as-is on the NumPy example. The issue is that revision-dependent facts like numpy_version would split history.
...
environment.system splits history (by default), so any version change would split history in the NumPy example. In that case, it doesn't seem like revisions could actually run? (The hash also differs, not just summary.)
I did say collector facts should split history, but it seems I wasn't thinking about run verification yet! I think we should at least change this to allow putting some facts in provenance, the ones which shouldn't be coordinates. We could rename summary to environment and only put that in environment.facts?
There was some back-and-forth in dogfooding numpy collectors in follow-ups to #71, precisely around adding the numpy version. That said, I think it's best to have an initial implementation of main UC-{01,02,03,04} requirements, dogfood them, and then address this issue.
Potentially related factoid found when looking at #189. That issue is about revsions profile, and I asked Claude about the environments profile. It made a reproducer under the fold, which installs a small library into two environments, and where the performance must differ between envs by a large factor.
What it found was that switching the everything correctly but not having a context collector to tell the envs apart gives the "sides-differ" refusal. Which is a false alarm, in a sense: we just do not record enough information to tell the sides apart, or where we record it (asv) we do not use it.
Claude description below:
What I ran for environments. The script uses two venvs, one with the slow
mylib and one with the fast one, and bx bench per side with a shared run key.
Forgot to switch (both sides in the slow venv): bx compare --profile environments refuses. The
message is sides-differ: … nothing recorded about the environment differs. Describe what differs
with a context collector…. I got the same refusal in measure mode with two targets. So bx already
stops this case loudly.
Switched properly, no collector: the same refusal, although the builds differ about 250×. That is a
false alarm. The installed note records the difference, but the sides-differ check ignores
everything under provenance, where the note is stored.
Switched properly, with a collector that prints mylib's version: it gives IMPROVED, effect −99.58%,
and differs: …system.deps.mylib. I ran this one by hand. It is not in the script.
What it would take to remove that false alarm.
In the sides-differ check, also count a difference in the installed note (name, version or path) as
a difference between the sides. The identity policy and the series fingerprints stay untouched.
Show it in the differs: line, so the user sees what told the sides apart.
Add two tests: different installed notes pass, and equal installed notes still fail.
Do the pyperf plan first. Otherwise this works only for asv.
The first case needs nothing new, because it is already refused. Step 1 only removes the false alarm,
which is not part of #185.
Details
benchx/repro_185$ cat environments_check.sh
#!/usr/bin/env bash
# Does the `environments` profile have the #185 problem (one build measured on both sides)?
#
# usage: environments_check.sh [BENCHX_CHECKOUT] (default: the checkout this script is in)
# needs: uv, git, network (for PyPI)
#
# Two environments, each with its own build of a toy package `mylib`: venv-slow (does 100 times the
# work of venv-fast) and venv-fast. One suite, one tree. As the issue recommends, each side is a
# `bx bench` call in its environment, all with one --run-key and a label, then `bx compare --run-key`
# with --profile environments. Two cases:
# 1. the user forgets to switch: both sides run in venv-slow, labels "a" and "b"
# 2. the user switches properly: side a in venv-slow, side b in venv-fast
set -eu
BENCHX=$(cd "${1:-$(dirname "$0")/..}" && pwd)
W=$(mktemp -d "${TMPDIR:-/tmp}/bx185env.XXXXXX")
cd "$W"
mklib() { # DIR VERSION WORK
mkdir -p "$1/src/mylib"
printf 'def work():\n sum(range(%s))\n' "$3" > "$1/src/mylib/__init__.py"
printf '[project]\nname = "mylib"\nversion = "%s"\n[build-system]\nrequires = ["setuptools"]\nbuild-backend = "setuptools.build_meta"\n' \
"$2" > "$1/pyproject.toml"
}
mklib slow 1.0 20000
mklib fast 2.0 200
mkdir -p suite/asv_bench/benchmarks
printf '{"version": 1, "project": "mylib"}\n' > suite/asv_bench/asv.conf.json
printf 'import mylib\n\n\ndef time_work():\n mylib.work()\n' > suite/asv_bench/benchmarks/bench_work.py
git -C suite init -q
git -C suite add -A
git -C suite -c user.name=repro -c user.email=repro@example.com commit -qm suite
for e in slow fast; do
uv venv -q "venv-$e"
uv pip install -q --python "venv-$e/bin/python" "$BENCHX" "./$e"
done
session() { # KEY VENV_OF_SIDE_A VENV_OF_SIDE_B
local key=$1 slot=0 v
for round in 0 1 2 3 4; do
for side in a b; do
v=$([ "$side" = a ] && echo "$2" || echo "$3")
PATH="$W/venv-$v/bin:$PATH" bx bench suite/asv_bench --adapter asv --run-key "$key" \
--label "env=$side" --round "$round" --slot "$slot" \
--processes 2 --values 3 --warmups 1 --no-ingest --out "out/$key" > /dev/null 2>&1
slot=$((slot + 1))
done
done
PATH="$W/venv-slow/bin:$PATH" bx compare --run-key "$key" --profile environments --label env \
--baseline a --results "out/$key" 2>&1 | grep -v '^$'
}
echo "=== 1. forgot to switch: both sides ran in venv-slow"
session forgot slow slow
echo
echo "=== 2. switched properly: side a in venv-slow, side b in venv-fast (b really is ~250 times faster)"
session switched slow fast
Activity
ev-br commentedon Dec 4, 2026
Potentially related factoid found when looking at #189. That issue is about
revsionsprofile, and I asked Claude about theenvironmentsprofile. It made a reproducer under the fold, which installs a small library into two environments, and where the performance must differ between envs by a large factor.What it found was that switching the everything correctly but not having a context collector to tell the envs apart gives the "sides-differ" refusal. Which is a false alarm, in a sense: we just do not record enough information to tell the sides apart, or where we record it (asv) we do not use it.
Claude description below:
What I ran for environments. The script uses two venvs, one with the slow
mylib and one with the fast one, and bx bench per side with a shared run key.
message is sides-differ: … nothing recorded about the environment differs. Describe what differs
with a context collector…. I got the same refusal in measure mode with two targets. So bx already
stops this case loudly.
false alarm. The installed note records the difference, but the sides-differ check ignores
everything under provenance, where the note is stored.
and differs: …system.deps.mylib. I ran this one by hand. It is not in the script.
What it would take to remove that false alarm.
a difference between the sides. The identity policy and the series fingerprints stay untouched.
The first case needs nothing new, because it is already refused. Step 1 only removes the false alarm,
which is not part of #185.
Details