Skip to content

fix: fail fast on checkpoint version mismatch#1135

Open
MilesCranmerBot wants to merge 4 commits intoMilesCranmer:masterfrom
MilesCranmerBot:fix/checkpoint-metadata
Open

fix: fail fast on checkpoint version mismatch#1135
MilesCranmerBot wants to merge 4 commits intoMilesCranmer:masterfrom
MilesCranmerBot:fix/checkpoint-metadata

Conversation

@MilesCranmerBot
Copy link
Contributor

@MilesCranmerBot MilesCranmerBot commented Feb 12, 2026

Fixes #941.

Adds checkpoint metadata (PySR + SymbolicRegression backend + Julia version) and validates it before unpickling, so version mismatches raise a clear actionable error instead of opaque deserialization failures.

TDD:

  • Adds unit test for mismatch raising a clear error.
  • Adds unit test that checkpoint write includes metadata.

Local test:

  • python -m pytest pysr/test/test_main.py -k checkpoint_metadata

@codecov
Copy link

codecov bot commented Feb 12, 2026

Codecov Report

❌ Patch coverage is 94.11765% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 94.37%. Comparing base (2ac7e71) to head (53f20f0).
⚠️ Report is 2 commits behind head on master.

Files with missing lines Patch % Lines
pysr/sr.py 94.11% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1135      +/-   ##
==========================================
+ Coverage   93.91%   94.37%   +0.45%     
==========================================
  Files          21       21              
  Lines        1643     1723      +80     
==========================================
+ Hits         1543     1626      +83     
+ Misses        100       97       -3     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Co-authored-by: Miles Cranmer <miles.cranmer@gmail.com>
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.

[BUG]: Cannot load model that has been fitted with TemplateExpressionSpec

1 participant