Generated: 2026-02-28T06:53:00Z
Bead: asupersync-umelq.13.1
Depends on: asupersync-umelq.18.1
Purpose: define hard, CI-enforceable budgets for browser-targeted Asupersync artifacts and runtime behavior (size, init latency, steady-state memory, and critical-path p95 latency), with deterministic measurement rules.
These budgets are for the wasm browser program (asupersync-umelq.*) and do
not relax semantic invariants:
- Structured concurrency ownership is preserved (no orphan task/fiber flows).
- Cancellation remains
request -> drain -> finalize. - Obligation accounting remains commit-or-abort (no permit/ack/lease leaks).
- Region close still implies quiescence.
No optimization is valid if it violates any invariant above.
The program tracks three profiles:
core-min: semantic core for browser runtime without optional diagnostics.core-trace: core runtime plus deterministic trace/replay envelope.full-dev: browser developer profile with diagnostics and richer tooling.
All size budgets are tracked as both uncompressed .wasm bytes and gzip bytes.
| Metric ID | Metric | core-min |
core-trace |
full-dev |
Gate type |
|---|---|---|---|---|---|
M-PERF-01A |
wasm size (raw bytes) | <= 650 KiB | <= 900 KiB | <= 1300 KiB | hard fail |
M-PERF-01B |
wasm size (gzip bytes) | <= 220 KiB | <= 320 KiB | <= 480 KiB | hard fail |
M-PERF-02A |
cold init p95 (desktop Chromium baseline) | <= 60 ms | <= 85 ms | <= 130 ms | hard fail |
M-PERF-02B |
cold init p95 (mid-tier mobile baseline) | <= 160 ms | <= 220 ms | <= 320 ms | hard fail |
M-PERF-03A |
steady-state heap after warmup p95 | <= 24 MiB | <= 32 MiB | <= 48 MiB | hard fail |
M-PERF-03B |
cancellation response p95 (checkpoint to observable cancel) | <= 2.5 ms | <= 3.5 ms | <= 5.0 ms | hard fail |
| Metric ID | Metric | Target | Warn threshold | Hard threshold |
|---|---|---|---|---|
M-PERF-04A |
tx.reserve()+send() p95 (single producer/consumer harness) |
<= 8 us | > 8 us | > 12 us |
M-PERF-04B |
timeout arm+cancel p95 (timer wheel adapter harness) | <= 15 us | > 15 us | > 24 us |
M-PERF-04C |
scope.spawn()+join() p95 (small task body) |
<= 40 us | > 40 us | > 65 us |
M-PERF-04D |
deterministic replay load+step overhead vs baseline | <= +12% | > +12% | > +20% |
Policy:
- First breach in warn band marks CI warning and opens/links a bead.
- Two consecutive breaches in warn band escalate to hard fail.
- Any hard-threshold breach fails immediately.
Reference environments (pinned for trend stability):
desktop-chromium: Linux x86_64, pinned Chromium major version.desktop-firefox: Linux x86_64, pinned Firefox major version.mobile-android: mid-tier ARM Android device class via CI farm.
Each metric sample must include:
- git commit SHA
- profile (
core-min/core-trace/full-dev) - browser target + version
- seed/corpus ID
- command provenance (exact command line)
- artifact paths (wasm binary, traces, logs, summary JSON)
- Run each scenario with fixed seed set:
11, 29, 42, 73, 101. - For latency metrics, use at least 2000 iterations per seed.
- Compute per-seed p95, then report median-of-seed-p95 as gate value.
- Size metrics are single-sample deterministic per profile build.
- Memory metric samples after warmup window (
N=200operations) and then over fixed interval samples (N=500), reporting p95.
The CI gate emits a single JSON summary file:
- path:
artifacts/wasm_budget_summary.json - schema fields:
commitprofileenvironmentmetric_idvalueunitthreshold_warnthreshold_hardstatus(pass|warn|fail)seed_setcommandsartifact_paths
asupersync-umelq.13.2 and asupersync-umelq.13.3 must consume this schema
without format drift.
All cargo-heavy checks must be offloaded.
Current gating note (as of 2026-02-28):
wasm32-unknown-unknowncompilation forasupersyncremains preview-gated and still has unresolved native-surface imports on this branch.- CI should still run the preview command (below) and record the exact failure signature until the wasm profile-closure beads land.
- Native correctness/lint gates (
cargo check --all-targets,cargo clippy --all-targets -- -D warnings) remain mandatory hard gates.
Preview wasm compilation command (expected to become green as profile-closure work lands):
rch exec -- cargo check -p asupersync \
--target wasm32-unknown-unknown \
--no-default-features \
--features wasm-browser-preview,getrandom/wasm_js
rch exec -- cargo build -p asupersync \
--target wasm32-unknown-unknown \
--release \
--no-default-features \
--features wasm-browser-preview,getrandom/wasm_jsRecommended size capture:
# raw size
stat -c '%s' target/wasm32-unknown-unknown/release/asupersync.wasm
# gzip size
gzip -9 -c target/wasm32-unknown-unknown/release/asupersync.wasm | wc -cRecommended benchmark envelope (to be implemented by umelq.13.2):
rch exec -- cargo test -p asupersync --test wasm_perf_budget -- --nocaptureOptimization variants are now canonicalized in:
- policy:
.github/wasm_optimization_policy.json - validator:
scripts/check_wasm_optimization_policy.py - summary artifact:
artifacts/wasm_optimization_pipeline_summary.json
Profile mapping (must remain aligned with Section 2 budget profiles):
| Variant ID | Policy profile | Budget profile | Intent | Optimization posture |
|---|---|---|---|---|
dev |
wasm-browser-dev |
full-dev |
fast local debugging | low optimization, richer debug info, no wasm-opt |
canary |
wasm-browser-canary |
core-trace |
staging/canary signal quality | balanced -C opt-level=s + moderate wasm-opt passes |
release |
wasm-browser-release |
core-min |
production shipment | maximal size reduction (-C opt-level=z, LTO, aggressive wasm-opt) |
Contract rules:
- The optimization policy may tune compiler flags and
wasm-optpasses only. - Threshold values in Section 3/4 remain governance-controlled and cannot be changed by optimization-pipeline edits.
- Every profile must keep
wasm-browser-preview,getrandom/wasm_jsenabled and keep wasm-forbidden features disabled. - CI must validate policy shape and emit the summary artifact for downstream
gates (
13.5,18.5) even while wasm compilation remains preview-gated.
Deterministic validator commands:
python3 scripts/check_wasm_optimization_policy.py --self-test
python3 scripts/check_wasm_optimization_policy.py \
--policy .github/wasm_optimization_policy.jsonRepresentative browser workload coverage is now canonicalized in:
- policy:
.github/wasm_benchmark_corpus.json - validator:
scripts/check_wasm_benchmark_corpus.py - summary artifact:
artifacts/wasm_benchmark_corpus_summary.json
The corpus contract maps scenarios to explicit user journeys and budget metrics:
- Framework coverage:
vanilla-js,typescript-sdk,react,nextjs. - Workload coverage:
cold-start,steady-throughput,cancellation-storm,streaming-io,memory-pressure. - Deterministic seed set (per scenario):
11, 29, 42, 73, 101. - Metric mapping must use the budget metric IDs defined in this document
(
M-PERF-01*throughM-PERF-04*). - Scenario commands must use the canonical perf runner envelope:
rch exec -- ./scripts/run_perf_e2e.sh ...
CI policy:
- Validate corpus schema + coverage and emit summary artifact.
- Treat missing framework/workload/browser coverage as a gate failure.
- Keep summary schema stable for downstream gates (
13.4,13.5,15.1).
Deterministic validator commands:
python3 scripts/check_wasm_benchmark_corpus.py --self-test
python3 scripts/check_wasm_benchmark_corpus.py \
--policy .github/wasm_benchmark_corpus.jsonAutomated regression detection is now enforced via:
- budget policy:
.github/wasm_perf_budgets.json - gate script:
scripts/check_perf_regression.py - report artifact:
artifacts/wasm_perf_regression_report.json - event log:
artifacts/wasm_perf_gate_events.ndjson
Gate logic:
- Hard budget checks (Section 3): Any measurement exceeding the profile threshold triggers immediate CI failure.
- Operational budget checks (Section 4): First breach in warn band emits warning. Two consecutive breaches escalate to hard failure.
- Baseline regression detection: Compares current benchmark run against
baselines/baseline_latest.json. Any benchmark regressing beyondmax_regression_pct(default 10%) triggers CI failure.
The gate runs in the check CI job after benchmark corpus validation. The
bundle-size slice is now fail-closed, while non-size metrics may still report
skip until the broader measurement pipeline is wired.
asupersync-3qv04.6.7.1 tightens the bundle-size slice of this gate. The check
job must build the wasm-browser-prod release artifact, emit
artifacts/wasm_budget_summary.json, and require both bundle-size metrics
before evaluating thresholds.
Fail-closed size rule:
M-PERF-01AandM-PERF-01Bmust be present in the measurements payload.- Missing raw/gzip size metrics is a policy error, not a silent
skip. - Other non-size metrics may still report
skipuntil the broader browser latency/memory measurement pipeline is wired.
Deterministic validator commands:
python3 scripts/check_perf_regression.py --self-test
python3 scripts/check_perf_regression.py \
--budgets .github/wasm_perf_budgets.json \
--profile core-min \
--measurements artifacts/wasm_budget_summary.json \
--require-metric M-PERF-01A \
--require-metric M-PERF-01BWith baseline comparison:
python3 scripts/check_perf_regression.py \
--budgets .github/wasm_perf_budgets.json \
--baseline baselines/baseline_latest.json \
--current baselines/baseline_current.jsoncore-minbudget targets CDN-friendly first payloads while leaving room for explicit capability and cancellation semantics.core-traceallows deterministic replay metadata overhead without enabling unbounded growth.full-devbudgets preserve a practical local-debug profile while forcing tool/diagnostic bloat discipline.- Mobile thresholds are intentionally stricter than "it works eventually" to keep browser adoption viable for real production interfaces.
This budget contract is an input artifact for:
asupersync-umelq.13.2(benchmark corpus/scenario design): must map each scenario to one or more metric IDs above.asupersync-umelq.13.3(optimization pipeline): may tune compilers and artifact variants but cannot alter thresholds without governance update.asupersync-umelq.13.5(continuous perf regression gate): enforces hard/ operational budgets and baseline regression detection in CI.asupersync-umelq.18.4(CI verification pipelines): must enforce pass/fail semantics and artifact schema contract.
Threshold changes require:
- linked bead updating rationale and affected scenarios,
- before/after evidence bundle with the same seed set,
- governance approval note in the commit or bead thread.
Without all three, threshold changes are invalid.
- Budget thresholds explicitly defined (this document).
- Measurement protocol deterministic and reproducible.
- Command provenance contract defined for CI artifacts.
- Downstream integration points (
13.2,13.3,18.4) explicitly declared. - Release-blocking vs warning semantics defined.