Repository navigation
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Walkthrough
Merge Risk: ⚪ Minimal · up to Loading saved state into an optimizer with different or reordered parameters now fails early with a clear error instead of silently misassociating observations. Same-order loads keep their existing behavior. No merge-blocking risk is identified. Pre-merge checks |
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #629 +/- ##
=======================================
Coverage 98.36% 98.36%
=======================================
Files 10 10
Lines 1220 1223 +3
=======================================
+ Hits 1200 1203 +3
Misses 20 20 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
LGTM! Thanks for the contribution! |
load_state()replays saved observation arrays using the receiving optimizer's parameter order without checking the savedkeys. Savingx=1, y=2, target=21and loading intopbounds={"y": ..., "x": ...}silently associates that target withy=1, x=2. Replacing the parameter names is also accepted when the dimensions match.Validate the saved names and their order at the start of
_load_state_dict()and raise a clearValueErroron a mismatch, before registering observations or changing the receiver's random state. Add eight regression cases covering reversed and renamed keys, empty/populated saved states, and empty/populated receiving optimizers. Same-order round trips retain the existing behavior.Validation on Windows, Python 3.12.14, NumPy 2.5.3, SciPy 1.18.1, and scikit-learn 1.9.1:
save_state()/load_state()reproduction: four incompatible-key cases fail on untouched master, while two same-order controls pass; all six cases pass after the fix.git diff --checkpass.The key-order mismatch was previously identified in the CodeRabbit review on #609. The state persistence API was introduced by @adrianmolzon in #547. This change addresses parameter names and order; it does not introduce state migration or validation of the other saved configuration fields. Documentation builds and the other platform/Python-version combinations were not run locally.
Summary by CodeRabbit