Problem
A data_dir written with a leading ~ (e.g. data_dir = "~/anchor-data" in anchor.toml, or ANCHOR_DATA_DIR=~/x, or --data-dir ~/x) is parsed into a literal Path with no expansion. The ~ becomes a real folder name, so anchor creates ./~/... inside the project and reads from the wrong place; anchor list returns [] with no warning.
Expected
~ expands to $HOME (and $VAR is honored) from every config source.
Fix
@field_validator("data_dir") in src/anchor/infra/config.py runs expandvars + expanduser on the value, so every source (toml / env / --data-dir / constructor) funnels through one expansion. Regression tests in tests/infra/test_config_discovery.py.
Problem
A
data_dirwritten with a leading~(e.g.data_dir = "~/anchor-data"inanchor.toml, orANCHOR_DATA_DIR=~/x, or--data-dir ~/x) is parsed into a literalPathwith no expansion. The~becomes a real folder name, soanchorcreates./~/...inside the project and reads from the wrong place;anchor listreturns[]with no warning.Expected
~expands to$HOME(and$VARis honored) from every config source.Fix
@field_validator("data_dir")insrc/anchor/infra/config.pyrunsexpandvars+expanduseron the value, so every source (toml / env /--data-dir/ constructor) funnels through one expansion. Regression tests intests/infra/test_config_discovery.py.