Item 1 — VERB LAW: one verb, READ (never SCAN), + a lint that enforces it

The product argued with itself: FAB/nav said "Scan", Free tier "5 scans",
ticker "MLB slate scanned" — while the Ledger says "MY READS". Swept every
user-visible surface to READ:
- BottomTabBar FAB + Nav link: 'Scan' → 'Read'
- Pricing free tier: '5 scans to try the model' → '5 reads …'
- StatStrip: 'Awaiting next scan' → 'Awaiting next read'
- Ticker badge + snapshotService event: tag 'SCAN' → 'READ',
  'slate scanned' → 'slate read' (readSportOf parses BOTH old and new so
  cached ticker items dedupe cleanly through the rollover)
- upgradePitch: 'You've scanned N parlays' / 'unlimited scans' → read/reads

Internal untouched (not user-visible): /api/scan routes, scan_count column,
scanning state, DemoScan/ScanIcon, scanlines CSS, the transitional SCAN
color-map key.

tests/unit/verbLaw.test.js is the enforcement: it fails on user-visible
scan/scanned/scans copy across web/src + src/services (skips comments). Suite
270/3254 green, web build exit 0.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Kev
2026-07-17 15:26:49 -04:00
parent 1776a29a99
commit 66d52a9ce0
18 changed files with 110 additions and 46 deletions
+15 -12
View File
@@ -128,8 +128,9 @@ const isTopGrade = (g) => g === 'A+' || g === 'A';
function generateTickerEvents(sport, grades, deltas, ts) {
const events = [];
events.push({
tag: 'SCAN', color: 'var(--g-a)', ts, sport, // sport tag → dedupe one SCAN per sport
text: `${sport.toUpperCase()} slate scanned · ${grades.length} props graded`,
// VERB LAW — the verb is READ, never SCAN. One READ event per sport (deduped).
tag: 'READ', color: 'var(--g-a)', ts, sport,
text: `${sport.toUpperCase()} slate read · ${grades.length} props graded`,
});
for (const g of grades.filter((x) => isTopGrade(x.grade)).slice(0, 6)) {
const arch = g.archetype ? `${g.archetype} ` : '';
@@ -149,12 +150,14 @@ function generateTickerEvents(sport, grades, deltas, ts) {
return events;
}
// Session 47 — a SCAN event's sport, from the event field or its text prefix
// (defends ticker items written before the `sport` field existed).
function scanSportOf(e) {
if (e.tag !== 'SCAN') return null;
// Session 47 — a READ event's sport, from the event field or its text prefix
// (defends ticker items written before the `sport` field existed). Accepts the
// legacy 'SCAN'/'slate scanned' shape too so cached items dedupe cleanly through
// the verb-law rollover (the ticker regenerates as READ on the next snapshot).
function readSportOf(e) {
if (e.tag !== 'READ' && e.tag !== 'SCAN') return null;
if (e.sport) return String(e.sport).toLowerCase();
const m = String(e.text || '').match(/^([a-z]+)\s+slate scanned/i);
const m = String(e.text || '').match(/^([a-z]+)\s+slate (?:read|scanned)/i);
return m ? m[1].toLowerCase() : null;
}
@@ -162,13 +165,13 @@ async function pushTickerItems(events, deps) {
if (!events || events.length === 0) return;
const existing = await deps.cacheGet('ticker:items');
const arr = Array.isArray(existing) ? existing : [];
// Keep only the LATEST SCAN per sport: drop existing SCAN events for any sport
// that has a fresh SCAN in this batch. MOVE/GRADE events are time-specific and
// Keep only the LATEST READ per sport: drop existing READ events for any sport
// that has a fresh READ in this batch. MOVE/GRADE events are time-specific and
// preserved.
const freshScanSports = new Set(events.map(scanSportOf).filter(Boolean));
const freshReadSports = new Set(events.map(readSportOf).filter(Boolean));
const pruned = arr.filter((e) => {
const sp = scanSportOf(e);
return !(sp && freshScanSports.has(sp));
const sp = readSportOf(e);
return !(sp && freshReadSports.has(sp));
});
const merged = [...events, ...pruned].slice(0, TICKER_CAP);
await deps.cacheSet('ticker:items', merged, TICKER_TTL);