Skip to content

fix: compare unit timings with a distinct prior run #276

Closed

Description

@Jammy2211

Overview

Repair missing unit-test timing comparisons caused by selecting the current run as its own baseline. The approved dashboard-repair plan and the human instruction to continue authorize this bounded phase of #274.

Plan

Select a distinct, strictly earlier baseline for each repository/Python observation within the active epoch. Preserve cache guards and truly missing-history results. Add regression tests, run the Heart suite and inspect real before/after evidence.

Tier: undeclared — merge mode: human /prm.

Implementation plan

PyAutoHeart main is clean; no active repo claim. Branch: feature/unit-timing-distinct-baseline. Worktree: /home/jammy/Code/PyAutoLabs/.worktrees/unit-timing-distinct-baseline.

Files: heart/timings.py (previous_unit_rows), heart/checks/unit_timings.py (aggregation caller), tests/test_timings.py and tests/test_unit_timings.py. Current sidecar identity and observation time must reach baseline selection. Exclude the measured run and future observations, retaining epoch and cache semantics. Unchanged callers remain compatible.

Reproduction on main: the selected PyAutoFit/3.12 baseline is the current run 37192363540; 18 older distinct observations exist for the same test. Four tests for future/out-of-order and epoch/per-leg cases should prevent future regression.

Select a distinct prior run for unit timing comparisons

Type: bug
Priority: high
Difficulty: small
Autonomy: human-required
Target: @PyAutoHeart

Original request

Check why heart is red, fix it, and then do anything else to make whole dashboard green

Follow-up: Yes merge prm and continue

Approved parent scope

Continuation of #274's approved timing-evidence repairs. Parent collector PR #275 merged; this is a distinct phase, not a scoring-policy change. Proposed branch: feature/unit-timing-distinct-baseline. Tier: undeclared — merge mode: human /prm.

Reproduced cause

After refreshing unit timing artifacts, all 300 observations lack a comparison even though committed history includes older runs. heart.timings.previous_unit_rows selects the latest recorded row per Python leg without the current observation's identity. That row is often the same run; classify_drift correctly rejects self-comparison, but the reader never selects the actual prior run.

Plan

  • Pass current per-repository/Python run identity and observation time into baseline selection.
  • Select the latest distinct prior recorded run within the current epoch; never use the current or future run as its baseline. Preserve existing cache-state guards and missing-evidence semantics.
  • Keep unchanged callers compatible; restrict changes to heart/timings.py, heart/checks/unit_timings.py, their focused tests and relevant contract documentation.
  • Add regression coverage for current run already recorded, older valid baseline, future/out-of-order records, per-Python legs, epoch exclusion and truly absent baselines. Run focused and full Heart tests and compare real snapshot output without claiming every timing becomes green.

Activity

  1. Jammy2211 commented on Oct 4, 2026

    @Jammy2211
    ContributorAuthor

    Summary

    Unit timing collection could select the current run as its own baseline, leaving all 300 observations without comparisons despite older recorded runs. Select the latest distinct, earlier observation for each repository/Python leg within the current epoch. An isolated replay restores 289 comparisons, retains 11 genuinely missing comparisons, and identifies one slowdown.

    Closes #276. Continues dashboard repair #274.

    API Changes

    The internal timing reader accepts optional current-run metadata; callers that omit it retain their existing behavior. No scientific library API or workspace migration is involved. See full details below.

    Test Plan

    • Reproduced baseline-selection failures before the repair.
    • Focused timing tests: 111 passed.
    • Full Heart suite: 1,183 passed.
    • Isolated real-data aggregation: 289/300 comparisons; live state untouched.
    • Independent review: CLEAN.
    • Workspace smoke workflow 37198914051 passed on main; the changed Heart-only selector has no workspace callers.

    Heart release readiness is YELLOW (85): seven generated-hook mismatches, two organism-map mismatches, and missing current-source rehearsal evidence. These are acknowledged within the human-approved dashboard repair scope; release integration is running separately. No score policy or missing-evidence guard is relaxed. Merge remains human /prm.

    Full API Changes (for automation & release notes)

    Changed Signature

    • heart.timings.previous_unit_rows(unit_dir=UNIT_DIR, since="", current_runs=None) adds optional per-repository/Python current observation metadata.

    Changed Behaviour

    • With current metadata, choose the newest distinct, strictly earlier recorded run within the epoch, ignoring append order. Unknown chronology and missing tests retain unknown comparisons; cache-state guards remain.
    • Without current metadata, preserve the existing file-order selection behavior.

    Migration

    • No external migration. Unit aggregation passes its existing sidecar metadata into the selector.
  2. Jammy2211 commented on Oct 4, 2026

    @Jammy2211
    ContributorAuthor

    unit-timing-distinct-baseline

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