feat: unit_test_timing leg — off-tick slow-test regression tracking (#63)#64
Merged
Merged
Conversation
) 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. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Tw3EwV55k6VzxorYng3Kfn
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 #63. Phase 4a of the hygiene perf mode.
What
Tracks library unit-test durations over time and flags slow-test regressions — the first of three original-prompt perf capabilities the shipped perf mode (import timing only) didn't cover. Mirrors the
import_timeleg (#62).Design
heart/checks/unit_test_timing.py— runspytest --durations=Nper library in a subprocess (rule 4: Heart never imports the test stack; runner injected so stdlib-only tests use fixtures). Parses the slowest-durations report, rolling per-test baseline, ratio classify (1.5/3.0), writes~/.pyauto-heart/unit_test_timing.json. OFF-TICK (suites take minutes → daily cron / on demand, NOT tick.sh).state.py+dashboard.py— advisory "Unit-test timing" section (local-only family); not in the readiness gating set.tests/test_unit_test_timing.py— 6 stdlib-only tests (injected runner) incl. a parser test against realpytest --durationsoutput.Greenfield
No
--durationsin any library pytest config;test_runtracks pass/fail + slow-skips, not per-test durations. Chose off-tick self-run over read-CI-artifact for a self-contained first cut; the runner is injected so switching sources later is cheap.Gate (
--auto, supervised)Tests PyAutoHeart 257 pass (6 new) / smoke n/a / review CLEAN / heart YELLOW unacked. Parser validated live against real pytest output.
Follow-on
PyAutoBrain: hygiene
perfreadsunit_test_timing.jsonwhen present (fallback silent) — same as #93 did for import_time.🤖 Generated with Claude Code
https://claude.ai/code/session_01Tw3EwV55k6VzxorYng3Kfn