Skip to content

feat(bench): measure the artifact-serving arms and gate the ratio (#1882 decision 6 / #2196) - #2206

Merged
zackees merged 1 commit into
mainfrom
agent/2196-cell6-report
Nov 28, 2026
Merged

zackees merged 1 commit into
mainfrom
agent/2196-cell6-report

Conversation

@zackees

@zackees zackees commented Nov 28, 2026

Copy link
Copy Markdown
Member

What

Decision 6 of docs/design/artifact-serving-decisions.md asks for one headline
number with its control arm and a 10 % regression gate. #2196
built the consumer the measurement needs (the ladder is now consulted from the
ESP32 packages stage and every build records prebuilt_libs in
build_info_<env>.json), so the measurement side can be written.

ci/artifact_serving_bench.py (additive; no new crate, no new dependency):

  • --measure runs both arms of a cell. Every trial gets its own empty
    FBUILD_CACHE_DIR, so the number is a first compile and not a framework
    reuse; the served arm passes the hidden --prebuilt-core opt-in, the control
    arm the public --no-prebuilt-libs. Writes <YYYY-MM-DD>.json and a
    recency-gated latest.json — the same overlap rule
    ci/publish_bench_site.py applies to the site overlay, so a run that finishes
    last never hands the site an older measurement.
  • It reads what the build itself recorded — prebuilt_libs from
    build_info_<env>.json (cell 4, prebuilt_record.rs) — and refuses to
    report a served arm whose record says used: false
    . A ratio computed from
    two source builds reads as a 1.00x "speedup" and measures nothing; decision 6
    calls a fallback in CI a hard failure, so the arm raises instead of emitting a
    row. The control arm is checked from the other side: it must report
    used: false.
  • --check gates the newest measurement against latest.json for the
    reference cell (esp32s3 x framework-arduinoespressif32-libs/core-3.3.12 x
    ubuntu-22.04), exits 3 under --fail, treats exactly 10 % as inside
    the budget (the decision says "more than 10 %"), and reports a non-reference
    cell without ever gating it.

Evidence (real output)

$ uv run --no-project python -m unittest ci.test_artifact_serving_bench
Ran 17 tests in 0.845s
OK

Full drift suite exactly as ci-workflow-drift.yml runs it:

$ TMPDIR=/tmp uv run --with pyyaml --no-project python -m unittest <41 modules>
Ran 643 tests in 25.835s
OK

RED proofs (scripted revert of the real code, then restore + touch):

  • enforce_arm's served-arm check weakened -> test_a_served_arm_that_fell_back_to_source_is_not_a_measurement fails.
  • gate changed to change >= budget -> test_exactly_ten_percent_is_inside_the_budget fails.

Both were the only failures (11 passed / 2 failed), and the restored file is
green again.

$ uv run --no-project --with ruff==0.12.12 ruff format --check ci/artifact_serving_bench.py ci/test_artifact_serving_bench.py
2 files already formatted
$ uv run --no-project python ci/check_python_types.py
0 errors, 0 warnings, 0 notes
$ uv run --no-project python ci/check_python_complexity.py
All checks passed!

Registration: the new test module is listed in ci/local_suites.DRIFT_UNITTEST_MODULES
and in the drift workflow's unittest step (same order — test_local_suites
compares the sequences), and ci/README.md carries the entry.

Not in this PR (honest limits)

#2196 stays open. No close keyword.

Decision 6 of docs/design/artifact-serving-decisions.md is the last cell of
#1882, and #2196 is the consumer it was waiting for. It asks for one headline
number WITH its control arm -- cold_first_compile_wall_s served vs the
--no-prebuilt-libs source arm in the same job -- plus a 10 % regression gate on
the reference cell.

ci/artifact_serving_bench.py:

- --measure runs both arms of a cell, each trial with its own empty
  FBUILD_CACHE_DIR, so the number is a first compile and not a framework reuse;
  the served arm passes the hidden --prebuilt-core opt-in, the control arm the
  public --no-prebuilt-libs. Writes <YYYY-MM-DD>.json plus a recency-gated
  latest.json (an older run never replaces a newer measurement).
- It reads what the build already records -- prebuilt_libs in
  build_info_<env>.json (#2196 cell 4) -- and REFUSES to report a served arm
  whose record says used: false. A ratio from two source builds reads as a
  1.00x speedup and measures nothing, which decision 6 calls a hard failure.
- --check applies the 10 % gate to the newest measurement against latest.json,
  exits 3 under --fail, and never gates a non-reference cell.

Remaining for #1882 cell 6, deliberately out of scope here: the nightly step
that invokes --measure, bytes_downloaded (needs a network counter) and
fallback_rung_histogram (the ladder exposes no rung numbers yet).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Triage

Development

Successfully merging this pull request may close these issues.

1 participant