Skip to content

feat(conformance): cost_bodies suite with self-relative scan-cost ceilings - #77

Merged
rennf93 merged 1 commit into
masterfrom
feat/cost-parity-corpus
Oct 5, 2026
Merged

rennf93 merged 1 commit into
masterfrom
feat/cost-parity-corpus

Conversation

@rennf93

@rennf93 rennf93 commented Oct 5, 2026

Copy link
Copy Markdown
Owner

Part of the cross-engine cost-parity program: the same 9-case cost_bodies corpus suite now runs in all five engines (Python reference, Go, TS, PHP, Rust), enforcing two invariants per push:

  1. Verdict parity on large bodies (inputs crossing the 256 KiB truncation cap, attacks in head/tail/mid positions) - reference-generated expectations, standard detect comparison.
  2. Scan-cost ceilings, self-relative per the method block in index.json: each run anchors on its own best-of-N at the 8 KiB workload; every other workload must stay under 5x its linear projection + 250 ms. Host-proof, catches superlinearity.

Measured here: 3.4 ms @ 8 KiB, 36.3 ms @ 256 KiB, 105.7 ms @ 1 MiB.

Reviewer notes:

  • The corpus was grafted onto the shipped 4.3.0-generation index because the upstream generator (Python repo, specs/fixtures/tools) currently emits 4.2.0-generation files; the cost suite header is bumped to match the shipped generation. Worth reconciling generations in a follow-up.
  • The conformance lib tests require the pattern-probe child binary: cargo build -p guard-core-engine --bins before cargo test -p guard-core-conformance --lib. CI builds all bins already.
  • The 8 KiB-cost anchor case doubles as the reference point for the family-wide parity statement (see prest#1044 discussion for the Go engine's pre-fix numbers).

Local gates: cargo test -p guard-core-conformance --lib 78/78 green (with probe built), cost runner green, clippy/fmt untouched files only.

@github-actions github-actions Bot added benchmarks Criterion benches, fuzz targets, performance comparisons area: conformance Touches the spec 4.0.2 corpus, ledger, or xfail baseline labels Oct 5, 2026
@rennf93
rennf93 force-pushed the feat/cost-parity-corpus branch 3 times, most recently from ee84873 to 40ac14a Compare October 5, 2026 10:52
@rennf93 rennf93 added the no-issue Chore or dependency PR that does not need an issue label Oct 5, 2026
@rennf93
rennf93 force-pushed the feat/cost-parity-corpus branch 5 times, most recently from 431a436 to 7026424 Compare October 5, 2026 12:16
…lings

Adds the 9-case cost_bodies corpus suite (large-body verdict parity
across the truncation cap, reference-generated expectations) and a
cost-budget runner enforcing self-relative scan-cost ceilings: each run
anchors on its own best-of-N at the 8 KiB workload and every other
workload must stay under 5x its linear projection + 250 ms, so gross
superlinearity fails CI on any host while fixed overhead and host speed
stay tolerated.

The corpus was grafted onto the shipped 4.3.0-generation index (the
upstream corpus generator currently emits 4.2.0-generation files; the
suite header here is bumped to match the shipped generation).

Measured on this host: 3.4 ms at 8 KiB, 36.3 ms at 256 KiB, 105.7 ms at
1 MiB - all far under ceiling.

Also includes a guard-core-benchmark example reproducing the numbers.

Note: the conformance lib tests require the pattern-probe child binary;
build it for the active profile first (cargo build -p guard-core-engine
--bins).
@rennf93
rennf93 force-pushed the feat/cost-parity-corpus branch from 7026424 to 002ec41 Compare October 5, 2026 12:16
@rennf93
rennf93 merged commit 60a78b0 into master Oct 5, 2026
19 checks passed
@rennf93
rennf93 deleted the feat/cost-parity-corpus branch October 5, 2026 19:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: conformance Touches the spec 4.0.2 corpus, ledger, or xfail baseline benchmarks Criterion benches, fuzz targets, performance comparisons no-issue Chore or dependency PR that does not need an issue

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant