Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion newton/_src/sim/builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ class ActuatorEntry:
output_indices: list[list[int]] # Per-actuator output indices
args: list[dict[str, Any]] # Per-actuator array params (scalar params in dict key)

@dataclass
@dataclass(slots=True)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

Add deprecation + changelog path for this behavioral break

slots=True intentionally breaks dynamic attribute writes on ShapeConfig (now AttributeError). Please add a deprecation phase (or explicit maintainer-approved exception) and a [Unreleased] CHANGELOG entry with migration guidance for users who previously attached ad-hoc attributes.

As per coding guidelines: “newton/!(tests)/**/*.py: Breaking changes require a deprecation first.” and “**: Check that any user-facing change includes a corresponding entry in CHANGELOG.md under the [Unreleased] section … For Deprecated, Changed, and Removed entries, verify the entry includes migration guidance…”.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@newton/_src/sim/builder.py` at line 213, You changed `@dataclass`(slots=True)
on ShapeConfig which breaks dynamic attribute writes; add a runtime deprecation
phase and changelog entry: emit a DeprecationWarning (from warnings.warn) when
ShapeConfig is instantiated (or on first attribute assignment) explaining that
dynamic ad-hoc attributes will be disallowed and advising users to migrate their
ad-hoc data into a dedicated dict/explicit fields or to subclass/compose a
wrapper that holds extra attributes; include a maintainer-approved explicit
exception path if you want immediate hard-fail (raise AttributeError with the
same migration text) and document which behavior is chosen. Then add an entry in
CHANGELOG.md under [Unreleased] (Deprecated/Changed) mentioning ShapeConfig, the
slots=True behavioral break, the deprecation timeline (when it will be removed
or when hard-fail applies), and concrete migration examples (use explicit
fields, .metadata dict, or subclassing) so users can update their code.

class ShapeConfig:
"""
Represents the properties of a collision shape used in simulation.
Expand Down
Loading