Skip to content

script_interface: require all BreakageSpec parameters (bug-sweep #42)#5368

Draft
RudolfWeeber wants to merge 1 commit into
espressomd:pythonfrom
RudolfWeeber:fix/bug-42-breakagespec-length-required
Draft

script_interface: require all BreakageSpec parameters (bug-sweep #42)#5368
RudolfWeeber wants to merge 1 commit into
espressomd:pythonfrom
RudolfWeeber:fix/bug-42-breakagespec-length-required

Conversation

@RudolfWeeber

Copy link
Copy Markdown
Contributor

BreakageSpec registered breakage_length and action_type via AutoParameters
but did not override do_construct, so the inherited ObjectHandle::do_construct
only set the parameters actually passed. Omitting breakage_length left the
core struct's value-initialized 0.0 in place; since the breakage check is
distance >= spec.breakage_length, that is always true and queues every bond
of that type for breakage on the first execute(), silently deleting them.

0.0 is a legitimate, tested breakage_length, so it cannot serve as an unset
sentinel. Following the established bonded-interaction convention
(ScriptInterface::Interactions::BondedInteraction::check_valid_parameters),
add a do_construct override that wraps construction in parallel_try_catch and
throws "Parameter '' is missing" if any valid parameter is absent.

Co-Authored-By: Claude Opus 4.8 noreply@anthropic.com

🤖 Generated with Claude Code

BreakageSpec registered breakage_length and action_type via AutoParameters
but did not override do_construct, so the inherited ObjectHandle::do_construct
only set the parameters actually passed. Omitting breakage_length left the
core struct's value-initialized 0.0 in place; since the breakage check is
`distance >= spec.breakage_length`, that is always true and queues every bond
of that type for breakage on the first execute(), silently deleting them.

0.0 is a legitimate, tested breakage_length, so it cannot serve as an unset
sentinel. Following the established bonded-interaction convention
(ScriptInterface::Interactions::BondedInteraction::check_valid_parameters),
add a do_construct override that wraps construction in parallel_try_catch and
throws "Parameter '<name>' is missing" if any valid parameter is absent.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.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.

1 participant