Skip to content

feat(unit_timings): unit-test durations + import time live by CI ingestion - #207

Merged
Jammy2211 merged 1 commit into
mainfrom
claude/ci-test-timing-epic-ke2lul
Sep 5, 2026
Merged

Jammy2211 merged 1 commit into
mainfrom
claude/ci-test-timing-epic-ke2lul

Conversation

@Jammy2211

Copy link
Copy Markdown
Contributor

Closes #206. Phase 3 of the ci-timing-fast-tests epic (PyAutoMind draft/feature/pyautoheart/ci_timing_fast_tests_epic.md).

Summary

Three checks were documented as "run on a daily cron" and no cron existed: unit_test_timing (never run), import_time (ran once), workspace_testmode_timing (never run). Their board rows have rendered "not observed here" every day. The execution home is ingestion, not a new cloud leg: every library's Tests gate is a thin caller of this repo's reusable lib-tests.yml, which already installs the source stack and runs pytest on every push and PR.

  • lib-tests.yml (unittest matrix job only) — a continue-on-error step times a fresh-process import <package> (the cold cost the developer loop pays; seconds: null on failure, never a fabricated 0), pytest gains --junitxml (built-in, every test, no console scraping), and both are uploaded as unit-timings-<py> with if: always() / if-no-files-found: ignore and no retention cap. This workflow is referenced @main by six libraries, so every new step is non-fatal and the pytest exit path is untouched apart from the one flag. The unittest-nojax job is unchanged.
  • heart/checks/unit_timings.{sh,py} — the sixth cloud-safe check in heart-health.yml, in the smoke_timings shape (the artifact selector is shared, parametrised by name pattern). Per library repo and python leg: the suite wall-clock and counts, the N slowest tests (top_n: 25 from config), the import seconds. Test drift is the both-gates rule (≥2.0× AND ≥2 s vs the previous recorded run of the same test, run id must differ); import drift is the existing import_time doctrine (ratio to the median of the last 7 recorded runs, building until 3 samples, 1.5×/3.0× yellow/red). Rows carry /hygiene perf prompts.
  • The existing board sections come alive. The check also writes unit_test_timing.json and import_time.json in exactly the shapes the dev-box checks produce (python: "ci"), so "Unit-test timing" and "Import timing" render unchanged and gain per-leg detail lines (suite wall-clock + slowest test; import seconds). import_time, unit_test_timing and workspace_testmode_timing leave LOCAL_ONLY_FAMILIES: the first two are now cloud-observed, the third is retired from the board as superseded by the Smoke scripts row (feat(smoke_timings): ingest per-script smoke timings onto the ⏱ board #203) — the smoke gates already run those scripts in TEST_MODE=2 on every PR. All three modules stay runnable on demand; their docstrings now say so.
  • Record — timings/unit/<repo>.jsonl (one line per python leg × run id: suite totals, the slowest tests, import seconds), same append-only and run-id dedupe rules; heart.timings append --unit-timings; README updated. performance.unit is an additive board.json key emitted only when observed.

API Changes

No public API change. New module heart.checks.unit_timings; smoke_timings.select_artifacts gains an optional pattern keyword (default unchanged); heart.timings gains the unit/ writer and readers; new snapshot key unit_timings; config/repos.yaml thresholds.unit_timings; LOCAL_ONLY_FAMILIES loses three families.

Test Plan

  • python3 -m pytest -q -n auto — 767 → 841 passed (48 in tests/test_unit_timings.py, 5 in tests/test_lib_tests_wiring.py, 2 shell tests with stub gh/unzip, the rest appended to existing files). One existing census assertion widened for the two new census keys (named feat: bring unit_test_timing + import_time live by ingesting lib-tests.yml artifacts #206 in a comment); nothing else modified.
  • bash -n the new shell leg; yaml.safe_load on both workflows and the config; tenant firewall check OK (fake names only in new files)
  • First library CI run after merge: the unit-timings-3.12 / -3.13 artifacts appear on a Tests run with junit.xml + import_time.json, and the gate's conclusion is unaffected
  • Next scheduled heart-health.yml run: "Unit-test timing" and "Import timing" rows render with per-leg lines (import rows building until 3 runs are recorded); timings/unit/ appears in the daily commit. The cross-repo artifact 403 caveat from feat(smoke_timings): ingest per-script smoke timings onto the ⏱ board #203 applies to the library repos too — same HEART_TIMINGS_TOKEN remedy.

Generated by the PyAutoLabs agent workflow.

🤖 Generated with Claude Code

https://claude.ai/code/session_0151gQm9fk3XGLi5f18Urdba


Generated by Claude Code

…stion (#206)

lib-tests.yml — the reusable workflow every library's Tests gate calls — now
emits a unit-timings-<py> artifact (pytest --junitxml per-test durations plus a
fresh-process import time), and the daily heart-health run ingests it with a
new unit_timings check: the N slowest tests and the suite wall-clock per leg,
import seconds per package, run-to-run drift against the committed timings/
record (both-gates for tests; the import_time median-window doctrine for
imports), recorded as timings/unit/<repo>.jsonl. The existing Unit-test timing
and Import timing board sections come alive from the same summaries the
dev-box checks write, and workspace_testmode_timing is retired from the board
as superseded by the per-script smoke timings. Readiness verdict and badge
untouched.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0151gQm9fk3XGLi5f18Urdba
@Jammy2211
Jammy2211 merged commit cb1d500 into main Sep 5, 2026
2 checks passed
@Jammy2211
Jammy2211 deleted the claude/ci-test-timing-epic-ke2lul branch September 5, 2026 23:02
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: bring unit_test_timing + import_time live by ingesting lib-tests.yml artifacts

2 participants