feat(integrity): per-bench expected_n + sample-health badge - #628
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for freeto join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Bench pages currently rank providers based on sample counts that
vary from 3 to 1500+ per provider depending on the bench cadence,
without surfacing the confidence level. The methodology page
advertises n >= 1000 which is misleading on low-cadence benches
like oracle-deviation (3 to 4 samples per provider) and perp-funding
(3 samples per venue by design).
This change introduces a per-bench expected_n declared in the YAML
spec. The page computes health = actual / expected_n per provider
and badges rows below 50 percent of expected as "low sample" or
hides rankings below 10 percent as "insufficient". The bench-wide
aggregate (median of per-provider healths) also propagates to
/api/citable, /api/stat and the headline sentence so an "insufficient"
field stops asserting a winner in machine-readable feeds.
YAML field is optional. Benches without expected_n declared behave
as before (no badge, no hide).
YAMLs touched with expected_n:
counts distinct sources not data points)
sample_size query counts distinct asset series)
per provider summed by the sample_size query)
x 24h is ~3456, conservative)
x 24h is ~1152, conservative)
YAMLs left WITHOUT expected_n (cadence is heterogeneous or the
sample_size semantics differ per provider, no honest single value):
poll, blocks per chain differ by 1-2 orders of magnitude)
rollup bursts of 6-30s)
(coverage benches, sample_size is dimension count)
builder count not data point count)
Thresholds chosen: 0.5 (healthy), 0.1 (insufficient). See
src/lib/sample-health.ts.
Test plan:
sample-health.test.ts)
expect XRP/ADA/DOGE to read as healthy (3/4 = 75 percent) but the
badge surfaces once sources drop to 1 of 4.
(healthy across all 3 providers).
dataConfidence + expectedN fields in the JSON.