Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
d6be52d
chore(quest): claim quest/m0/ci/local-gate.md
kixelated Oct 22, 2026
ee0fe08
ci: share local check capacity across worktrees
kixelated Oct 22, 2026
8711acd
Merge remote-tracking branch 'origin/main' into quest/m0/ci/local-gate
kixelated Oct 22, 2026
765230e
quest: retire local check admission
kixelated Oct 22, 2026
c51900d
fix(sh): adopt orphans so cancellation reaches the whole tree
kixelated Oct 22, 2026
99d893b
Merge remote-tracking branch 'origin/main' into quest/m0/ci/local-gate
kixelated Oct 22, 2026
0055d9f
Merge remote-tracking branch 'origin/main' into fix-6256
kixelated Oct 23, 2026
eabf885
Merge remote-tracking branch 'origin/main' into merge-6256
kixelated Oct 23, 2026
f6930b7
fix(bench): run every checkout solo and alternate run order
kixelated Oct 23, 2026
cd49537
Merge remote-tracking branch 'origin/main' into merge-6256
kixelated Oct 24, 2026
e46cb21
Merge remote-tracking branch 'origin/main' into HEAD
kixelated Oct 24, 2026
4cb4700
docs(bench): drop a doubled blank line left by the main merge
kixelated Oct 24, 2026
fc8d17b
Merge remote-tracking branch 'origin/main' into HEAD
kixelated Oct 24, 2026
d5e9e8e
Merge remote-tracking branch 'origin/main' into HEAD
kixelated Oct 24, 2026
53cb206
bench: sweep check lanes in bench-local
kixelated Oct 24, 2026
fca1ec1
test: keep tooling tests out of the host gate
kixelated Oct 24, 2026
53fef2c
docs: name the check lanes beside admission
kixelated Oct 24, 2026
a5bfae7
Merge remote-tracking branch 'origin/main' into HEAD
kixelated Oct 24, 2026
217d8d7
bench: record the lane count bench-local actually ran
kixelated Oct 24, 2026
b4c4746
Merge remote-tracking branch 'origin/main' into HEAD
kixelated Oct 24, 2026
66dd38d
ci: re-exec select.sh by root-relative paths
kixelated Oct 25, 2026
7588b93
Merge remote-tracking branch 'origin/main' into local-gate-merge
kixelated Oct 25, 2026
7afe014
Merge remote-tracking branch 'origin/main' into quest/m0/ci/local-gate
kixelated Oct 25, 2026
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
3 changes: 2 additions & 1 deletion .github/justfile
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ runner-vm-ci:

# Build and test the persistent NixOS runner VM on x86_64 Linux.
runner-vm:
nix build --no-link .#checks.x86_64-linux.github-runner-vm .#checks.x86_64-linux.github-runner-vm-image .#checks.x86_64-linux.github-runner-vm-config --print-build-logs
bash sh/local.sh nix build --no-link .#checks.x86_64-linux.github-runner-vm .#checks.x86_64-linux.github-runner-vm-image .#checks.x86_64-linux.github-runner-vm-config --print-build-logs

# Lint GitHub Actions workflows, their alert coverage, and that every step runs a recipe.
check:
Expand All @@ -31,6 +31,7 @@ check:

