Skip to content

feat: NFL dynasty engine + /dashboard/nfl_roster endpoint#108

Merged
asecord92 merged 1 commit into
mainfrom
nfl-dynasty-engine
Jul 24, 2026
Merged

feat: NFL dynasty engine + /dashboard/nfl_roster endpoint#108
asecord92 merged 1 commit into
mainfrom
nfl-dynasty-engine

Conversation

@asecord92

Copy link
Copy Markdown
Owner

Summary

PR 2 of 3 for the NFL dynasty roster view (roadmap #6).

  • engine/nfl_dynasty.py — pure deterministic dynasty logic: per-position age-curve bands (RB/WR/TE/QB; K/DEF no curve), FantasyCalc param derivation (ppr snapped to 0/0.5/1, numQbs counts QB+SUPER_FLEX slots so true 2-QB leagues price QBs premium), best-effort joins (players by exact sleeperId, picks by pick-inventory label), depth flags from startable bodies vs dedicated slots (taxi/IR excluded, ≤3 flags), and a value-weighted roster-window verdict (top-N core, N = starting slots).
  • engine/fantasycalc.py — free-API client cached in-process per settings combo (12h TTL, stale-if-error, single-flight). Deliberately not dashboard_cache: no AI cost to protect, values are shared across leagues with identical settings, and per-request assembly means the page is never stale after a sync. Also means no widget-check migration (the constraint that broke fix: allow category_matrix widget + decouple its cache write #100).
  • POST /dashboard/nfl_roster — owner-scoped, NFL-guarded, Supabase + FantasyCalc work off the event loop; returns the ready-to-render payload. Named under /dashboard/ so useDashboardWidget works unchanged in PR 3. No AI call.
  • tests/test_nfl_dynasty.py — first unit tests in the repo (23, pure logic per CLAUDE.md''s test-target guidance) + pytest step in CI.

Testing

  • pytest tests/ -q → 23 passed; ruff check . clean; import smoke passes.
  • Live pipeline check against the real FantasyCalc API: 462 entries, exact joins (Josh Allen QB1 10326, Bijan RB1 10191), all three future pick classes valued incl. 2029, in-process cache hit confirmed, window verdict + depth flags sane.

🤖 Generated with Claude Code

engine/nfl_dynasty.py: pure deterministic dynasty logic — per-position
age-curve bands, FantasyCalc param derivation (ppr snapped to 0/0.5/1,
numQbs counts QB+SUPER_FLEX slots), best-effort value joins (players by
sleeperId, picks by label), startable-only depth flags, and a
value-weighted roster-window verdict (top-N core, N = starting slots).

engine/fantasycalc.py: free-API client cached in-process per settings
combo (12h TTL, stale-if-error, single-flight). No dashboard_cache row
and no widget-check migration — values are shared across leagues with
the same settings, and assembling per request keeps the page fresh the
moment a sync lands.

POST /dashboard/nfl_roster (owner-scoped, blocking work off the loop)
returns the ready-to-render payload; named under /dashboard/ so
useDashboardWidget works unchanged. No AI call — costs nothing per view.

tests/test_nfl_dynasty.py: first unit tests in the repo (23), wired
into CI via a pytest step.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@vercel

vercel Bot commented Jul 24, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
dynastyos Ready Ready Preview, Comment Jul 24, 2026 2:51am

@railway-app
railway-app Bot temporarily deployed to dynastyops-secordlabs / dynastyos-pr-108 July 24, 2026 02:50 Destroyed
@asecord92
asecord92 merged commit a156ee8 into main Jul 24, 2026
5 checks passed
@asecord92
asecord92 deleted the nfl-dynasty-engine branch July 24, 2026 02:51
Sign up for free to 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