Repository navigation
Description
Overview
autonerves.JSONPriorConfig resolves a prior by testing whether {cls.__module__}.{cls.__name__}.{param} ends with the dotted path of a yaml under config/priors/ plus its key (PyAutoNerves/autonerves/json_prior/config.py:226-244). A file at the wrong path, a typo'd key or a param the class does not take is therefore silently dead — the MRO family walk (config.py:195-202) usually finds a parent's file and nothing errors. The euclid pipeline's config-drift sweep (euclid#43 / PR #44) found rows that reproduce identically in the packaged PyAutoGalaxy/autogalaxy/config/ and in autolens_workspace/config/ + autogalaxy_workspace/config/. One row is a live runtime failure: af.Model(NFWTruncatedMCRScatterLudlowSph).instance_from_prior_medians() raises ConfigException because its yaml sits under the sibling module's filename. This task fixes the packaged config, adds a walker test so the class of bug cannot recur, and re-syncs the workspace copies.
Re-verified 2026-09-15 against main (PyAutoGalaxy 840ffde, PyAutoFit 27d41e7c8, PyAutoNerves fac8b17). Two corrections to the prompt: cosmology.yaml::model.FlatLambdaCDM is not drift (the dotted key is the correct suffix and resolves), and general.yaml::fits.flip_for_ds9 exists only in the workspaces, not in the packaged config. PyAutoFit's packaged plots_search.yaml is already correct, so PyAutoFit needs no change; PyAutoLens ships no priors/.
Plan
- Fix the nine packaged PyAutoGalaxy prior-config rows (rename the
ersictypo, move theNFWTruncatedMCRScatterLudlowSphblock tonfw_truncated_mcr_scatter.yaml, delete the orphan linearchameleon.yaml/eff.yaml, drop thePointSourceChiblock, drop the deadSersicCoreSph.mass_to_light_ratioand linear-operatedGaussian.intensitykeys, reword the mesh README). - Add a PyAutoGalaxy test that walks
autogalaxy/config/priors/**and asserts every top-level key suffix-matches a real class and every declared param is an__init__argument. - Add a regression test that
af.Model(NFWTruncatedMCRScatterLudlowSph).instance_from_prior_medians()succeeds. - Ship the library PR first.
- Apply the same edits to
autolens_workspace/configandautogalaxy_workspace/config(as edits, not blind copies), removefits.flip_for_ds9from bothgeneral.yaml, and replace the stale per-searchplots_search.yamlin autolens_workspace, HowToLens and autolens_workspace_test with thenest/mcmc/mleform. - Ship one workspace PR per repo behind the library-first gate.
- File two out-of-scope side findings via intake afterwards (
SersicCoreSph.__init__never acceptsmass_to_light_ratio;light/linear_operated/config lacks asersic.yamlfor the existingsersic.py).
Detailed implementation plan
Work Classification
Both — library (PyAutoGalaxy) first, workspaces follow.
Affected Repositories
- PyAutoGalaxy (primary, library)
- autolens_workspace (workspace: priors rows 1–9,
plots_search.yaml,general.yaml) - autogalaxy_workspace (workspace: priors rows 1–9,
general.yaml) - HowToLens (workspace:
plots_search.yamlonly) - autolens_workspace_test (workspace:
plots_search.yamlonly)
Branch Survey (2026-09-15)
| Repository | Current Branch | Dirty? | Worktree guard |
|---|---|---|---|
| ./PyAutoGalaxy | main | clean | clear |
| ./autolens_workspace | main | clean | claimed by multi-galaxy-j1011-real-data (scripts/multi_galaxy/**, disjoint) → own parallel worktree approved |
| ./autogalaxy_workspace | main | clean (1 behind origin, ff-pull first) | clear |
| ./HowToLens | main | clean | clear |
| ./autolens_workspace_test | main | clean | claimed by jax-runtime-and-parity (JAX runtime/parity scripts, disjoint) → own parallel worktree approved |
Suggested branch: feature/config-priors-drift
Worktree root: ~/Code/PyAutoLabs-wt/config-priors-drift/
Findings (verified)
| # | File (rel. config/priors/ unless noted) |
Verdict | Fix |
|---|---|---|---|
| 1 | light/operated/sersic.yaml key ersic |
typo; operated Sersic priors dead, fall back to standard | rename key → Sersic (diff values vs light/standard/sersic.yaml and surface any difference) |
| 2 | mass/dark/nfw_truncated_mcr.yaml key NFWTruncatedMCRScatterLudlowSph |
class module is nfw_truncated_mcr_scatter; model construction raises ConfigException |
move block verbatim to new mass/dark/nfw_truncated_mcr_scatter.yaml |
| 3 | light/linear/chameleon.yaml |
orphan: no lp_linear.Chameleon |
delete file |
| 4 | light/linear/eff.yaml |
orphan: no lp_linear.ElsonFreeFall |
delete file |
| 5 | point_sources.yaml key PointSourceChi |
class gone (only Point, PointFlux) |
delete block |
| 6 | cosmology.yaml key model.FlatLambdaCDM |
not drift — resolves | no change |
| 7 | mass/stellar/sersic_core.yaml SersicCoreSph.mass_to_light_ratio |
dead key, not in __init__ |
delete key |
| 8 | light/linear_operated/gaussian.yaml Gaussian.intensity |
dead key; linear Gaussian hard-codes intensity | delete key |
| 9 | mesh/README.md "…or Voronoi mesh" |
stale prose | "rectangular grid or Delaunay triangulation" |
| 10 | config/visualize/plots_search.yaml dynesty:/emcee:/nautilus:/zeus: |
readers (abstract_nest.py:72, abstract_mcmc.py:53, abstract_mle.py:33) read nest/mcmc/mle only; stale only in autolens_workspace, HowToLens, autolens_workspace_test |
replace with the PyAutoFit packaged file |
| 11 | config/general.yaml fits.flip_for_ds9 |
no reader anywhere; workspace-only | delete key (and empty fits: header) in both workspaces |
Implementation Steps
- PyAutoGalaxy config (
autogalaxy/config/priors/): apply rows 1–9 as listed.cosmology.yamluntouched. - PyAutoGalaxy test
test_autogalaxy/config/test_priors_config.py:test_every_prior_key_resolves_to_a_class— walkPath(autogalaxy.__file__).parent / "config" / "priors"withrglob("*.yaml");rel = ".".join(path.relative_to(priors).with_suffix("").parts)(mirrorsautonerves/json_prior/config.py:157-160); target suffixf"{rel}.{key}". Class census viapkgutil.walk_packagesoverautogalaxy,autoarray,autofit(inspect.getmembers(mod, inspect.isclass)filtered tocls.__module__ == mod.__name__) →{f"{cls.__module__}.{cls.__name__}": cls}. Assert exactly one census entry ends with the suffix; report all misses in one message.test_every_prior_param_is_an_init_argument— every top-level param key under a class block must be ininspect.signature(cls.__init__).parametersminusself(skip when**kwargsis present).- A module-level
ALLOWLISTdict (key → one-line reason) for anything that legitimately cannot resolve; the goal is an empty allowlist and any entry is reported for review. test_nfw_truncated_mcr_scatter_ludlow_sph_model_resolves—af.Model(ag.mp.NFWTruncatedMCRScatterLudlowSph).instance_from_prior_medians()succeeds;prior_countmatches the yaml.
- Run
pytest test_autogalaxy/config -q, then the fullpytest test_autogalaxy -q. Ship viaship_library. - Workspaces: apply rows 1–9 as edits in
autolens_workspace/config/priorsandautogalaxy_workspace/config/priors; byte-diff each edited file against the packaged one (expected residual: autolens_workspacesersic_core.yamlkeepsSersicCoreSph.radius_break: Constant 0.025). Removefits.flip_for_ds9from bothgeneral.yaml. Replaceconfig/visualize/plots_search.yamlin autolens_workspace, HowToLens, autolens_workspace_test with thenest/mcmc/mleform (PyAutoFit/autofit/config/visualize/plots_search.yaml;autogalaxy_workspacealready has it). - Verify from each workspace cwd:
af.Model(al.mp.NFWTruncatedMCRScatterLudlowSph).instance_from_prior_medians()succeeds;grep -rn "PointSourceChi\|flip_for_ds9\|Voronoi\|^ersic" config/is empty. Ship one PR per repo viaship_workspace.
Key Files
PyAutoNerves/autonerves/json_prior/config.py:226-244— the suffix matcher (mechanism; not modified)PyAutoNerves/autonerves/json_prior/config.py:157-160— file path → dotted top-level keyPyAutoGalaxy/autogalaxy/config/priors/**— the packaged config being fixedPyAutoGalaxy/autogalaxy/profiles/mass/dark/nfw_truncated_mcr_scatter.py— the class whose priors are currently unresolvablePyAutoGalaxy/test_autogalaxy/config/test_priors_config.py— new walker + regression testsautolens_workspace/config/,autogalaxy_workspace/config/,HowToLens/config/visualize/plots_search.yaml,autolens_workspace_test/config/visualize/plots_search.yaml
Original Prompt
Click to expand starting prompt
Config priors drift: stale class names, paths and params shared by PyAutoGalaxy and autolens_workspace
Type: bug
Target: autogalaxy
Repos:
- PyAutoGalaxy
- PyAutoFit
- autolens_workspace
- autogalaxy_workspace
Themes: - config
- hygiene
Difficulty: small
Autonomy: safe
Priority: medium
Status: draft
Consequence: judge
Review-minutes: 20
Unattended: ready
Filed: 2026-08-29
Found by the euclid_strong_lens_modeling_pipeline config drift sweep (euclid#43 / PR #44,
2026-08-29). These findings reproduce identically in the packaged
PyAutoGalaxy/autogalaxy/config/priors/ and in autolens_workspace/config/priors/, so they
were deliberately left alone in the euclid repo (fixing them there would fork files in parity)
and belong upstream. Mechanism that makes several of these silent: JSONPriorConfig matches
cls.__module__ + cls.__name__ + param by suffix against the yaml path relative to
config/priors/, so a file at the wrong path is dead, not an error — the packaged default wins.
User request (verbatim): "voronoi was removed so we should remove voronoi.yaml and things with
similar references. I guess this implies for the euclid repo we should do a general config drift
sweet" — the euclid-local half shipped in PR #44; this prompt is the upstream half.
Findings (all verified against installed 2026.8.17.1 via dir() / __init__ signatures)
| File | Key | Finding |
|---|---|---|
priors/light/operated/sersic.yaml |
ersic |
Typo (leading S missing) — the operated Sersic priors are dead |
priors/mass/dark/nfw_truncated_mcr.yaml |
NFWTruncatedMCRScatterLudlowSph |
path ≠ class module → dead |
priors/light/linear/chameleon.yaml |
Chameleon, ChameleonSph |
path mismatch → dead |
priors/light/linear/eff.yaml |
ElsonFreeFall, ElsonFreeFallSph |
path mismatch → dead |
priors/point_sources.yaml |
PointSourceChi |
class no longer exists |
priors/cosmology.yaml |
model.FlatLambdaCDM |
dotted key, no matching class path |
priors/mass/stellar/sersic_core.yaml |
SersicCoreSph.mass_to_light_ratio |
param not in __init__ |
priors/light/linear_operated/gaussian.yaml |
Gaussian.intensity |
linear profiles have no intensity |
priors/mesh/README.md |
prose | still says "…Delaunay triangulation or Voronoi mesh" — Voronoi removed |
visualize/plots_search.yaml |
dynesty:, emcee:, nautilus:, zeus: |
autofit reads only the three family-level sections; per-search blocks unread |
general.yaml |
fits.flip_for_ds9 |
no reader in any library or autonerves |
Deliverable
- Fix or delete each row in the packaged PyAutoGalaxy (and PyAutoFit for
plots_search/general)
config, then propagate toautolens_workspace/autogalaxy_workspaceconfig/so the copies
stay in parity. - Consider a small test in PyAutoFit/PyAutoGalaxy that walks
config/priors/**and asserts every
top-level key resolves to a class whose module path suffix-matches the file path and whose
declared params are in__init__— the check that found these is ~40 lines and would stop the
class of bug recurring.
Activity
Jammy2211 commentedon Sep 16, 2026
Library PR Created — 2026-09-16
pending-release)What shipped
All eleven dead rows in the packaged
autogalaxy/config/priors/fixed, plustest_autogalaxy/test_priors_config.py— a walker overconfig/priors/**asserting every top-level key suffix-matches a real PyAuto class (census ofautogalaxy,autoarray,autofit) and every parameter is an__init__argument, with model-construction regressions forNFWTruncatedMCRScatterLudlowSphandEllipseMultipoleScaled.Red witness (yaml stashed, test kept): 4 failed / 1 passed — the walker listed 9 dead keys and 2 dead params;
NFWTruncatedMCRScatterLudlowSphhad 2 of 6 priors,EllipseMultipoleScaled0 of 2. With the fix: 5 passed; fullpytest test_autogalaxy1212 passed.Two rows the plan did not list, found by the walker:
ellipse/ellipse_multipole.yaml(EllipseMultipoleRelative→EllipseMultipoleScaled,gaussian_limits→limits) andmesh/delaunay.yaml(emptyDelaunayNNkey under thedelaunayfile; module isdelaunay_nn).cosmology.yaml::model.FlatLambdaCDMconfirmed not drift, untouched.API changes
None — packaged configuration and tests only. Behaviour change for users: operated
SersicandEllipseMultipoleScaledpriors now load from their own yaml (the operated Sersic ellipticity prior becomesTruncatedGaussian(-1, 1)rather than the standard file'sGaussian+ limits).Workspace impact → option (ii),
/start_workspaceThe same rows exist verbatim in the
config/priors/copies of autolens_workspace, autogalaxy_workspace, HowToLens and autolens_workspace_test (the plan assumed the last two had no priors folder — they carry full copies, and autolens_workspace_test still ships the removedmesh/voronoi.yaml). All four get the prior edits; autolens_workspace, HowToLens and autolens_workspace_test also get the packagednest/mcmc/mleplots_search.yaml; all four drop the readerlessgeneral.yaml::fits.flip_for_ds9.Out of this task's scope, to be filed via intake as a follow-up: the same typo'd/dead rows also exist in
HowToGalaxy/config/priors,autogalaxy_workspace_test/config/priors(and itsscripts/misc/aggregator/config/priorscopy),autolens_assistant/config/priors,autogalaxy_assistant/config/priors,autocti_assistant/config/priors.euclid_strong_lens_modeling_pipelinekeeps its copy by design (euclid#43).Next: workspace PRs, one per repo, behind the library-first merge gate.
Jammy2211 commentedon Sep 16, 2026
Workspace PRs Created — 2026-09-16
Behind the library-first gate (merge #619 first):
All four carry
pending-release. Every editedconfig/priors/file is byte-identical to the fixed packaged PyAutoGalaxy copy (only residual: the workspace-deliberateDelaunay.areas_factorin autolens_workspace / HowToLensmesh/delaunay.yaml, untouched). Two decisions beyond the plan: a duplicatedSersicCore.radius_breakblock (same key twice in one mapping) was removed in three repos, and autogalaxy_workspace'splots_search.yamlwas replaced too because itsmle:block carried acorner_cornerpykey the MLE reader never looks up.Smoke Test Results — 2026-09-16
pyauto-heart smoke autolens autogalaxy howtolens autolens_test --root <task worktree>(live source = this task's branches), exit 0, ~23 min:Follow-ups filed on the Mind dashboard:
draft/bug/autogalaxy/sersiccoresph_has_no_mass_to_light_ratio.md,draft/maintenance/autogalaxy/linear_operated_sersic_has_no_prior_yaml.md,draft/maintenance/workspaces/sync_remaining_workspace_config_priors_copies.md(HowToGalaxy, autogalaxy_workspace_test ×2, autolens/autogalaxy/autocti assistants still carry the same rows).Side observation (not this task): the smoke runner deleted the tracked
autolens_workspace_test/output/.gitignorewhen wipingoutput/; restored by hand before the PR.Next:
/prmonce CI is green — library PR first, then the four workspace PRs.Jammy2211 commentedon Sep 16, 2026
Shipped — 2026-09-16
PRs
pending-release)Summary
Eleven dead rows in the packaged
autogalaxy/config/priors/(typo'd, mis-pathed, orphan and dead-param keys thatJSONPriorConfig's suffix matcher silently ignored) are fixed, andtest_autogalaxy/test_priors_config.pynow walks the packaged priors asserting every key resolves to a real class and every param is an__init__argument, so the class of bug cannot recur. The four workspaceconfig/copies are re-synced to byte parity, their stale per-searchplots_search.yamlreplaced with thenest/mcmc/mleform autofit reads, and the readerlessfits.flip_for_ds9removed. Red witness 4 failed on the old config; full suite 1212 passed; smoke 136/136 across the four workspaces; CI green on every leg of all five PRs.Session Notes
EllipseMultipoleRelative→EllipseMultipoleScaled+gaussian_limits→limits; emptyDelaunayNNkey).cosmology.yaml::model.FlatLambdaCDMis not drift.config/priors/copies (the plan assumed onlyplots_search.yaml); they got the full re-sync, including the removedmesh/voronoi.yaml.SersicCore.radius_breakblock removed in three repos; autogalaxy_workspace'splots_search.yamlreplaced too (mle:carried an unreadcorner_cornerpy).pending-release: PyAutoGalaxy@#619carried into the record.draft/bug/autogalaxy/sersiccoresph_has_no_mass_to_light_ratio.md,draft/maintenance/autogalaxy/linear_operated_sersic_has_no_prior_yaml.md,draft/maintenance/workspaces/sync_remaining_workspace_config_priors_copies.md(heuristic sizes the lasttoo-large; re-size or split before starting).autolens_workspace_test/output/.gitignorewhile wipingoutput/(restored before the PR).