# Tests of repository tooling; every `just check` and `just ci` runs them.
test:
python3 sh/local.test.py
python3 test/smoke/runner.test.py
python3 sh/coverage.test.py
python3 sh/size/report.test.py
Expand Down
15 changes: 15 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,21 @@ just check --all
just fix --all
```

Expensive checks and test launchers automatically enter `quest gate` locally,
including direct language recipes and fixture scripts. Admission waits for host
CPU load and available memory before builds or test timeout clocks start;
nested checks reuse that admission. Hosted GitHub Actions keeps its runner
scheduling. Rust builds still use the dev shell's mbx Cargo shim.

`just check` and `just ci` run three module lanes at once, each admitted per
command; set `MOQ_CHECK_JOBS` to change that, or to 1 to run them in order.
Local nextest runs default to at most four test workers; set
`NEXTEST_TEST_THREADS` to override it. Bun workspace scripts run sequentially
locally, preserving dependency order, while CI keeps its workspace parallelism.
Selection and an empty JS selection do not wait for admission. For a build
outside these entrypoints, use `quest gate COMMAND [ARGS...]`; gate thresholds
come from the host and have no configuration.

PRs into `main` get no cloud CI until the merge queue, so run `just ci` before pushing. It runs what the queue runs, the same ground as `just check`, plus two settings: `MOQ_STRICT=1`, which turns a missing tool into an error instead of a skipped check, and `NEXTEST_PROFILE=ci`, which allows a longer hang timeout.

See the [development guide](https://doc.moq.dev/setup/dev) and the [justfile](justfile) for more.
Expand Down
20 changes: 20 additions & 0 deletions bench/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -491,3 +491,23 @@ nix develop --command just gh benchmark-report gate target/bench/nightly/rust-be
Each run's evidence directory keeps both builds' estimates (`criterion` and
`criterion-base`), the confirmation rounds under `confirm/`, and the run's
`paired.json`.

## Local check capacity

Prepare the same warm dependencies and artifacts in each isolated checkout, then
compare solo and concurrent suites with their actual worker counts:

```bash
just bench-local --checkout "$PWD" --checkout /path/to/another/checkout \
--workers 1 4 8 24 --samples 3 --cache warm -- \
cargo nextest run --locked -p moq-net --lib
```

Each JSON record retains host load, configured workers and lanes, admission
delay, work wall time, total wall time, and child CPU time. Logs stay under each
checkout's `.scratch/local-bench/`. To compare Bun workspace fanout, repeat with
the same `bun run --filter=... test` command, then add `--sequential`. To compare
the module lanes `just check` runs at once, sweep `--jobs 1 3` over
`bash sh/dispatch.sh check BASE`, which is then admitted once as a whole.
Admission remains outside the suite's timeout clocks. Use separate checkouts to
avoid measuring Cargo's artifact lock instead of competing work.
94 changes: 94 additions & 0 deletions bench/local.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
#!/usr/bin/env python3
"""Compare suite fanout across isolated checkouts, separating admission from work."""

import argparse
import json
import os
from pathlib import Path
import subprocess
import signal
import sys
import time
import uuid


ROOT = Path(__file__).resolve().parents[1]


def main():
if sys.argv[1:2] == ["--started"]:
started = time.monotonic()
result = subprocess.run(sys.argv[3:])
Path(sys.argv[2]).write_text(json.dumps({"start": started, "end": time.monotonic()}))
sys.exit(result.returncode)
parser = argparse.ArgumentParser(description=__doc__)
parser.add_argument("--checkout", action="append", type=Path, required=True)
parser.add_argument("--workers", nargs="+", type=int, required=True)
parser.add_argument("--jobs", nargs="+", type=int, help="MOQ_CHECK_JOBS lane counts to sweep")
parser.add_argument("--samples", type=int, default=3)
parser.add_argument("--cache", required=True, help="Describe the prepared cache state")
parser.add_argument("command", nargs=argparse.REMAINDER)
args = parser.parse_args()
command = args.command[1:] if args.command[:1] == ["--"] else args.command
if not command or args.samples < 1 or any(n < 1 for n in args.workers + (args.jobs or [])):
parser.error("a command, positive samples and positive worker and job counts are required")
if os.name != "posix":
parser.error("CPU accounting requires a POSIX host")
checkouts = [checkout.resolve() for checkout in args.checkout]
if not all(checkout.is_dir() for checkout in checkouts) or len(set(checkouts)) != len(checkouts):
parser.error("each checkout must be a distinct existing directory")
# Every checkout runs solo, so a concurrent run is compared against its own baseline.
groups = [[checkout] for checkout in checkouts] + ([checkouts] if len(checkouts) > 1 else [])
def cancel(number, _frame):
raise SystemExit(128 + number)
for number in (signal.SIGTERM, signal.SIGHUP):
signal.signal(number, cancel)
# Alternating the order spreads drift in host load or thermals over solo and concurrent runs.
for sample in range(args.samples):
for group in groups if sample % 2 == 0 else reversed(groups):
for workers, jobs in ((w, j) for w in args.workers for j in args.jobs or [None]):
processes = []
load = os.getloadavg()
try:
for checkout in group:
directory = checkout / ".scratch/local-bench"
directory.mkdir(parents=True, exist_ok=True)
Comment thread
coderabbitai[bot] marked this conversation as resolved.
Resolved
stem = directory / str(uuid.uuid4())
stamp = stem.with_suffix(".started")
with stem.with_suffix(".log").open("w") as log:
env = dict(os.environ, NEXTEST_TEST_THREADS=str(workers))
# Without --jobs, the record's null means sh/dispatch.sh's default.
env.pop("MOQ_CHECK_JOBS", None)
if jobs:
env["MOQ_CHECK_JOBS"] = str(jobs)
Comment thread
coderabbitai[bot] marked this conversation as resolved.
Resolved
env.pop("QUEST_GATE_ADMITTED", None)
env.pop("MOQ_LOCAL_SUPERVISED", None)
env.pop("GITHUB_ACTIONS", None)
began = time.monotonic()
process = subprocess.Popen(["bash", str(ROOT / "sh/local.sh"), sys.executable,
str(Path(__file__).resolve()), "--started", str(stamp),
*command], cwd=checkout, env=env, stdout=log, stderr=log)
processes.append((process, began, stamp))
results = []
for process, began, stamp in processes:
_, status, usage = os.wait4(process.pid, 0)
process.returncode = os.waitstatus_to_exitcode(status)
if process.returncode:
raise RuntimeError(f"command failed ({process.returncode}); see {stamp.with_suffix('.log')}")
timing = json.loads(stamp.read_text())
started, ended = timing["start"], timing["end"]
results.append({"admission_s": started - began, "work_s": ended - started,
"total_s": ended - began, "cpu_s": usage.ru_utime + usage.ru_stime})
finally:
for process, _, _ in processes:
if process.returncode is None:
process.terminate()
process.wait()
print(json.dumps({"copies": len(group), "checkouts": [str(checkout) for checkout in group],
"nextest_workers": workers, "check_jobs": jobs, "sample": sample,
"cache": args.cache, "host_load": load, "command": command,
"runs": results}), flush=True)


if __name__ == "__main__":
main()
2 changes: 1 addition & 1 deletion js/justfile
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ build:

# Build browser/WASM bindings into @moq/wasm using the pinned wasm-bindgen toolchain.
wasm PROFILE="wasm-release":
cargo build --locked -p moq-wasm --target wasm32-unknown-unknown --profile {{ PROFILE }}
bash ../sh/local.sh cargo build --locked -p moq-wasm --target wasm32-unknown-unknown --profile {{ PROFILE }}
wasm-bindgen --target web --out-name moq --out-dir wasm/dist "${CARGO_TARGET_DIR:-../target}/wasm32-unknown-unknown/{{ if PROFILE == "dev" { "debug" } else { PROFILE } }}/moq_wasm.wasm"

# Ensure the built public libraries can load without browser globals.
Expand Down
5 changes: 5 additions & 0 deletions justfile
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,11 @@ dev:
bench $BASE="":
bench/run.sh "$BASE"

# Compare admitted suites across checkouts and worker counts; see bench/README.md.
[positional-arguments]
bench-local *args:
python3 bench/local.py "$@"

# Benchmark selected wrappers against two Rust baselines on this machine.
[positional-arguments]
bench-ffi *runners:
Expand Down
6 changes: 3 additions & 3 deletions py/justfile
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ default:

# keeps uv from fetching moq-ffi off PyPI; maturin just installed it locally.
_develop *args:
cd .. && uv run --no-sync maturin develop --locked --uv {{ args }}
cd .. && bash sh/local.sh uv run --no-sync maturin develop --locked --uv {{ args }}
uv pip install --no-deps -e moq-rs

# Lint + format + editable build + pyright + doc samples + docs. `--no-install-workspace`
Expand Down Expand Up @@ -60,7 +60,7 @@ fix:
test:
uv sync --locked --no-install-workspace
just _develop {{ test_features }}
uv run --no-sync pytest moq-rs/tests/ moq-ffi/tests/
bash ../sh/local.sh uv run --no-sync pytest moq-rs/tests/ moq-ffi/tests/

# Local dev build: editable install of moq-ffi (with the cdylib + uniffi

Expand All @@ -72,7 +72,7 @@ build:
# Run the binding benchmark's Python runner (see bench/README.md) on a release build.
bench:
uv sync --locked --no-install-workspace
cd .. && uv run --no-sync maturin develop --locked --uv --release
cd .. && bash sh/local.sh uv run --no-sync maturin develop --locked --uv --release
uv pip install --no-deps -e moq-rs
uv run --no-sync python moq-rs/benches/ffi.py

Expand Down
2 changes: 0 additions & 2 deletions quest/m0/ci/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,6 @@ The historical samples locate candidates; they are not controlled benchmarks.
## Required

- [Require the release gate](/quest/m0/ci/release-gates.md) - condition: the next cut carries `release-gate.yml`; then release PRs require it
- [Share local check capacity](/quest/m0/ci/local-gate.md) - gate expensive phases and bound internal fanout
- [select.sh launcher path](/quest/m0/ci/select-launcher-path.md) - `sh/rs/select.sh` runs from a subdirectory by resolving its launcher before `cd`
- [Build queue entries concurrently](/quest/m0/ci/queue-concurrency.md) - the queue builds two or more entries at once instead of one
- [Check the bindings in separate lanes](/quest/m0/ci/ffi-lane.md) - py, kt, swift, go, carla, and cpp check concurrently instead of in one serial lane
- [Measure nightly compiler levers](/quest/m0/ci/nightly-levers.md) - the parallel frontend and Cranelift, adopted only if the numbers beat their risks
Expand Down
4 changes: 0 additions & 4 deletions quest/m0/ci/ffi-lane.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,3 @@ than measure first or drop py's test features.
fresh, which any concurrent Cargo build of moq-ffi would break.
- Measure the full-run wall time and peak disk before and after on matched
inputs: concurrent lanes add their temporary data together.

## Related

- [Share local check capacity](/quest/m0/ci/local-gate.md) - bounds the fanout these lanes add
26 changes: 0 additions & 26 deletions quest/m0/ci/local-gate.md

This file was deleted.

6 changes: 2 additions & 4 deletions quest/m0/ci/queue-concurrency.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,7 @@ with a median entry of 135 s (p90 516 s) and 3 to 12 s of runner wait.
- Concurrent entries share the local mbx store; confirm that is safe, or give
each its own.
- Measure merged PRs per hour and per-entry wall time before and after.
- Queue entries skip `quest gate`: `sh/local.sh` execs directly under GitHub
Actions, so the runner quota, not admission, has to keep entries apart.

Public API: none. Wire: none.

## Related

- [Share local check capacity](/quest/m0/ci/local-gate.md) - admission for the same host
16 changes: 0 additions & 16 deletions quest/m0/ci/select-launcher-path.md

This file was deleted.

Loading
Loading