Fix duplicate switch value making Paz-Soldan scaling unselectable - #4529
Open
dallonby wants to merge 1 commit into
Open
Fix duplicate switch value making Paz-Soldan scaling unselectable#4529dallonby wants to merge 1 commit into
dallonby wants to merge 1 commit into
Conversation
ConfinementTimeModel.PAZ_SOLDAN_NT was assigned 51, the same value as NCST, making it a silent alias: i_confinement_time=51 dispatched to the NCST scaling and the Paz-Soldan branch in PlasmaConfinementTime.calculate_confinement_time was unreachable. Assign 52, matching the documented switch value in documentation/source/physics-models/plasma_confinement.md, and add enum.unique so a duplicate value can never silently alias again. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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.
Closes #4528
Overview
ConfinementTimeModel.PAZ_SOLDAN_NTshared switch value 51 withNCST, making it a silent Python enum alias:i_confinement_time = 51dispatched to the NCST scaling, the Paz-Soldan branch incalculate_confinement_timewas unreachable, and the documented value 52 was rejected as invalid input.Changes
process/data_structure/physics_variables.py: assign 52 toPAZ_SOLDAN_NT(matching the existing documentation inplasma_confinement.md) and decorateConfinementTimeModelwithenum.uniqueso any future duplicate value fails at import instead of silently aliasing.tests/unit/models/physics/test_confinement_time.py: add a uniqueness test over all switch values and an explicit test that 51 → NCST and 52 → PAZ_SOLDAN_NT are distinct members.Notes for reviewers
N_CONFINEMENT_SCALINGS(=len(ConfinementTimeModel)) goes 52 → 53. I checked the three usages: thehfacarray grows by one element, input validation now accepts 0–52, and the OUT.DAT confinement-comparison table gains one (OCMMNT text) row — no MFILE variables are added, so regression MFILE comparisons should be unaffected.Found during an independent audit of v3.4.2.
🤖 Generated with Claude Code