Repository navigation
Closed
Description
Overview
Phase 1 of a parked workspace API-drift umbrella (PyAutoMind/draft/bug/workspaces/api_drift_callsite_fixes.md). The autofit_workspace features/interpolate.py tutorial crashes with IndexError: Cannot interpolate: no instances have been added to the interpolator — but only under test mode / CI sweeps, not in real user runs. Reproduced on clean main. Root cause is an asymmetry in Aggregator.from_directory, so the fix lands in the library.
Plan
interpolate.py:213(in-memoryLinearInterpolator) works fine; the crash is atinterpolate.py:265, the aggregator/database section.- Under
PYAUTO_TEST_MODE, searches write results tooutput/test_mode/<prefix>(via_test_mode_segment()inautofit/non_linear/paths/abstract.py), butAggregator.from_directoryreads the hardcoded non-test path → walks an empty/nonexistent dir → 0 results → emptyLinearInterpolator→IndexError: no instances. - Real (non-test) runs are unaffected — the results are at
output/<prefix>where the aggregator looks. This only bites test-mode / full-script sweeps.Aggregator.from_directoryis simply not test-mode-aware, unlike the search output paths — that asymmetry is the bug. - Chosen approach (Option A — library-side, symmetric): make
Aggregator.from_directorytest-mode-aware. Whenis_test_mode()is active and the given directory yields no metadata but thetest_mode-segment-inserted sibling exists, walk that instead (reusing_test_mode_segment()). Safe for the custom-dir aggregator scripts (result.py,overview_2), which simply won't have atest_modesibling. Fixes the whole class of aggregator-under-test-mode failures with no workspace-script masking (no injected env-vars / hardcoded test paths in user-facing tutorials).
Detailed implementation plan
Affected Repositories
- PyAutoFit (primary — library fix)
- autofit_workspace (downstream consumer — validation + notebook regen)
Branch Survey
| Repository | Current Branch | Dirty? |
|---|---|---|
| ./PyAutoFit | main | clean |
| ./autofit_workspace | main | clean |
Suggested branch: interpolator-aggregator-test-mode
Implementation Steps
- PyAutoFit: add test-mode resolution to
Aggregator.from_directory(autofit/aggregator/aggregator.py), reusing_test_mode_segment()fromautofit/non_linear/paths/abstract.py. Add a unit test undertest_autofit/aggregator/covering the test-mode directory resolution (falls through to thetest_modesibling only when the plain directory has no metadata and the sibling exists). Runpytest test_autofit/aggregator/. - autofit_workspace: confirm
scripts/features/interpolate.pyruns clean underPYAUTO_TEST_MODE=1with the patched library (no script edits expected under Option A); regenerate the notebook. - Ship library-first (
ship_library), then the workspace follow-up once API impact is confirmed.
Key Files
autofit/aggregator/aggregator.py—from_directory(currentlyos.walks the literal path)autofit/non_linear/paths/abstract.py—_test_mode_segment()/is_test_mode()to reuse../autofit_workspace/scripts/features/interpolate.py— the failing consumer (line 265)
Notes / scope corrections from triage
- HowToFit
tutorial_5_results_and_sampleswas paired with this in the original umbrella prompt but does not use the interpolator orAggregator.from_directory— excluded from this task. interpolate.pyis not currently in the workspace smoke set; the NEEDS_FIX markers named in the umbrella prompt are no longer literally in the files (curated from an earlier triage sweep).- Remaining 5 umbrella items (
ell_comps/ellipse kwargs, plotter kwarg drift, group/slam PriorException,__hash__TypeError) stay parked in the umbrella prompt for follow-up tasks.
Original Prompt
Click to expand starting prompt (umbrella — this issue scopes only the interpolator item)
# Workspace API-drift call-site fixes (kwargs / Prior / interpolator / plotter) (parked NEEDS_FIX)
Type: bug
Target: workspaces
Repos: autofit_workspace, autogalaxy_workspace, autolens_workspace, autolens_workspace_test, HowToGalaxy, HowToLens, HowToFit, PyAutoFit
Difficulty: medium | Autonomy: supervised | Priority: normal
A set of independent "script uses stale API after a library change" NEEDS_FIX markers. Each is a
targeted call-site (or small library) fix; some pairs share one bug across repos. Reproduce each on
clean main; remove its NEEDS_FIX marker when green. Split into separate PRs if they touch different libs.
- InstanceInterpolator IndexError (likely a PyAutoFit bug, not just call-site): autofit_workspace features/interpolate + HowToFit chapter_1 tutorial_5 (same family).
- ell_comps kwargs KeyError: autogalaxy_workspace imaging/modeling + HowToGalaxy same.
- ellipse kwargs KeyError 'ellipses.0.centre_0': HowToGalaxy ellipse/modeling.
- plotter kwarg drift plot_grid() unexpected 'plot_grid_lines': HowToGalaxy guides/advanced/over_sampling.
- group/slam PriorException (upper<=lower): autolens_workspace group/slam + HowToLens group/slam.
- __hash__ returns non-int TypeError in linear_light_profile_intensity_dict: autolens_workspace_test database/scrape/general.
First step: triage the interpolator one first (library, 2 repos) — likely the highest-value single fix.
Metadata
Metadata
Assignees
Labels
No labels
Activity
Jammy2211 commentedon Jul 21, 2026
Library PR Created — awaiting human merge
PR: #1402 (
feature/interpolator-aggregator-test-mode, labelpending-release)Made
Aggregator.from_directorytest-mode-aware: whenis_test_mode()is active and the first scan finds no search-outputs, it retries once against thetest_modesibling (<dir>.parent/"test_mode"/<dir>.name). Reproduced theIndexErroron cleanmainfirst — the crash was atinterpolate.py:265(aggregator/DB section), not the in-memory interpolation, and only under test mode.Autonomous-ship gate
test_autofit/aggregator/(93 withinterpolator/), incl. 2 newfrom_directorytest-mode testsinterpolate.pyis not in the smoke set; validated directly underPYAUTO_TEST_MODE=1(exit 0, 3 outputs loaded, interpolation succeeds)is_test_mode()+.exists(), proven by the off-switch test)PyAutoLens/paper_jax/paper.mdWIP); all YELLOW reasons pre-existing/unrelatedWorkspace impact — option (iii), no migration
Behaviour-compatible: all 23
from_directorycall-sites across the workspaces keep working unchanged.interpolate.pyis fixed by the library alone (no script edit → notebook stays in sync), so noship_workspacefollow-up is needed for this item.Scope
Phase 1 of the workspaces API-drift umbrella. HowToFit
tutorial_5was paired in the umbrella but does not use the interpolator/aggregator — excluded. The other 5 umbrella items remain parked inPyAutoMind/draft/bug/workspaces/api_drift_callsite_fixes.mdfor follow-up tasks.Run ended at PR-open (
--auto); merge stays human.Jammy2211 commentedon Jul 21, 2026
Shipped ✅
#1402 merged 2026-07-21.
Aggregator.from_directoryis now test-mode-aware;features/interpolate.pyruns clean underPYAUTO_TEST_MODE=1. Completion record:PyAutoMind/complete/2026/07/interpolator-aggregator-test-mode.md.Closing — this was Phase 1 (interpolator) of the workspaces API-drift umbrella; the remaining 5 items are tracked in
draft/bug/workspaces/api_drift_callsite_fixes.mdand will open as their own follow-up tasks.