Skip to content

feat(integrity): per-bench expected_n + sample-health badge - #629

Closed
Flotapponnier wants to merge 1 commit into
mainfrom
feat/lowsample-badge-main
Closed

feat(integrity): per-bench expected_n + sample-health badge#629
Flotapponnier wants to merge 1 commit into
mainfrom
feat/lowsample-badge-main

Conversation

@Flotapponnier

Copy link
Copy Markdown
Collaborator

Companion to #628 (same change, applied directly against main's
pre-refactor structure because main and dev have diverged in the
materialize layer).

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 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 behave as before
(no badge, no hide).

YAMLs touched: oracle-deviation (4), perp-funding (3),
aggregator-head-lag (50000), bridge-quote-latency (3000),
bridge-fee (1000).

Test plan:

  • pnpm validate (26 specs on main, passes)
  • pnpm typecheck (clean)
  • pnpm build (succeeds)
  • bun test src/lib (56/56 pass, includes sample-health.test.ts)

@Flotapponnier

Copy link
Copy Markdown
CollaboratorAuthor

Conflicts with #627 (insufficient propagate, already merged to main). Main already serves the integrity story via isInsufficient on /api/stat /api/citable /api/llm-context /api/mcp + bench card pill + home table pill. The low-sample BADGE UI added by this PR is a refinement on top, not critical. Will rebase and ship in a follow-up if needed, or via a future wholesale dev to main merge. Dev has the badge live via #628.

@Flotapponnier
Flotapponnier deleted the feat/lowsample-badge-main branch July 17, 2026 14:42
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

@Flotapponnier