feat(heart): Colab gate — check F seeds from Google's manifest and audits every lazy import - #228
Merged
Merged
Conversation
…st (#227) Check F emulated Colab with `pip install autolens jax` WITH dependencies, so its venv already held every package the real --no-deps bootstrap would miss; `corner` was absent on Colab on 2026-09-15 and no gate saw it. - heart/checks/colab_gate.py: `seed` builds a python3.12 venv holding only the packages Google's Colab manifest (googlecolab/backend-info) ships that the stack's resolved closure needs; `verify` walks declared requirements, AST-scans every third-party import in the installed libraries (guarded or not), imports each for real, constructs the tutorial searches, and FAILs on any unguarded miss. - verify_install.sh: check F runs seed -> verbatim setup cell -> verify -> notebook cell; with-deps stack install removed; COLAB_GATE_AUTONERVES_SRC overlay for witness runs; gate JSON nested under checks[F].colab_gate. - Vendored manifest snapshot, empty heart/config/colab_gate.yaml accepted_missing, 43 new tests, check F docs rewritten. Witness: PyPI as-is -> F|FAIL naming corner (74 s); PyAutoNerves#167 overlaid -> corner/blackjax cleared, five library-side unguarded imports remain (jax_zero_contour, zeus, colossus, hmf, mcp). Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
…with Nerves#167 + extras Three of the five library-side holes are not notebook paths: colossus and hmf (autolens/lens/los.py line-of-sight tooling, test/dev extra) and mcp (autofit/mcp/server.py, the MCP server entry point). They are accepted with written reasons in heart/config/colab_gate.yaml. The other two (jax_zero_contour, zeus-mcmc) are real Colab breakages and join _SHARED_EXTRAS on the PyAutoNerves branch. Check F with that branch overlaid now reports F|PASS. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Contributor
Author
|
Leg 3: with the extended PyAutoNerves branch (jax_zero_contour + zeus-mcmc in _SHARED_EXTRAS; colossus/hmf/mcp accepted with reasons in colab_gate.yaml) check F reports F|PASS in 179 s — 87 Colab-provided, 11 extras, 39 imports probed, 0 FAILs / 32 WARNs. 1016 unit tests green. |
2 of 3 tasks
Contributor
Author
|
Nerves PR: PyAutoLabs/PyAutoNerves#169 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Closes #227.
Heart check F is the release-time "Colab simulation", and until now it emulated Colab by
pip install autolens jaxwith dependencies. That venv already held every package the real--no-depsbootstrap inautonerves.setup_colabwould miss, so the check could never see a missing dependency. On 2026-09-15corner— a base autofit dependency imported lazily insidecorner_cornerpy— was absent on Colab and HowToFit tutorial 5 died mid-workshop after its emcee run; workspace smoke (PYAUTO_TEST_MODE=2, samplers never constructed) and check F both reported green.This PR makes check F a faithful Colab gate:
googlecolab/backend-infopip-freeze.txt, fetched live →$HEART_STATE_DIRcache → vendored snapshot), installing only the manifest packages the stack's resolved closure needs, completed to a self-consistent subset. Nothing absent from Colab's manifest is ever installed.pip install autonerves --no-deps→setup_colab.setup("autolens")→ workspace clone), unchanged.try/except ImportError), imports each module for real, and constructsaf.Emcee/DynestyStatic/Nautilus/LBFGS. Unguarded import failure → FAIL (readiness RED, stage-3 report fails). Guarded misses, version conflicts and never-imported declared deps → WARN.verify_install_releaselane); running notebooks end to end at real settings (rungs 3/4) tests a different bug class and is declined for this gate.Witness (both legs run locally against live PyPI, manifest fetched live 2026-09-15)
F FAIL colab gate: blackjax (…/blackjax/nuts/search.py:260); colossus (autolens/lens/los.py:207); corner (autofit/non_linear/plot/samples_plotters.py:95); +6 moreCOLAB_GATE_AUTONERVES_SRC= PyAutoNervesfeature/colab-bootstrap-lazy-deps(PyAutoNerves#167)F FAIL colab gate: colossus (autolens/lens/los.py:207); hmf (autolens/lens/los.py:147); jax_zero_contour (autogalaxy/operate/lens_calc.py:1452); +3 moreLeg 1 reproduces the 2026-09-15 failure that every existing gate missed. Leg 2 shows the gate flips on exactly the
_SHARED_EXTRASchange: PyAutoNerves#167 clearscornerandblackjaxand five of seven version conflicts.Merge consequence and how the holes were closed
The gate found five library-side unguarded lazy imports of packages Colab does not ship. They were resolved on 2026-09-15, in two places:
_SHARED_EXTRASon the PyAutoNerves branch (PyAutoNerves#167 follow-up PR):jax_zero_contour>=2.0.0,<3.0.0(an autogalaxy base dependency reached byautogalaxy/operate/lens_calc.py:1452,1884, guarded atplot_utils.py:429but not there) andzeus-mcmc==2.5.4(af.Zeus, run by autofit_workspace notebooks). Every runtime requirement of both is already shipped by Colab.heart/config/colab_gate.yamlaccepted_missing, each with a written reason (second commit on this PR):colossusandhmf(autolens/lens/los.pyline-of-sight tooling, test/dev extra;hmfis declared in no pyproject at all, a library follow-up), andmcp(autofit/mcp/server.py, the MCP server entry point, unconditional import is correct there).Leg 3 (this PR + the extended Nerves branch overlaid):
179 s, 0 FAILs, 32 WARNs (the three accepted names with reasons echoed;
networkx==3.1/psutil==6.1.0autofit pins vs Colab 3.6.1 / 5.9.5; guardedcoolest,nufftax; five declared-but-never-imported deps; the 20 closure packages Colab does not ship, all now arriving via extras).The release-integrate run stays RED until the autonerves carrying PyAutoNerves#167 and its follow-up is on PyPI — check F installs autonerves from the index. That is the gate working; the ordering is: merge this, merge the Nerves PR, release autonerves.
Scripts Changed
heart/checks/colab_gate.py(new) —seed/verifygate.seedresolves the with-deps closure viapip install --dry-run --report -without installing it, installs only the part Colab also ships at Colab's pins, then completes that set to a self-consistent Colab subset.verifywalks declared requirements, AST-scans every import (guarded = inside atrywhose handlers catch ImportError/ModuleNotFoundError/Exception/bare), probes each module for real (a failing module whose distribution Colab ships is installed at Colab's pin and re-probed), constructs the four tutorial searches, and applies the verdict. Stdlib +packaging; pure functions throughout; JSON report.heart/checks/colab_pip_freeze.snapshot.txt(new) — vendoredgooglecolab/backend-infomanifest, fetched 2026-09-15; last fallback behind live fetch →$HEART_STATE_DIR/colab_pip_freeze.txtcache.heart/config/colab_gate.yaml(new) —accepted_missing:exemptions keyed by module name, each with a one-line reason:colossus,hmf,mcp(see above). A shipped-config test asserts exactly this set.heart/checks/verify_install.sh— check F rebuilt:python3.12venv (missing interpreter → FAIL, the check B/E rule), the with-depspip install <stack> jaxdeleted, gateseedbefore the setup cell andverifybetween the setup cell and the notebook cell. Setup cell,google.colabstub, exit-3 SKIP and thecosmos_web_ringnotebook cell unchanged. NewCOLAB_GATE_AUTONERVES_SRCdev/witness overlay. Gate JSON nested additively atchecks[F].colab_gatein the readiness sidecar; gate temp files swept viaARTEFACTS(honours--keep).tests/test_colab_gate.py(new, 34 tests) +tests/test_verify_install_script.py(+9) — manifest parsing/normalisation, live→cache→snapshot fallback, closure intersection, requirement walk, AST scan, verdict rules incl.accepted_missingand the imported-missing FAIL, and a round-trip of the real sidecar writer throughreadiness.compute. No network, no venv.skills/verify_install/verify_install.md,docs/release_validation.md,health_agent/capabilities.yaml,bin/pyauto-heart— check F description rewritten (the old row still namedautoconfanddataset/imaging/simple), with an explicit statement of what the simulation does not cover: GPU, OS, and the manifest's 1–2 day lag.Test Plan
python3 -m pytest -q -n autoin PyAutoHeart: 1015 passed (baseline 1013 + the new modules' own tests; the two late fixes — seed completion and import heal — brought their own tests)F|FAILnamingcorner(74 s)corner,blackjaxcleared; five library-side FAILs remain (66 s)colab_gateparses throughreadiness.computeF|PASS(179 s), 1016 testsGenerated by the PyAutoLabs agent workflow.
🤖 Generated with Claude Code