Summary
PleiadesConfig has three fields that can define the nuclear data cache directory:
nuclear_data_cache_dir (top-level legacy field)
nuclear.data_cache_dir (nested NuclearConfig field)
workspace.endf_dir (workspace subdirectory)
The _normalize_config validator syncs these bidirectionally, but the precedence rules are asymmetric and undocumented:
# Lines 309-312 in config.py
if self.nuclear.data_cache_dir is None:
self.nuclear.data_cache_dir = self.nuclear_data_cache_dir # legacy wins
else:
self.nuclear_data_cache_dir = self.nuclear.data_cache_dir # nested wins
The same pattern applies to nuclear_data_sources vs nuclear.sources (lines 314-317).
Problem
- If a user sets both
nuclear_data_cache_dir and nuclear.data_cache_dir to different values, the nested field silently wins and the top-level value is overwritten with no warning.
workspace.endf_dir is then set from nuclear_data_cache_dir (line 321), completing a chain of implicit overrides that is hard to reason about.
- There is no documentation or log message explaining which value takes precedence.
Suggested Approach
Pick one of:
- Deprecate the legacy fields (
nuclear_data_cache_dir, nuclear_data_sources) and migrate to the nested nuclear.* fields only, emitting a deprecation warning when the legacy fields are used.
- Emit a warning when both are set to conflicting values, making the precedence explicit in docs and logs.
- Raise an error when conflicting values are detected, forcing the user to be explicit.
Context
Identified during review of PR #220. Not a blocker — the sync logic works correctly for the common single-source case, but the implicit precedence can surprise users who set values at multiple levels.
Related
Summary
PleiadesConfighas three fields that can define the nuclear data cache directory:nuclear_data_cache_dir(top-level legacy field)nuclear.data_cache_dir(nestedNuclearConfigfield)workspace.endf_dir(workspace subdirectory)The
_normalize_configvalidator syncs these bidirectionally, but the precedence rules are asymmetric and undocumented:The same pattern applies to
nuclear_data_sourcesvsnuclear.sources(lines 314-317).Problem
nuclear_data_cache_dirandnuclear.data_cache_dirto different values, the nested field silently wins and the top-level value is overwritten with no warning.workspace.endf_diris then set fromnuclear_data_cache_dir(line 321), completing a chain of implicit overrides that is hard to reason about.Suggested Approach
Pick one of:
nuclear_data_cache_dir,nuclear_data_sources) and migrate to the nestednuclear.*fields only, emitting a deprecation warning when the legacy fields are used.Context
Identified during review of PR #220. Not a blocker — the sync logic works correctly for the common single-source case, but the implicit precedence can surprise users who set values at multiple levels.
Related
src/pleiades/utils/config.py—PleiadesConfig._normalize_config(), lines 285-321