feat: import_time observation leg — off-tick import-cost regression tracking (#61)#62
Merged
Merged
Conversation
…racking (#61) Deferred optional follow-up from the hygiene conductor epic. Adds a PyAutoHeart leg that tracks PyAuto library import cost over time and flags regressions. - heart/checks/import_time.py: measures `import <pkg>` per library in a SUBPROCESS (HYGIENE_PYTHON, default python3) so Heart's own process never imports the science/JAX stack (internals rule 4); the measurer is injected so the stdlib-only tests never touch it. Rolling per-package baseline (~/.pyauto-heart/timings-import/), ratio-vs-median classification (1.5/3.0 factors, config-driven), writes ~/.pyauto-heart/import_time.json + a colored summary. OFF-TICK by design: `import autolens` ~several seconds does not fit the <30s watch-loop budget (rule 3), so this runs on a daily cron / on demand (`python -m heart.checks.import_time`) and is NOT wired into tick.sh. - heart/state.py: aggregate the import_time.json sidecar into the snapshot. - heart/dashboard.py: advisory "Import timing" section (local-only family); surfaced on the board but absent from the readiness gating set — import time is not release-blocking. - tests/test_import_time.py: 7 stdlib-only classifier tests (injected measurer). Validated live: correctly times the 4 importable libs in this venv and marks the one missing lib `unavailable` without crashing. Full suite 251 pass. Follow-on (PyAutoBrain): wire the hygiene `perf` mode to read import_time.json when present, keeping its own subprocess scan as the fallback. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Tw3EwV55k6VzxorYng3Kfn
This was referenced Jul 11, 2026
Jammy2211
added a commit
that referenced
this pull request
Jul 11, 2026
) (#64) Phase 4a of the hygiene perf mode (first of three original-prompt capabilities the shipped perf mode didn't cover). Tracks library unit-test durations over time and flags slow-test regressions, mirroring the import_time leg (#62). - heart/checks/unit_test_timing.py: runs `pytest --durations=N` per library in a SUBPROCESS (rule 4: Heart never imports the test stack; runner injected so the stdlib-only tests use fixtures). Parses the slowest-durations report, rolling per-test baseline (~/.pyauto-heart/timings-unit/), ratio classify (1.5/3.0), writes ~/.pyauto-heart/unit_test_timing.json + colored summary. OFF-TICK (suites take minutes → daily cron / on demand, NOT tick.sh). - heart/state.py + heart/dashboard.py: aggregate + advisory "Unit-test timing" section (local-only family); NOT in the readiness gating set (test speed is not release-blocking). - tests/test_unit_test_timing.py: 6 stdlib-only tests (injected runner) incl. a parser test against real pytest --durations output. Parser validated live against real pytest output. Full suite 257 pass. Follow-on (PyAutoBrain): hygiene perf reads unit_test_timing.json when present. Claude-Session: https://claude.ai/code/session_01Tw3EwV55k6VzxorYng3Kfn Co-authored-by: Jammy2211 <JNightingale2211@gmail.com> Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
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.
Closes #61.
What
An off-tick PyAutoHeart leg that tracks PyAuto library import cost over time and flags regressions — the deferred optional follow-up from the hygiene conductor epic.
Design (from the research on #61)
import autolenscosts several seconds (the whole stack; more cold) and every check intick.shruns every ~5-min cycle, so this cannot live in the <30s watch-loop budget (docs/internals.mdrule 3). It is therefore off-tick: run on a daily cron / on demand and not wired intotick.sh:~/.pyauto-heart/timings-import/), ratio-vs-median classification (1.5/3.0 factors, config-driven) — mirrorsscript_timing.~/.pyauto-heart/import_time.json+ a colored summary line.Changes
heart/checks/import_time.py— the check (new).heart/state.py— aggregate theimport_time.jsonsidecar into the snapshot.heart/dashboard.py— advisory Import timing section + local-only family.tests/test_import_time.py— 7 stdlib-only classifier tests (injected measurer)..gitignore— ignore strayroot.log.Gate (
--auto, supervised)root.log).Validated live
Correctly timed the 4 importable libs in the local venv and marked
autolens(genuinely not installed there)unavailablewithout crashing; dashboard renders the section;import_time.jsonwritten.Follow-on
PyAutoBrain: wire the hygiene
perfmode to readimport_time.jsonwhen present, keeping its own subprocess scan as the fallback (separate small PR).🤖 Generated with Claude Code
https://claude.ai/code/session_01Tw3EwV55k6VzxorYng3Kfn