Summary
When PleiadesConfig.save() serializes the configuration to YAML, workspace paths are written in their expanded (absolute) form rather than preserving the original ${workspace.*} token syntax. This means saved configs are not portable across machines or users with different workspace roots.
Example
A config authored as:
workspace:
root: ~/pleiades
endf_dir: ${workspace.root}/endf
fitting_dir: ${workspace.root}/fitting
Gets saved as:
workspace:
root: /home/alice/pleiades
endf_dir: /home/alice/pleiades/endf
fitting_dir: /home/alice/pleiades/fitting
If Bob loads this config on his machine, all paths point to Alice's home directory instead of adapting to his workspace root.
Root Cause
to_dict() calls model_dump(mode="json") which serializes the already-expanded Path objects. The original token strings (e.g., ${workspace.root}) are not preserved after Pydantic validation and path expansion.
Suggested Approach
Store the raw (unexpanded) token strings alongside the expanded paths, and use the raw form during serialization. One option is to track original values in a private field or use a custom serializer that reverses known expansions back to token form.
Context
Identified during review of PR #220. Not a blocker for that PR since configs currently tend to be authored manually and loaded rather than round-tripped programmatically.
Related
Summary
When
PleiadesConfig.save()serializes the configuration to YAML, workspace paths are written in their expanded (absolute) form rather than preserving the original${workspace.*}token syntax. This means saved configs are not portable across machines or users with different workspace roots.Example
A config authored as:
Gets saved as:
If Bob loads this config on his machine, all paths point to Alice's home directory instead of adapting to his workspace root.
Root Cause
to_dict()callsmodel_dump(mode="json")which serializes the already-expandedPathobjects. The original token strings (e.g.,${workspace.root}) are not preserved after Pydantic validation and path expansion.Suggested Approach
Store the raw (unexpanded) token strings alongside the expanded paths, and use the raw form during serialization. One option is to track original values in a private field or use a custom serializer that reverses known expansions back to token form.
Context
Identified during review of PR #220. Not a blocker for that PR since configs currently tend to be authored manually and loaded rather than round-tripped programmatically.
Related
src/pleiades/utils/config.py—_expand_path(),WorkspaceConfig._expand_paths(),PleiadesConfig.save()