feat(bench): benchmark targets, baselines and regression gates (G1, G8)
VoidBuildSystem CI / 3A · Linux test (relwithdebinfo) (push) Failing after 6m43s
VoidBuildSystem CI / 3A · Linux test (debug) (push) Failing after 6m49s
VoidBuildSystem CI / 4A2 · VBS installers (linux target) (push) Skipped
VoidBuildSystem CI / 4A2 · VBS installers (windows target) (push) Skipped
VoidBuildSystem CI / 5 · Release (push) Skipped
VoidBuildSystem CI / 1 · Requirements (push) Successful in 7s
VoidBuildSystem CI / 2A · Linux build (debug) (push) Successful in 2m16s
VoidBuildSystem CI / 2A · Linux build (coverage) (push) Successful in 2m22s
VoidBuildSystem CI / 2A · Linux build (sanitizers) (push) Successful in 3m49s
VoidBuildSystem CI / 2B · Windows Wine build (debug) (push) Successful in 2m1s
VoidBuildSystem CI / 2A · Linux build (relwithdebinfo) (push) Successful in 4m46s
VoidBuildSystem CI / 2B · Windows Wine build (relwithdebinfo) (push) Successful in 3m16s
VoidBuildSystem CI / 3B · Windows Wine test (debug) (push) Successful in 18s
VoidBuildSystem CI / 3A · Linux test (coverage) (push) Failing after 1m4s
VoidBuildSystem CI / 3A · Linux test (sanitizers) (push) Successful in 1m4s
VoidBuildSystem CI / 3B · Windows Wine test (relwithdebinfo) (push) Successful in 17s

- p.benchmark(name) adds the `benchmark` target kind, built and linked
  like an executable (graph lowering, compdb, IDE runnables and the
  installer default destination all handle it).
- vbs bench builds only the benchmark targets (or the --target subset),
  runs each binary --samples times (default 3) with VBS_BENCH=1, keeps the
  best wall-clock time, and compares against --baseline
  (default <build>/.vbs/bench_baseline.json) with --max-regression PCT
  (default 5). The first run records the baseline; --update-baseline
  rewrites it while merging entries for benchmarks not selected.
- Baselines carry os/architecture/compiler/profile; comparison across
  machines warns and skips the gate instead of failing noisy CI.
- --json FILE writes a schema-versioned results document (per-benchmark
  status, samples, baseline, regression percent).
- vbs metadata bumps to schema v2 (new `benchmark` kind, corrected
  `header_only` enum); metadata-v1.schema.json is retained per the
  schema versioning rule, and the schema test fixture now declares a
  benchmark target.

Verified: bench_records_baseline_and_enforces_regression_gate covers
recording, passing, crafted-slow/fast baselines, JSON results,
--update-baseline, machine mismatch, no-benchmark and invalid options;
the schema test passes against v2; vbs_core_tests 8/8; CLI contracts
pass; clang-format clean.
This commit is contained in:
faumaray committed 2026-12-06 20:37:33 +03:00
1 parent f1cf277847
commit 7365279cf3
16 files changed
+921 -25

No files matched your search

