Skip to content

audit: statement data sanity gate — PR #26 weekly has hit_rate 0.0 with 2067 alerts and positive PnL #30

Description

@tkowalczyk

Evidence

Open PR #26 (lp-publish/weekly/2026-06-09-...) carries internally inconsistent data:

alert_count: 2067
hit_rate: 0.0
hypothetical_pnl_usd: 282.4999999999998
summary: poly-track weekly statement — 2067 alerts, hit rate 0.00.

A 0.00 hit rate across 2067 alerts with positive hypothetical PnL is impossible under the stated model (PnL = mirroring every alert; if every resolved alert missed, total PnL cannot be positive). Most likely the upstream resolution join produced 0 resolved alerts and 0/0 collapsed to 0. The schema (src/content/statement-schema.ts) happily accepts it — hit_rate: z.number().min(0).max(1).

Today this is fenced only by draft: true + human review. One distracted merge-and-flip and the site headline becomes "hit rate 0.00", which would be a credibility incident for a site whose entire product is credibility.

TDD plan (failing tests first)

Consumer-side cross-field sanity checks, as schema refinements or a separate statement-sanity.ts lint run over all non-draft entries (mirror statements.body.test.ts mechanics):

  1. Tests FIRST for a findDataInconsistencies(data): string[]:
    • alert_count > 0 && hit_rate === 0 && hypothetical_pnl_usd > 0 → inconsistent (the PR Add weekly statement for 2026-06-09 #26 case)
    • hit_rate > 0 && alert_count === 0 → inconsistent
    • monthly: net_usd !== revenue_usd + opex_usd (mind sign convention — decide whether opex is stored negative; current draft uses 0/0/0 so pick and document) → inconsistent
    • wallet-level top_wallets[].hypothetical_pnl_usd present on some entries and orders-of-magnitude above bankroll_usd → inconsistent
  2. Wire into a vitest content lint over src/content/statements/*.md for non-draft entries (drafts exempt so upstream PRs can land as drafts and be fixed before flipping).
  3. Keep these out of the Zod schema itself if the cross-repo contract shouldn't narrow (see docs/statement-schema.md protocol); a consumer-side lint avoids a SCHEMA_VERSION discussion while still failing CI at flip-time.

Acceptance criteria

AC Test
The exact PR #26 frontmatter, with draft: false, fails the lint unit + content-lint test
Current published statements pass content-lint green on main
Drafts are exempt unit test

Follow-ups (not this issue)

  • Do not flip PR Add weekly statement for 2026-06-09 #26 to draft: false as-is; fix the upstream extractor in poly-track (likely resolved-outcome join) and regenerate. The Tue 14:00 UTC cadence for the Jun 9 weekly is already missed — regenerating beats publishing broken numbers.

Metadata

Metadata

Assignees

No one assigned

    Labels

    afkAgent-grabbable: implementable without further inputbugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions