Skip to content

feat: import_time observation leg — off-tick import-cost regression tracking (#61) - #62

Merged
Jammy2211 merged 1 commit into
mainfrom
feature/import-time-heart-leg
Jul 11, 2026
Merged

Jammy2211 merged 1 commit into
mainfrom
feature/import-time-heart-leg

Conversation

@Jammy2211

Copy link
Copy Markdown
Contributor

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 autolens costs several seconds (the whole stack; more cold) and every check in tick.sh runs every ~5-min cycle, so this cannot live in the <30s watch-loop budget (docs/internals.md rule 3). It is therefore off-tick: run on a daily cron / on demand and not wired into tick.sh:

python -m heart.checks.import_time
HYGIENE_PYTHON=~/venv/PyAuto/bin/python python -m heart.checks.import_time
  • Subprocess measurement (rule 4): Heart's own process never imports the science/JAX stack — it shells out per package. The measurer is dependency-injected, so the stdlib-only test suite feeds fixtures and never imports the libs.
  • Rolling per-package baseline (~/.pyauto-heart/timings-import/), ratio-vs-median classification (1.5/3.0 factors, config-driven) — mirrors script_timing.
  • Writes ~/.pyauto-heart/import_time.json + a colored summary line.
  • Advisory: surfaced as a dashboard "Import timing" section (local-only family) but absent from the readiness gating set — import time is not release-blocking.

Changes

  • heart/checks/import_time.py — the check (new).
  • heart/state.py — aggregate the import_time.json sidecar 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 stray root.log.

Gate (--auto, supervised)

  • Tests — PyAutoHeart 251 pass (7 new). Downstream n/a (Heart is a standalone tool; nothing imports from it).
  • Smoke — n/a (organism/tool repo, no downstream script surface).
  • Review — CLEAN (caught + removed a stray root.log).
  • Heart — organism YELLOW, no launch ack; parked at supervised ship, shipped on live human sign-off.

Validated live

Correctly timed the 4 importable libs in the local venv and marked autolens (genuinely not installed there) unavailable without crashing; dashboard renders the section; import_time.json written.

Follow-on

PyAutoBrain: wire the hygiene perf mode to read import_time.json when present, keeping its own subprocess scan as the fallback (separate small PR).

🤖 Generated with Claude Code

https://claude.ai/code/session_01Tw3EwV55k6VzxorYng3Kfn

…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
@Jammy2211 Jammy2211 added the pending-release Awaiting a published release label Jul 11, 2026
@Jammy2211
Jammy2211 merged commit 08d5e17 into main Jul 11, 2026
4 checks passed
@Jammy2211
Jammy2211 deleted the feature/import-time-heart-leg branch July 11, 2026 17:33
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>
@Jammy2211 Jammy2211 removed the pending-release Awaiting a published release label Oct 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: import_time observation leg (hygiene perf follow-up)

1 participant