+1
View File
@@ -402,6 +402,7 @@ Stage: VERIFIED — Plans 01–19 + Plan 20 Slices 1–2C + Track A + Track B (B
## Remaining future scope
- **Wave 153 (Versioned JSON contracts, G6 start)**: `schemas/` publishes JSON Schemas for `vbs metadata` (`metadata-v1.schema.json`), `vbs describe` (`describe-v1.schema.json`) and `vbs explain --format json` (`explain-v1.schema.json`), all with `additionalProperties: false`; `schemas/README.md` states the versioning rule (a shape change bumps `schema_version` and adds a new `-vN` file, older schemas stay). `vbs describe` now emits a StrictJson graph summary (`schema_version`, roots, profile/compiler/os/arch, counts, target/dependency names) and `vbs explain --format json` carries `schema_version`. `FullV1Tests.json_schemas_validate_metadata_describe_and_explain` validates the emitted documents against the files and proves the validator rejects missing required keys, wrong enums and unexpected properties.
- **Wave 154 (Benchmark targets and regression gates, G1/G8)**: `p.benchmark(name)` adds the `benchmark` target kind (built and linked like an executable). `vbs bench` builds only the benchmark targets (or the `--target` subset), runs each binary `--samples` times (default 3) with `VBS_BENCH=1` and `--max-regression PCT` (default 5), keeps the best wall-clock time per target, and compares against `--baseline FILE` (default `<build>/.vbs/bench_baseline.json`). The first run records the baseline; `--update-baseline` rewrites it (merging unselected entries). Baselines carry os/architecture/compiler/profile and are not compared across machines (warning, gate skipped). `--json FILE` writes a schema-versioned results document (status per benchmark, regression percent, samples). Regressions fail the command. `vbs metadata` bumped to schema v2 (adds the `benchmark` kind and fixes the `header_only` enum), with `metadata-v1.schema.json` retained. Verified by `FullV1Tests.bench_records_baseline_and_enforces_regression_gate` (record, pass, crafted slow/fast baselines, JSON, update, machine mismatch, no-benchmark and invalid-option cases) and the schema test now covers a benchmark target.
- **Wave 152 (Test depth and fuzzing, G8)**: `vbs doctest` extracts fenced C++ blocks from `///`, `//!` and Doxygen comment blocks, compiles each as the body of `main()` with `#line` mapping (so errors point at the header), links optional `--source` files and reports block pass/fail. The test runner gained `--shard I/N` (fixture-aware clustering, greedy balancing by the previous run's recorded timings in `<build>/.vbs/test_timings.json`), `--rerun-failed` (reads `<build>/.vbs/last_failed_tests.json` and re-runs only the failed closure), `--known-flaky FILE` (flaky failures are reported but do not fail the run) and coverage gates `--coverage-min PCT` / `--coverage-diff BASE` (lcov summary comparison). `vbs fuzz` builds a libFuzzer target with clang (`-fsanitize=fuzzer,address,undefined`), runs it over a corpus and reports crash artifacts. Verified by `doctest_extracts_compiles_and_runs_blocks`, `test_sharding_partitions_tests_and_records_timings`, `test_rerun_failed_and_known_flaky`, `coverage_gates_enforce_minimum_and_baseline` and `fuzz_builds_targets_and_reports_crashes`.
+2 -1
View File
@@ -43,7 +43,7 @@ Base HEAD: `fe0d1a6`
| Wave 34 (Editor status request) | `editor_status` daemon request + `vbs daemon ide status`: selection state, compdb existence/entry count | COMPLETE & VERIFIED (GCC 16.2, pin `0002e74`; Daemon 14/14, full CTest 8/8) | `src/Daemon/Daemon.cpp`, `src/Main.cpp`, `tests/DaemonTests.cpp`, `tests/CliContracts.cmake`, docs |
| Wave 35 (Daemon compdb use) | `compdb_use` daemon request + `vbs daemon compdb use --profile`: switches the active editor profile under the selection lock | COMPLETE & VERIFIED (GCC 16.2, pin `0002e74`; Daemon 15/15, full CTest 8/8) | `src/Daemon/Daemon.cpp`, `src/Main.cpp`, `tests/DaemonTests.cpp`, `tests/CliContracts.cmake`, docs |
| Wave 36 (Registry binary-variant yank) | `POST .../binaries/<variant>/yank`, persisted `yanked` flag in detail JSON, client filters yanked variants | COMPLETE & VERIFIED (GCC 16.2, pin `0002e74`; Registry suite 6/6, full CTest 8/8) | `registry/include/Void/Build/Registry/RegistryService.hpp`, `registry/service/RegistryService.cpp`, `include/Void/Build/Package/RegistryClient.hpp`, `src/Package/RegistryClient.cpp`, `tests/RegistryTests.cpp`, docs |
| Wave 37 (Daemon graph export) | `graph` daemon request + `vbs daemon graph --format dot|json --member`: target dependency graph in a JSON envelope | COMPLETE & VERIFIED (GCC 16.2, pin `0002e74`; Daemon 16/16, full CTest 8/8) | `src/Daemon/Daemon.cpp`, `src/Main.cpp`, `tests/DaemonTests.cpp`, `tests/CliContracts.cmake`, docs |
| Wave 37 (Daemon graph export) | `graph` daemon request + `vbs daemon graph --format dot\|json --member`: target dependency graph in a JSON envelope | COMPLETE & VERIFIED (GCC 16.2, pin `0002e74`; Daemon 16/16, full CTest 8/8) | `src/Daemon/Daemon.cpp`, `src/Main.cpp`, `tests/DaemonTests.cpp`, `tests/CliContracts.cmake`, docs |
| Wave 38 (Daemon test request) | `test` daemon request + `vbs daemon test`: builds, runs declared test targets with bounded output, reports pass/fail counts | COMPLETE & VERIFIED (GCC 16.2, pin `0002e74`; Daemon 17/17, full CTest 8/8) | `src/Daemon/Daemon.cpp`, `src/Main.cpp`, `tests/DaemonTests.cpp`, `tests/CliContracts.cmake`, docs |
| Wave 39 (Compdb entries query) | `compdb_entries` daemon request + `vbs daemon compdb entries --file --limit`: bounded projected entries from the active compdb | COMPLETE & VERIFIED (GCC 16.2, pin `0002e74`; Daemon 18/18, full CTest 8/8) | `src/Daemon/Daemon.cpp`, `src/Main.cpp`, `tests/DaemonTests.cpp`, `tests/CliContracts.cmake`, docs |
| Wave 40 (Authenticated binary downloads) | `download_binary_artifact` bearer auth, `BinaryFetchOptions::bearer_token`, `vbs binaries fetch` token | COMPLETE & VERIFIED (GCC 16.2, pin `0002e74`; Registry 7/7, full CTest 8/8) | `include/Void/Build/Package/{RegistryClient,Fetch}.hpp`, `src/Package/{RegistryClient,Fetch}.cpp`, `src/Main.cpp`, `tests/RegistryTests.cpp`, docs |
@@ -153,4 +153,5 @@ Base HEAD: `fe0d1a6`
| Wave 151 (Profiles + toolchain pinning) | `Dependency::profile` overrides for native dependency builds (hash-aware), `vbs-toolchain.toml` pin + drift detection (`--locked-toolchain`, `strict`), `vbs profile list\|show\|diff` | COMPLETE & VERIFIED (GCC 16.2; the three G3 tests pass; CLI contracts pass) | `include/Void/Build.hpp`, `sdk/Build.cpp`, `src/Graph/Graph.cpp`, `src/Provider/Provider.cpp`, `include/Void/Build/Toolchain/Pin.hpp`, `src/Toolchain/Pin.cpp`, `src/Main.cpp`, `tests/{FullV1Tests,CliContracts}`, docs |
| Wave 152 (Test depth + fuzzing) | `vbs doctest` (fenced blocks, `#line` diagnostics, `--source`), `--shard I/N` + timings, `--rerun-failed`, `--known-flaky`, `--coverage-min`/`--coverage-diff`, `vbs fuzz` (libFuzzer) | COMPLETE & VERIFIED (GCC 16.2; doctest/sharding/rerun/coverage tests pass; fuzz test passes under clang 23; CLI contracts pass) | `include/Void/Build/Test/Doctest.hpp`, `src/Test/Doctest.cpp`, `include/Void/Build/Test/Fuzz.hpp`, `src/Test/Fuzz.cpp`, `include/Void/Build/Report/Coverage.hpp`, `src/Report/Coverage.cpp`, `src/Main.cpp`, `tests/{FullV1Tests,CliContracts}`, docs |
| Wave 153 (Versioned JSON contracts) | `schemas/{metadata,describe,explain}-v1.schema.json` + versioning rule, `vbs describe` StrictJson graph summary, `vbs explain --format json` schema_version, schema validation test with negative cases | COMPLETE & VERIFIED (GCC 16.2; `json_schemas_validate_metadata_describe_and_explain` passes; vbs_core_tests and CLI contracts pass) | `schemas/`, `src/Main.cpp`, `tests/FullV1Tests.cpp`, docs |
| Wave 154 (Benchmarks + regression gates) | `p.benchmark(name)` target kind, `vbs bench` (build benchmark targets, N samples, `VBS_BENCH=1`), baseline persistence, `--baseline`/`--max-regression`/`--samples`/`--update-baseline`/`--json FILE`, machine-mismatch gate skip, metadata schema v2 (`benchmark` kind, `header_only` fix) | COMPLETE & VERIFIED (GCC 16.2; `bench_records_baseline_and_enforces_regression_gate` and the schema test pass; vbs_core_tests and CLI contracts pass) | `include/Void/Build/Bench/Bench.hpp`, `src/Bench/Bench.cpp`, `include/Void/Build.hpp`, `sdk/Build.cpp`, `src/Graph/Graph.cpp`, `src/Editor/CompDb.cpp`, `src/Install/Installer.cpp`, `src/Main.cpp`, `schemas/`, `tests/{FullV1Tests,CliContracts}`, docs |
| Future (Plans 23–24) | Gap closure and superiority tracks | PLANNED (see the plans for per-track acceptance gates) | [23-remaining-upgrade-plan.md](../roadmap/23-remaining-upgrade-plan.md), [24-superiority-tracks.md](../roadmap/24-superiority-tracks.md) |
+16 -10
View File
@@ -109,8 +109,8 @@ the concrete acceptance gate.
### G1 — Cargo-grade lifecycle CLI *(S–M per command)*
**Status: partially implemented (Wave 147).** Done: `new`, `run`, `metadata`, `why`, `add`,
`remove`, `tree`, `fmt`, `lint`, `audit`, `install-binary`, `--frozen`. Pending: `bench`, `doc`,
**Status: partially implemented (Wave 154).** Done: `new`, `run`, `metadata`, `why`, `add`,
`remove`, `tree`, `fmt`, `lint`, `audit`, `install-binary`, `bench`, `--frozen`. Pending: `doc`,
`outdated`, `update -p`, `deny`, `vendor`.
**Beats:** Cargo (parity), CMake/Meson/build2 (they have no unified lifecycle).
@@ -141,6 +141,10 @@ the concrete acceptance gate.
`vbs.json`-free design (all in `build.cpp`).
3. Benchmark target kind (`p.benchmark(name)`) plus result parsing (Google Benchmark JSON,
`nanobench`, custom `VBS_BENCH` output) and baseline comparison with tolerance.
**Done (Wave 154):** the `benchmark` target kind, wall-clock samples (`VBS_BENCH=1` is set),
a persisted baseline (`<build>/.vbs/bench_baseline.json`), `--baseline`, `--max-regression`,
`--samples`, `--update-baseline` and `--json FILE`. Structured harness parsing (Google
Benchmark/nanobench) is still pending; wall-clock best-of-N is the current metric.
4. `doc`/`fmt`/`lint` as orchestrated action graphs (so they are cached and parallel), not shell
wrappers; `--changed-only` uses the graph's changed inputs.
5. `vendor` reuses the CAS: copy blobs into `vendor/<sha256>` and rewrite `vbs.lock` sources.
@@ -326,11 +330,12 @@ policy violation exits non-zero in CI.
**Status: partially implemented (Wave 153).** Done: item 1's `vbs metadata` workspace
document (targets, dependencies, features, lockfile, roots) and item 2's published
`schemas/{metadata,describe,explain}-v1.schema.json` with the versioning rule and a
compatibility test (`FullV1Tests.json_schemas_validate_metadata_describe_and_explain`);
`vbs describe` is now a StrictJson graph summary with `schema_version`. Pending: `graph`,
`trace`, `bep`, `doctor` and daemon schemas, the DAP server, the LSP-status request and the
plugin protocol.
`schemas/{metadata-v2,metadata-v1,describe-v1,explain-v1}.schema.json` with the versioning rule
and a compatibility test
(`FullV1Tests.json_schemas_validate_metadata_describe_and_explain`); `vbs describe` is now a
StrictJson graph summary with `schema_version`. Metadata v2 adds the `benchmark` target kind
and corrects the kind enum; v1 is retained. Pending: `graph`, `trace`, `bep`, `doctor` and
daemon schemas, the DAP server, the LSP-status request and the plugin protocol.
**Beats:** Cargo (`metadata`), CMake (File API), Meson (introspect) — VBS can expose a single,
versioned, cross-cutting model.
@@ -401,9 +406,10 @@ registry and lists the same action count; `cache stats` matches the report count
**Status: partially implemented (Wave 152).** Done: doctests (`vbs doctest`), sharding with
duration-aware partitioning (`vbs test --shard I/N`), `--rerun-failed`, `--known-flaky`,
coverage gates (`--coverage-min`, `--coverage-diff`) and `vbs fuzz` over libFuzzer targets.
Pending: benchmark regression gates (G1 `bench`), AFL support, coverage diff at line level
(currently summary-level), and benchmark result storage.
coverage gates (`--coverage-min`, `--coverage-diff`), `vbs fuzz` over libFuzzer targets and the
benchmark regression gate (`vbs bench --baseline/--max-regression`, baseline storage and
`--json` results, Wave 154). Pending: AFL support, line-level coverage diff and structured
benchmark harness parsing (Google Benchmark/nanobench).
**Beats:** CTest (no doctests, no impact analysis), Cargo (no sharding in stable, no coverage
gates), everyone (no benchmark regression gate built in).