Files
vyndr/supabase/migrations/034_ledger_takeable.sql
T
builtbykev 2bfaeff572 Ledger takeable tagging (deferred C2); efficiency challenger BLOCKED
Champion grade UNCHANGED. Push scoring untouched. Additive tags only — nothing
deleted, nothing re-settled.

PART A — THE EFFICIENCY CHALLENGER: BLOCKED, NOT BUILT.
Review Zero came back ABSENT on all three inputs:
  0.1 efficiency scores DO NOT EXIST (zero occurrences of market_efficiency /
      marketEfficiency / efficiency_score in src/ or web/src/).
  0.2 base thresholds DO NOT EXIST (engine1.js has zero `edge` references — the
      grade is not an edge-vs-threshold comparison; grade_thresholds.json holds
      PROBABILITY bands).
  0.3 the +/-0.05 additive efficiency nudge DOES NOT EXIST. The only 0.05s on
      the grade path are featureCache.teammate_absence_bump, a bvp_advantage
      cutoff, and p*0.9+0.05 inside probabilityEstimator (the 0.5*0.1 term of
      the shrink-toward-0.5). There is no additive scaling to replace.

So a challenger differing from the champion in EXACTLY ONE thing cannot be
constructed: there is no additive scaling to swap, no base threshold to
multiply, and engine1.js has zero `sport` references so market cannot reach the
grade. A threshold must exist first — that is R1 of
specs/full-output-grade-mapping.md, an explicitly held separate order. Shipping
R1+R4 together would make the Phase-3 delta report misleading: the re-letter
would be driven mostly by switching to probability grading while being
presented as the efficiency fix.

0.4 coverage: the spec names 5 scores; the live ledger has 11 markets and only
MLB total_bases maps to one. 9 of 11 have no score, so "all scored markets"
cannot be satisfied without inventing 9 numbers.

PART B — LEDGER TAKEABLE TAGGING: BUILT (the deferred C2).
New src/config/takeableStandard.js: floor on the minus side, UNCAPPED plus.
Deliberately NOT valueEngine.isTakeable (the -160..+200 PROMOTION band) — a
+400 prop is not promotable but IS takeable; a test asserts the two diverge on
the plus side and agree at the floor so they can never quietly merge. Absent
price returns null, never false (Number(null) === 0 would tag a missing price
takeable). The floor is POLICY not derived (C1 could not derive one) and is
labelled so; each row records takeable_floor so a re-derivation can re-tag.

Migration 034 (applied + tracked): ledger_entries.takeable boolean +
takeable_floor numeric, nullable, partial index. Forward tagging in
ledgerService at row build; backfill in one statement.
Result: 1254 rows, 1246 tagged (781 takeable / 465 below floor), 8 NULL with
null_despite_price = 0 (the NULLs are genuinely priceless rows). Settled 1163
and graded 1254 unchanged.

PART C — the model-version boundary tag is DELIBERATELY NOT APPLIED: no scaling
change shipped, so no boundary exists, and stamping one would mark a model
transition that never happened. modelEras.js is its home when a real one lands.

Floor: 312 suites / 3890 tests green (8 new), web build exit 0.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QJs13VsyiSKYQP6rj3NNmc
2026-07-31 00:19:13 -04:00

29 lines
1.4 KiB
SQL

-- 034 — LEDGER TAKEABLE TAGGING (2026-07-31, specs/takeable-tagging.md)
--
-- Marks whether each ledger row's LOCKED price was one a bettor could actually
-- have taken, under the founder-ratified shape: a FLOOR on the minus side,
-- UNCAPPED on the plus side.
--
-- NOT the same as config/valueEngine.isTakeable (the -160..+200 PROMOTION band
-- used by the hero/board). A +400 prop is not promotable but IS takeable.
--
-- `takeable_floor` records the floor each row was tagged under, so a future
-- re-derivation (the floor is POLICY, not derived — see C1, 2026-07-30) can
-- re-tag safely without guessing what standard a row was judged by.
--
-- Additive only: nullable columns, no backfill of any existing value, nothing
-- deleted, nothing re-settled. NULL takeable = "no locked price to judge",
-- which is an honest absence, not false.
ALTER TABLE ledger_entries
ADD COLUMN IF NOT EXISTS takeable boolean,
ADD COLUMN IF NOT EXISTS takeable_floor numeric;
COMMENT ON COLUMN ledger_entries.takeable IS
'Locked price >= the policy floor (minus side), uncapped plus. NULL = no locked price. NOT the promotion band.';
COMMENT ON COLUMN ledger_entries.takeable_floor IS
'The policy floor (American odds) this row was tagged under. Policy, not derived — see specs/takeable-tagging.md.';
CREATE INDEX IF NOT EXISTS idx_ledger_takeable
ON ledger_entries (sport, takeable) WHERE user_id IS NULL;