Skip to content

PleiadesConfig.save() loses workspace token portability #234

Description

@KedoKudo

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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions