Repository navigation
slice-8: season chaining and gp season - #21
Merged
Merged
Conversation
Chains rounds r+1..R within each trial, carrying the car random walk forward; sprints via simulate_weekend; drivers' and constructors' tables from the same trials. gp season writes drivers_championship.csv and constructors_championship.csv; the remaining calendar comes from FastF1 through a stubbable loader and the command fails if it cannot be read. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QRJHJJN7CD3ym1wMdmWnsM
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QRJHJJN7CD3ym1wMdmWnsM
Meerav29
pushed a commit
that referenced
this pull request
Oct 21, 2026
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QuFzDH4gT5WLYUkweqAXpV
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Tracking: #19
What this slice does
This is spec §3.4 season chaining plus the
gp seasoncommand from §6. It covers the first half of Phase 3.src/sim/season.py(new, pure numpy).simulate_seasonruns rounds r+1..R in sequence inside each trial. Before each round, every team's car takes one random-walk step from its running value, so the wander compounds over the season.simulate_weekend, so a sprint reuses the Grand Prix's pace draw and is scored with the sprint points table.driver_points @ membership).remaining_calendar(season, after_round, loader=None)reads the remaining rounds from the FastF1 event schedule.loaderis the seam tests use to stub it. If the schedule can't be read, or comes back empty, it raisesScheduleUnavailable.drivers_championshipandconstructors_championshipbuild the two §6 tables.src/cli.pyforecast_seasonhandles the posterior plumbing. The chain starts at the fit's own cutoff round, and points and wins scored so far are read from the R/S rows.cmd_seasonwritesdrivers_championship.csvandconstructors_championship.csvto--out-dir(default: the fit directory). If the schedule can't be read it exits 1 and prints the error.src/sim/race.py: the points-per-trial calculation moved out ofsummarize_trialsintopoints_for_trialsso both simulators use it.summarize_trialsbehaves the same.Review pack
About 20 minutes.
src/sim/season.py::simulate_season(~45 lines). The carry-forward is the linecar = car + rng.normal(...).cli.forecast_season, in particular where the season and cutoff round come from (max(data.round_to_idx, ...)) and how current points are computed (_season_so_far).current_pointsmatches the real 2026 standings through the fit's cutoff round, and that the title odds look sane.docs/autopilot/decisions.md.Acceptance criteria
Commands were run in this sandbox on Python 3.11.17, pymc 5.28.5, arviz 0.23.4. The full real backtest was not run.
TestRandomWalkCarriesForward::test_late_round_car_draw_is_wider_than_early. With an identical starting car in every trial and 12 rounds, the round-12 sd is more than 2.5× the round-1 sd, and it matches 0.08·√12 within 10%.test_rounds_draw_pace_from_the_wandered_carchecks that the resolver reads the running car.car = inputs.car + rng.normal(...)(stepping from the fitted car each round): 1 failed, 11 passed.car_d = inputs.car[:, team_col]: 1 failed, 11 passed.simulate_weekend).test_sprint_rounds_score_their_own_table: with no DNFs, each trial hands out exactly 3×101 + 36 points.test_sprint_goes_through_simulate_weekend: a spy records thehas_sprintflag on each call as[False, False, True].has_sprint=False: 2 failed.test_constructor_points_are_the_sum_of_their_drivers_per_trialchecks points and wins per trial, with DNFs on and a sprint round included.test_forecast_season_tableschecks that each team's constructorexp_final_pointsequals the sum of its drivers' values.gp seasonwrites both CSVs with the §6 columns, and current points come from rounds already run.test_forecast_season_tableschecks the column sets and current points (d1 = 50 and d2 = 36 from two completed rounds).test_season_finished_means_standings_are_final: with no rounds left, final points equal current points.TestCmdSeason::test_writes_both_championship_csvs.current_pointscolumn, and the drivers table carriesteam. These are additions beyond the §6 columns.TestRemainingCalendarcovers round filtering, the sprint flag, and a loader that raises.TestCmdSeason::test_unreadable_schedule_exits_with_a_message:SystemExit, the error appears on stderr, and no CSV is written.fastf1.get_event_schedulepath has not been exercised here.PYTHONPATH=src pytest tests -qgives309 passed, 660 warnings in 34.69s: the 297 that passed before plus 12 new.test_season.pyalone gives12 passed in 0.78s.A separate countback mutation (dropping wins from the tie key) gives 1 failed, from
test_final_positions_break_points_ties_on_wins.Decisions made without you
Both are recorded in
docs/autopilot/decisions.mdunder 2026-10-21.caris drawn once per trial and kept for the rest of the season: driver skill, track interaction, quali offset, noise scales, and both DNF hazards. Onlycarsteps, using the pace model's ownSIGMA_DEV, doubled for the early rounds of a reset year, as in_step_sigma_scale. The incident-hazard grid slot is the season-start posterior-mean quali rank.Also worth knowing: the overtaking parameter for future rounds comes from a single
build_overtaking_datacall over every circuit with races before the cutoff, then a per-circuit lookup with the hand rating as fallback. That is one fit pergp seasoncall, not one per round.Deliberately not included
confidence.pyor the pkl. Spec §8 makes that conditional on the Phase 3 backtest passing.gp seasonchains from the fit's own cutoff season. Forecasting a season the fit has not reached yet (for example, fitting through 2025:24 and asking for 2026) is not supported.points_tables.csvand don't apply in 2026.How to revert
git revert <merge commit>onauto/queue. The changes are additive apart from thepoints_for_trialsextraction insim/race.py, and no data files or schemas change.Generated by Claude Code