Skip to content

feat: unit-trend chart follow-ups from PyAutoHeart#338 #346

Closed

Description

@Jammy2211

Overview

Follow-ups from the independent review of PyAutoHeart#339 (unit-test trend charts). Sub-second series are drawn flat at the bottom of the chart, the epoch filter and the plotted day read different fields, a chart label's date range counts days the axis does not, and the per-day point picks the last of several noisy runs. This fixes those and pins the gate charts with a golden-HTML test so the unit-trend fixes cannot move them.

Plan

  • Make unit-trend charts fill their height for sub-second series (PyAutoNerves import charts), leaving gate charts unchanged.
  • Apply the epoch boundary to the same day the point is plotted on (at, falling back to date).
  • Make the unit-trend label's date range match the plotted axis (measured points only).
  • Replace "last main run of the day wins" with the median of the day's main runs for wall-clock and import seconds, preferring cache-hit runs when a day mixes cache states; the test count stays the day's last run.
  • Add a golden-HTML test that pins a gate chart byte-for-byte, plus tests for each fix.
  • Item 6 (confirm the charts on the live board after the next daily heart-health run) is post-merge and stays with the human / close-out.

Tier: glance — merge mode: auto-merge on green if the Witness passes, post-merge summary

Detailed implementation plan

Work Classification: Library (PyAutoHeart only)
Worktree root: ~/Code/PyAutoLabs-wt/unit-trend-followups/

Affected Repositories

  • PyAutoHeart (primary)

Branch Survey

Repository Current Branch Dirty?
./organs/PyAutoHeart main clean

Suggested branch: feature/unit-trend-followups

Implementation Steps

  1. heart/timing_display.py::plot — add a keyword min_span=1 (today's max(high-low, 1) floor). unit_trend passes min_span=0, so the y-scale is high-low (a flat series still has a span floor so nothing divides by zero). chart (gates) keeps the default, so gate charts are byte-identical.
  2. heart/timings.py::unit_history — compute the run day first (at[:10], fallback date) and apply the epoch as day >= since, instead of _within_epoch(record) reading date.
  3. heart/timing_display.py::unit_trend — label's range from the first/last measured point (the axis with gaps=False).
  4. heart/timings.py::unit_history — collect every main run per (python, day); wall_s and import_s are the median over the day's runs whose unit_cache_state is hit when any is, else over all runs; tests is the last run's count. Docstring updated.
  5. Tests in tests/test_unit_trends.py: golden HTML of a gate chart (chart) pinned to today's output; a sub-second import series spans the full 15–75 y range; a record whose at and date straddle the epoch boundary is kept/dropped by at; a label with leading None days names the first measured day; the per-day median and the hit preference. Rename the "last run of each day" test.

Key Files

  • heart/timing_display.py — plot, unit_trend
  • heart/timings.py — unit_history
  • tests/test_unit_trends.py

Original Prompt

Click to expand starting prompt

Heart unit-test trends: follow-ups from PyAutoHeart#338

Type: feature
Target: PyAutoHeart
Repos:

  • PyAutoHeart
    Difficulty: small
    Autonomy: supervised
    Priority: low
    Status: draft
    Filed: 2026-11-12
    Epic: autonomous-orchestrators
    Consequence: glance
    Witness: a golden-HTML test pins the gate chart; a sub-second import series fills the chart height; the epoch filter and the plotted x agree
    Review-minutes: 5
    Unattended: ready
    Lane: any

Source: independent review of PyAutoHeart#339 (2026-11-12).

  1. heart/timing_display.py:162: max(high-low, 1) flattens sub-second series (PyAutoNerves import charts use 10–14% of the height).
  2. heart/timings.py:931 vs :934: the epoch filter reads date but the point is plotted on at.
  3. timing_display.py:224: the label's date range counts None points, the axis does not.
  4. "Last run of the day wins" picks between noisy runs (PyAutoArray 10-26: 100 s and 296 s); consider a median and a cache-state filter.
  5. Pin "gate charts unchanged" with a golden-HTML test.
  6. After the next daily heart-health run, confirm the charts on the live board.

Activity

  1. Jammy2211 commented on Nov 14, 2026

    @Jammy2211
    ContributorAuthor

    Library PR created: #347 (glance; shift 2026-11-14-pm).

    Gate: tests 1459 passed · smoke n/a (Heart organ, no downstream script surface) · independent Opus review CLEAN · independent Sonnet adversary CLEAN (Witness holds) · Heart dev-ship GREEN.

    Workspace impact: (iii) none. Heart organ only, no public API. The session ended at PR-open; the watcher's close-out runs the witness and merges, or refuses.

    Remaining after merge: item 6, which is to look at the unit-trend charts on the live board after the next daily heart-health run.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions