Skip to content

CI: fail PRs that edit or delete a published model run - #29

Closed
nflechner wants to merge 1 commit into
forecastingresearch:mainfrom
nflechner:main
Closed

nflechner wants to merge 1 commit into
forecastingresearch:mainfrom
nflechner:main

Conversation

@nflechner

Copy link
Copy Markdown
Contributor

model_run_key is the immutable benchmark identity of one model plus one option set; benchmark files and the warehouse's dim_model_run key on it. Add a PR check that dumps (model_run_key, model_key, options) for every run on the base branch and on the PR head and fails when a base run is missing or has a different model_key or options. Adding runs stays allowed; slug, release dates, Models.dev metadata and active are not compared.

scripts/check_model_run_immutability.py has two subcommands: dump (NDJSON of the immutable fields, sorted, with a fingerprint) and check (compare two dumps, print a report, exit 1 on violation). The workflow installs the base and PR versions of the package into separate venvs and runs the PR's copy of the script by file path against each, so the check does not depend on the base branch already carrying the script.

Document the freeze rule in AGENTS.md.

Co-Authored-By: Claude Fable 5.1 noreply@anthropic.com
Claude-Session: https://claude.ai/code/session_01XSAqY76fnCZj5zFnM7gHFL

@houtanb houtanb left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a great PR! Just two small changes I think (Claude helped me find them)

- name: Check out base branch
uses: actions/checkout@v7
with:
ref: ${{ github.base_ref }}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should likely be ref: ${{ github.event.pull_request.base.sha }} so it'll be the same main as this PR is based on. Otherwise, if we rerun this test without rebasing after another commit has merged, it could incorrectly show as false


- name: Dump model runs on base and PR
run: |
"$RUNNER_TEMP/venv-base/bin/python" pr/scripts/check_model_run_immutability.py dump \

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should this be base/scripts/check_model_run_immutability.py? Otherwise a PR could edit the script that runs, but we trust the one on main? (NBD that it doesn't exist until this is merged)

model_run_key is the immutable benchmark identity of one model plus one
option set; benchmark files and the warehouse's dim_model_run key on it.
Add a PR check that dumps (model_run_key, model_key, options) for every
run on the base branch and on the PR head and fails when a base run is
missing or has a different model_key or options. Adding runs stays
allowed; slug, release dates, Models.dev metadata and `active` are not
compared.

scripts/check_model_run_immutability.py has two subcommands: `dump`
(NDJSON of the immutable fields, sorted, with a fingerprint) and `check`
(compare two dumps, print a report, exit 1 on violation). The workflow
installs the base and PR versions of the package into separate venvs and
runs the PR's copy of the script by file path against each, so the check
does not depend on the base branch already carrying the script.

Document the freeze rule in AGENTS.md.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XSAqY76fnCZj5zFnM7gHFL

Co-authored-by: nflechner <60731786+nflechner@users.noreply.github.com>
@houtanb
houtanb force-pushed the main branch 2 times, most recently from 0e18099 to 72969be Compare October 5, 2026 16:07
@houtanb

houtanb commented Oct 5, 2026

Copy link
Copy Markdown
Member

merged in cf837f5

@houtanb houtanb closed this Oct 5, 2026
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.

3 participants