Skip to content

Commit 3dc6768

Browse files
authored
Merge pull request #311 from PyAutoLabs/claude/aplt-output-drift-repos-33n81z
prompt: close out aplt-output-drift-remaining-repos + file its three follow-ups
2 parents 464a366 + 82276a1 commit 3dc6768

9 files changed

Lines changed: 514 additions & 119 deletions

File tree

Lines changed: 184 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,184 @@
1+
Repaired the `aplt.Output` stale-API drift in the last two repos the
2+
2026-08-04 `plot-array-stale-kwargs` task deliberately stopped short of — and
3+
found that the drift's real shape was not what the prompt described.
4+
5+
## Outcome
6+
7+
| Repo | PR | Merged |
8+
|---|---|---|
9+
| PyAutoGalaxy | [#586](https://github.com/PyAutoLabs/PyAutoGalaxy/pull/586) | `d68a8f6` |
10+
| euclid_strong_lens_modeling_pipeline | [#39](https://github.com/PyAutoLabs/euclid_strong_lens_modeling_pipeline/pull/39) | `62b2fd4` |
11+
12+
Classification changed during planning from workspace-only to **library +
13+
workspace**, which is why a PyAutoGalaxy PR exists at all.
14+
15+
## The prompt was wrong in three ways, each found by verifying rather than trusting
16+
17+
**1. `autocti_workspace_test` is out of scope — the hedge resolved, then the
18+
scope collapsed.** The prompt flagged 27 files as "UNVERIFIED — check first",
19+
suspecting PyAutoCTI might still export `Output`. It does not:
20+
`autocti/plot/__init__.py` is 49 lines of flat functions. So those files are
21+
genuinely broken — but an alias-aware scan found **31**, not 27, and:
22+
23+
- **18 are under `legacy/`**, which `autocti_workspace_test/AGENTS.md:52`
24+
forbids editing ("preserved Euclid VIS history"). Its README says outright
25+
that they target the removed Plotter object stack and are not runnable.
26+
- **13 are top-level `imaging_ci/`** — undocumented in AGENTS.md's structure
27+
block, absent from `smoke_tests.txt`, substantive history **2023-02**, the
28+
same era as `legacy/` (created 2026-07-17 by "CTI resurrection Phase 5").
29+
Its only 2026 commits are repo-wide mechanical sweeps that also hit `legacy/`.
30+
31+
Following the prompt literally would have modernised dead code *and* violated
32+
the repo's own hard rule. Filed as
33+
`draft/maintenance/autocti_workspace_test/imaging_ci_heritage_sweep.md` for a
34+
human decision against the CTI resurrection epic (PyAutoCTI#82).
35+
36+
**2. The drift was never really about `Output`.** The whole plotter-object stack
37+
is gone from every public namespace — `MatPlot2D`, `MatPlot1D`, `Cmap`,
38+
`Array2DPlotter`, `Visuals2D`, `MassProfileCentresScatter`, the `*Plotter`
39+
family. `Output` was 6 of 13 missing symbols in autocti, 2 of 6 in euclid.
40+
41+
**3. Two library defects the prompt never mentioned.** `Cmap` is exported by
42+
**no** public plot namespace, yet:
43+
44+
- `Scribbler.__init__` required a `Cmap`-shaped object for `cmap=`, so callers
45+
had no public way to colour the GUI.
46+
- `Clicker.start()` built `aplt.Cmap(...)` on `autoarray.plot`
47+
*unconditionally* — reproduced on the installed stack as
48+
`AttributeError: module 'autoarray.plot' has no attribute 'Cmap'`. That GUI
49+
was dead for every caller.
50+
51+
Fixed library-side because the only workspace alternative was a private-path
52+
import — the "autoimmune reaction" the Bug Agent's fix-locus rule warns against.
53+
54+
## The plan's worst assumption, caught before it shipped
55+
56+
The approved plan said euclid's explicit `mask=` could simply drop out, since
57+
`plot_array` auto-derives the outline. It cannot. `data` there comes from
58+
`Array2D.from_fits` and is **unmasked**, so `auto_mask_edge(data)` returns
59+
`None` — verified directly. Worse, the mask being drawn is a *separately
60+
constructed* circular one whose radius is grown at line 160 to enclose the
61+
clicked galaxies, so it is the entire subject of the figure.
62+
63+
A literal reading would have silently deleted the mask radius from the PNG that
64+
exists to show it, and nothing would have failed. Fixing it needed a second
65+
library change: autogalaxy's `plot_array` wrapper delegates to autoarray's but
66+
was dropping its `mask=` parameter.
67+
68+
## Verification
69+
70+
- PyAutoGalaxy CI green on **every leg**: `unittest (3.12)`, `unittest (3.13)`,
71+
`unittest-nojax`, Docs. 1129 tests, 16 new across two files (`test_autogalaxy/gui/`
72+
did not previously exist).
73+
- Alias-aware AST re-scan — aliases resolved from each file's own imports, the
74+
correction carried forward from HowToGalaxy#56**0 residual stale symbols**
75+
in both repos.
76+
- All 10 changed `aplt.*`/`al.*` calls bound against real signatures: 10 ok, 0 failures.
77+
- Mask passthrough verified by **rendering**: 2436 pixels differ vs. the same
78+
call without `mask=`, confirmed by pixel diff rather than file size.
79+
- `compileall` clean; CRLF preserved uniformly (see below).
80+
81+
## Not verified, stated plainly
82+
83+
- **The two euclid GUIs were never run end-to-end.** They need TkAgg and FITS
84+
data absent from the repo, and euclid has **no CI workflows at all**. The
85+
merge was made with that stated and acknowledged.
86+
- **`Scribbler.__init__` has no direct test**`matplotlib.use("TkAgg")` and
87+
`wm_geometry` cannot run headless. The extracted `norm_from` helper carries
88+
the logic and is fully tested; the constructor is covered only by binding.
89+
90+
## Behaviour change accepted
91+
92+
Extra-galaxy centre markers were cyan via `MassProfileCentresScatter(c="cy")`
93+
and are now the `plot_array` default. `autoarray/plot/array.py:258-262`
94+
hardcodes the overlay colour cycle, and `line_colors` (265-273) applies to
95+
`lines`, not `positions` — an early misreading of mine, corrected before it
96+
reached the code. Restoring the colour needs a PyAutoArray change; markers
97+
remain visible and distinguishable from the mask outline by size and z-order.
98+
99+
## Process note
100+
101+
An intermediate "suite green" reading was wrong twice and caught both times:
102+
pytest had exited 4 on an unrecognised `--timeout` flag without running, and a
103+
later run was corrupted when a `git stash` reverted the tree mid-run. Reported
104+
results come from clean runs on the final tree. Separately, a stop-hook flagged
105+
the PyAutoGalaxy branch as unpushed: the commit *was* on GitHub, but the
106+
`--depth 1` clone's single-branch refspec meant no remote-tracking ref existed,
107+
so `@{u}` could not resolve — repaired by widening the refspec.
108+
109+
## Follow-ups filed, not fixed
110+
111+
- `draft/maintenance/autocti_workspace_test/imaging_ci_heritage_sweep.md` — the
112+
13 heritage files the `legacy/` sweep missed.
113+
- `autoarray` duplicates this normalisation inline in `plot/array.py` and
114+
`plot/inversion.py`; a shared helper there is the real fix. This task added
115+
one copy in autogalaxy serving both GUIs rather than a third inline copy.
116+
- euclid's three `tools/` files are **100% CRLF on `main`**, contradicting its
117+
own AGENTS.md ("CRLF will break shell scripts on the HPC"). Preserved rather
118+
than converted, to avoid whole-file diffs that would not fix the repo-wide
119+
problem.
120+
121+
## Original prompt
122+
123+
# `aplt.Output` stale-API drift in the remaining workspace repos
124+
125+
Type: bug
126+
Target: workspaces
127+
Repos:
128+
- autocti_workspace_test
129+
- euclid_strong_lens_modeling_pipeline
130+
Difficulty: small
131+
Autonomy: supervised
132+
Priority: normal
133+
Status: formalised
134+
Filed: 2026-08-04 (backfilled from git)
135+
Issued: 2026-08-24
136+
137+
Split out of `plot-array-stale-kwargs` (HowToGalaxy#56, 2026-08-04), which
138+
repaired this same drift in `autolens_workspace_developer` but deliberately
139+
stopped at that repo's boundary.
140+
141+
## The drift
142+
143+
`aplt.Output` no longer exists on the **autolens / autogalaxy** plot namespace —
144+
verified: `hasattr(autolens.plot, "Output") == False`. It survives only as
145+
`autoarray.plot.Output`. The removal was deliberate and is already documented in
146+
`autolens_assistant/AGENTS.md:218` ("the `aplt.MatPlot2D` / `aplt.Output` objects
147+
have been removed — do not use them").
148+
149+
Callers must move to the flat convention. Note the accepted kwargs differ per
150+
callee — check each signature rather than blanket-renaming:
151+
152+
```python
153+
# plot_array takes all three
154+
aplt.plot_array(array=..., output_path=P, output_filename=F, output_format="png")
155+
# subplot_* take only path + format (no output_filename)
156+
aplt.subplot_tracer(tracer=..., grid=..., output_path=P, output_format="png")
157+
```
158+
159+
## Sites
160+
161+
| Repo | Files | Status |
162+
|------|-------|--------|
163+
| `autocti_workspace_test` | 27 | **UNVERIFIED — check first** |
164+
| `euclid_strong_lens_modeling_pipeline/tools/` | 2 (`psf_size.py`, `extra_galaxies_centres_gui.py`) | confirmed broken |
165+
166+
**Do not assume the autocti files are broken.** Those import
167+
`import autocti.plot as aplt` — a *different* library's plot namespace.
168+
`autocti` was not installed in the 2026-08-04 session so it could not be
169+
checked. PyAutoCTI may still export `Output`, in which case those 27 files are
170+
correct as written and must be left alone. Verify with
171+
`hasattr(autocti.plot, "Output")` before touching anything.
172+
173+
Confirmed **not** bugs, do not "fix" them:
174+
- `PyAutoArray/test_autoarray/plot/test_output.py` — there `aplt` *is*
175+
`autoarray.plot`, which does export `Output`.
176+
- `autolens_assistant` markdown — documents the removal.
177+
178+
## Verification
179+
180+
Re-run an alias-aware AST scan after the fix (the 2026-08-04 session's first
181+
sweep hardcoded the alias `aplt` and **missed** a call site written as `aaplt`;
182+
resolve aliases from each file's own imports). Then bind each changed call's
183+
kwargs against the real callee signature via `inspect.signature`, since these
184+
repos have little or no CI to catch a wrong kwarg name.

complete/index.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ Token-light navigation over the finished-work records (schema:
66
only then grep a dated bucket. Curators: edit the band between the CURATED
77
markers; everything below GENERATED is rebuilt.
88

9-
1125 records across 7 buckets.
9+
1126 records across 7 buckets.
1010

1111
<!-- CURATED:START -->
1212
## Highlights
@@ -20,6 +20,7 @@ _(curate hard-won records here — survives regeneration.)_
2020

2121
- [actionable-health-board](2026/08/actionable-health-board.md) — closed on ship
2222
- [active-prompt-orphan-triage](2026/08/active-prompt-orphan-triage.md)
23+
- [aplt-output-drift-remaining-repos](2026/08/aplt-output-drift-remaining-repos.md)
2324
- [arcticpy-install-standardisation](2026/08/arcticpy-install-standardisation.md)
2425
- [arxiv-inbox-tier](2026/08/arxiv-inbox-tier.md) — the nightly strong-lensing digest no longer ends in a Slack paste-block the
2526
- [astropy-cap-bump](2026/08/astropy-cap-bump.md) — closed manually post-merge — "Part of" in the PR bodies does not auto-close

0 commit comments

Comments
 (0)