Session 15: Intelligence hardening — park factors, weather, Tank01 prefetch, pace factors, signal audit, founder pricing fix (1405 tests)

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Kev
2026-06-11 16:21:18 -04:00
parent f5d79cf70d
commit 167996d99a
20 changed files with 1550 additions and 28 deletions
+11 -2
View File
@@ -133,7 +133,7 @@ describe('computeFeaturesForProp — graceful degradation', () => {
expect(out.meta.gameId).toBeNull();
});
test('feature fetch throws → empty features + error noted, no crash', async () => {
test('feature fetch throws → ESPN fields empty, but static-context augmentation still surfaces (Session 15)', async () => {
mockSupabaseState.rosterRow = { team_abbr: 'NYK', espn_id: '1', sport: 'nba' };
mockAxiosGet.mockResolvedValue(nbaScoreboard([game('e2', 'NYK', 'BOS')]));
mockFeatures.throws = true;
@@ -141,7 +141,16 @@ describe('computeFeaturesForProp — graceful degradation', () => {
player: 'Brunson', stat_type: 'points', line: 25, direction: 'over', sport: 'nba',
});
expect(out.meta.errors).toContain('no_features_computed');
expect(out.features).toEqual({});
// Session 15 — static lookups (pace factor, park factor) populate
// regardless of ESPN fetch state. The contract used to be
// "features is empty when ESPN fails"; the contract is now
// "features may contain static context even when ESPN fails."
// ESPN-derived fields (l5_avg, opp_rank_stat, ...) ARE absent.
expect(out.features.l5_avg).toBeUndefined();
expect(out.features.opp_rank_stat).toBeUndefined();
// Pace factor lookup is static and stable for known team codes.
expect(out.features.pace_factor).toBe(95); // NYK pace
expect(out.features.opp_pace_factor).toBe(99); // BOS pace
expect(out.trap).toBeDefined();
});