Skip to content

feat: unit_test_timing leg — off-tick slow-test regression tracking (#63) - #64

Merged
Jammy2211 merged 1 commit into
mainfrom
feature/hygiene-unit-test-timing
Jul 11, 2026
Merged

Jammy2211 merged 1 commit into
mainfrom
feature/hygiene-unit-test-timing

Conversation

@Jammy2211

Copy link
Copy Markdown
Contributor

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_time leg (#62).

Design

  • 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 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 real pytest --durations output.

Greenfield

No --durations in any library pytest config; test_run tracks 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 perf reads unit_test_timing.json when present (fallback silent) — same as #93 did for import_time.

🤖 Generated with Claude Code

https://claude.ai/code/session_01Tw3EwV55k6VzxorYng3Kfn

)

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
@Jammy2211 Jammy2211 added the pending-release Awaiting a published release label Jul 11, 2026
@Jammy2211
Jammy2211 merged commit 1f4b71c into main Jul 11, 2026
4 checks passed
@Jammy2211
Jammy2211 deleted the feature/hygiene-unit-test-timing branch July 11, 2026 18:49
@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: unit_test_timing leg — off-tick slow-test regression tracking (hygiene perf 4a)

1 participant