Skip to content

Conversation

@Aaryan-549
Copy link

Problem #876

The --override flag allowed overriding opt.is_sparse on mjw.Model after initialization. This field affects memory allocation during model creation, causing subtle bugs when changed afterwards.

Solution

Added validation to prevent overriding fields with side effects. The opt.is_sparse field is now read-only on mjw.Model and will throw an exception if override is attempted.

Changes

  • Added readonly_fields set to track fields that cannot be overridden
  • Added validation check in override_model() function
  • Raises clear error message when attempting to override restricted fields

Fields like is_sparse affect model initialization and memory allocation.
Overriding them after model creation causes inconsistencies.
Added validation to throw exception when attempting to override these fields.
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