Overview
Release-wheel validation fails all six PyAutoFit database scripts with a bare AssertionError, while the same source passes in the development environment. Reproduce the failure in the exact Python 3.12 TestPyPI wheel stack, isolate the dependency that changes behaviour, and fix the latent-variable loading producer in PyAutoFit without masking the warning or weakening workspace assertions.
Plan
- Reproduce
scripts/database/scrape/general.py in an isolated wheel-only Python 3.12 environment and capture the complete traceback and package manifest.
- Pin SQLAlchemy, NumPy, and dill independently to isolate the dependency that flips the result, then repeat the winning forward/backward transition to establish causality.
- Trace the failure through latent-sample file loading and database serialization, fixing the producer in PyAutoFit rather than adding a workspace workaround or silent guard.
- Add focused regression coverage for latent-variable scraping/loading under the triggering dependency behaviour.
- Validate focused and full PyAutoFit tests, the exact reproduction, and all six database integration scripts.
Detailed implementation plan
Affected Repositories
- PyAutoFit (primary; source and unit-test changes)
- autofit_workspace_test (validation only; no script changes expected)
Work Classification
Library
Branch Survey
| Repository |
Current Branch |
Dirty? |
| ./PyAutoFit |
main |
clean |
| ./autofit_workspace_test |
main |
clean |
No active worktree claims PyAutoFit. The workspace is a read-only reproduction and validation surface.
Suggested branch: feature/database-latent-wheel-load
Worktree root: ~/Code/PyAutoLabs-wt/database-latent-wheel-load/
Implementation Steps
- Create an isolated Python 3.12 environment with TestPyPI
autolens[optional]==2026.7.13.1.dev65601, jax, jaxnnls, and jax_zero_contour. Record pip freeze, verify the imported autofit location is inside the venv, and ensure no local source checkout is on PYTHONPATH.
- Remove prior generated output/database files, run
autofit_workspace_test/scripts/database/scrape/general.py under the release profile, and preserve the full Python traceback plus the produced files/latent/ artifacts.
- Hold the wheel environment fixed and vary one dependency at a time. Compare SQLAlchemy 2.0.51 with the dev version 2.0.32, NumPy 2.4.6 with the dev version 2.2.6, and dill 0.4.1 with a preceding compatible release as a control. Use
--no-deps, pip check, and a clean output directory for every run. Reinstall the triggering version after the passing pin to prove the failure returns.
- Trace the actual exception through
SearchOutput._load_samples, _add_files_fit, and the database Fit/Object serialization path. Patch the component that produces or reconstructs the invalid latent samples. Do not broaden the warning catch to suppress the exception, silently omit latent data, or change workspace assertions to tolerate corrupt/missing data.
- Add a regression fixture that contains real latent
samples.csv and samples_info.json output and exercises the scrape-to-database round trip. Assert the latent samples retain their class, parameter values, model, and usable summary/instance after loading.
- Run the focused aggregator/database tests, the relevant PyAutoFit test subtrees, then the full
test_autofit/ suite. Re-run the exact wheel-stack script and all six scripts/database/{directory,scrape}/ scripts to confirm the release failure is removed.
Key Files
autofit/aggregator/search_output.py — latent sample CSV/metadata reconstruction and likely exception origin.
autofit/database/aggregator/scrape.py — boundary that assigns latent samples and currently emits the warning.
autofit/database/model/fit.py — database representation of latent samples.
autofit/database/model/ — object reconstruction if dependency behaviour changes serialization.
test_autofit/aggregator/test_scrape.py — focused scraper regression coverage.
test_autofit/database/test_serialize.py — database round-trip coverage if the traceback reaches object reconstruction.
autofit_workspace_test/scripts/database/scrape/general.py — exact reproduction and validation script; no masking edits expected.
Original Prompt
Click to expand starting prompt
Database scripts fail on release wheels: "Failed to load latent variables" → AssertionError
Type: bug
Target: autofit
Repos:
- PyAutoFit
- autofit_workspace_test
Difficulty: medium
Autonomy: supervised
Priority: normal
Status: formalised
Surfaced burning down the 2026-07-13 release-validation tail (PyAutoHeart#72). On the release
wheels (mode=release), all six autofit_workspace_test/scripts/database/** scripts fail
FAST (4–13 s) with a bare AssertionError:
scripts/database/directory/general.py ... FAIL (5.4s) AssertionError
scripts/database/directory/multi_analysis.py... FAIL (4.4s) AssertionError
scripts/database/scrape/general.py ... FAIL (4.3s) AssertionError
scripts/database/scrape/grid_search.py ... FAIL (8.8s) AssertionError
scripts/database/scrape/multi_analysis.py ... FAIL (4.4s) AssertionError
scripts/database/scrape/sensitivity.py ... FAIL (12.7s) AssertionError
with a recurring warning:
autofit.database.aggregator.scrape - WARNING - Failed to load latent variables for <hash>
Not jax, not perf, not the release profile. These PASS on the current dev venv
(jax 0.10.2) even under the release profile (PYAUTO_TEST_MODE=0) — the latent-variable
load emits only the WARNING there and the assertion passes. The wheel code is identical to
main HEAD, so the delta is the wheel-env dependency set: the release stack resolves
SQLAlchemy 2.0.51, dill 0.4.1, numpy 2.4.6 (full list in the rehearsal install log of
run 29279095224). The most likely culprit is a serialization/deserialization
incompatibility in the latent-variable load path (autofit.database.aggregator.scrape →
whatever loads latent samples from the SQLAlchemy-backed database) under one of those
dependency versions.
Reproduce with the wheel dependency set (the dev venv won't show it): build a venv with
the release stack — pip install --index-url https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple/ "autolens[optional]==2026.7.13.1.dev65601" jax jaxnnls jax_zero_contour
(a scratch rel-venv approximating this already exists from the 2026-07-14 session) — then run
scripts/database/scrape/general.py from autofit_workspace_test/ and capture the full
traceback (the one-line CI summary hides the assertion detail). Isolate which dependency flips
it (SQLAlchemy vs dill vs numpy) by pinning them one at a time.
Fix the producer of the bad load (don't silence the warning — [[feedback_no_silent_guards]]):
if latent variables genuinely fail to deserialize under the newer dep, fix the
load/serialization in autofit.database; if the scripts' assertion is over-strict about a
tolerable-missing latent, fix the assertion. Release run: PyAutoHeart workspace-validation
29279095224, TestPyPI 2026.7.13.1.dev65601. See [[project_release_2026_07_13_blocked_3bugs]].
Overview
Release-wheel validation fails all six PyAutoFit database scripts with a bare
AssertionError, while the same source passes in the development environment. Reproduce the failure in the exact Python 3.12 TestPyPI wheel stack, isolate the dependency that changes behaviour, and fix the latent-variable loading producer in PyAutoFit without masking the warning or weakening workspace assertions.Plan
scripts/database/scrape/general.pyin an isolated wheel-only Python 3.12 environment and capture the complete traceback and package manifest.Detailed implementation plan
Affected Repositories
Work Classification
Library
Branch Survey
No active worktree claims PyAutoFit. The workspace is a read-only reproduction and validation surface.
Suggested branch:
feature/database-latent-wheel-loadWorktree root:
~/Code/PyAutoLabs-wt/database-latent-wheel-load/Implementation Steps
autolens[optional]==2026.7.13.1.dev65601,jax,jaxnnls, andjax_zero_contour. Recordpip freeze, verify the importedautofitlocation is inside the venv, and ensure no local source checkout is onPYTHONPATH.autofit_workspace_test/scripts/database/scrape/general.pyunder the release profile, and preserve the full Python traceback plus the producedfiles/latent/artifacts.--no-deps,pip check, and a clean output directory for every run. Reinstall the triggering version after the passing pin to prove the failure returns.SearchOutput._load_samples,_add_files_fit, and the databaseFit/Objectserialization path. Patch the component that produces or reconstructs the invalid latent samples. Do not broaden the warning catch to suppress the exception, silently omit latent data, or change workspace assertions to tolerate corrupt/missing data.samples.csvandsamples_info.jsonoutput and exercises the scrape-to-database round trip. Assert the latent samples retain their class, parameter values, model, and usable summary/instance after loading.test_autofit/suite. Re-run the exact wheel-stack script and all sixscripts/database/{directory,scrape}/scripts to confirm the release failure is removed.Key Files
autofit/aggregator/search_output.py— latent sample CSV/metadata reconstruction and likely exception origin.autofit/database/aggregator/scrape.py— boundary that assigns latent samples and currently emits the warning.autofit/database/model/fit.py— database representation of latent samples.autofit/database/model/— object reconstruction if dependency behaviour changes serialization.test_autofit/aggregator/test_scrape.py— focused scraper regression coverage.test_autofit/database/test_serialize.py— database round-trip coverage if the traceback reaches object reconstruction.autofit_workspace_test/scripts/database/scrape/general.py— exact reproduction and validation script; no masking edits expected.Original Prompt
Click to expand starting prompt
Database scripts fail on release wheels: "Failed to load latent variables" → AssertionError
Type: bug
Target: autofit
Repos:
Difficulty: medium
Autonomy: supervised
Priority: normal
Status: formalised
Surfaced burning down the 2026-07-13 release-validation tail (PyAutoHeart#72). On the release
wheels (mode=release), all six
autofit_workspace_test/scripts/database/**scripts failFAST (4–13 s) with a bare
AssertionError:with a recurring warning:
Not jax, not perf, not the release profile. These PASS on the current dev venv
(jax 0.10.2) even under the release profile (
PYAUTO_TEST_MODE=0) — the latent-variableload emits only the WARNING there and the assertion passes. The wheel code is identical to
main HEAD, so the delta is the wheel-env dependency set: the release stack resolves
SQLAlchemy 2.0.51,dill 0.4.1,numpy 2.4.6(full list in the rehearsal install log ofrun
29279095224). The most likely culprit is a serialization/deserializationincompatibility in the latent-variable load path (
autofit.database.aggregator.scrape→whatever loads latent samples from the SQLAlchemy-backed database) under one of those
dependency versions.
Reproduce with the wheel dependency set (the dev venv won't show it): build a venv with
the release stack —
pip install --index-url https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple/ "autolens[optional]==2026.7.13.1.dev65601" jax jaxnnls jax_zero_contour(a scratch
rel-venvapproximating this already exists from the 2026-07-14 session) — then runscripts/database/scrape/general.pyfromautofit_workspace_test/and capture the fulltraceback (the one-line CI summary hides the assertion detail). Isolate which dependency flips
it (SQLAlchemy vs dill vs numpy) by pinning them one at a time.
Fix the producer of the bad load (don't silence the warning — [[feedback_no_silent_guards]]):
if latent variables genuinely fail to deserialize under the newer dep, fix the
load/serialization in
autofit.database; if the scripts' assertion is over-strict about atolerable-missing latent, fix the assertion. Release run: PyAutoHeart workspace-validation
29279095224, TestPyPI2026.7.13.1.dev65601. See [[project_release_2026_07_13_blocked_3bugs]].