Patch issue #2637 - Vertical_Bender gravity always disabled - #2638
Merged
willend merged 1 commit intoSep 9, 2026
Merged
Conversation
…abled regardless of -g
Contributor
|
@MilanKlausz and @ your_claude - good catch! :-D |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Free-form text area
Fixes #2637. Vertical_Bender.comp's
INITIALIZEhad a danglingif/elsewith no braces:localG = coords_set(0, 0, 0);ran unconditionally after the
else, silently zeroing a correctly-computed gravity vector even when mcgravitation was true. This meant the component behaved as if gravity were always off, regardless of-g. Fix adds the missing braces so both statements are properly scoped to the else branch. One-line, behavior-only-changes-when-gravity-is-actually-enabled fix — verified to have zero effect on gravity-off simulations (bit-identical output before/after) and a real, expected effect once gravity is genuinely active inside the bender.Declaration of use of AI-tools
Used Claude (Anthropic) throughout: to trace the bug's root cause (identifying the dangling-else pattern and confirming its scope via the component's other mcgravitation checks), to trace its git history back to its introduction in 2017, and to benchmark its effect before/after the fix on a real instrument model. The fix itself is a two-character change (adding {/}).
Development OS / boundary conditions
macOS (Darwin). No special dependencies.
The identical fix was extensively tested via a separate instrument model (LOKI) using this component under McStas 3.5.42 / 3.7.24
PR Checklist for contributing to McStas/McXtrace
For a coherent and useful contribution to McStas/McXtrace, please fill in relevant parts of the checklist:
My contribution includes patches to an existing component file
mcdocutility and rendered a reasonable documentation page for the component (please attach as screenshot in comments!)mctestutility to test one or more instruments making use of the component (please attachmcviewtestreport as screenshot in comments)mccode-clangformattool to apply the standard McCode component indentation schememcrun --c-lint"linter" and followed advice to remove most / all warnings that are raisedMy PR is meant to fix a specific, existing issue