Repository navigation
Description
Overview
Heart Tests on main fail since 2026-11-26 because two smoke_sha_gate main() tests use a fixed previous full-sweep timestamp (2026-11-18T03:00:00Z) while main() reads the real clock. Once that timestamp passed FULL_SWEEP_MAX_AGE_DAYS (7), the gate correctly forces a sweep and the tests' "no main moved" expectation fails. This is the Heart RED reason PyAutoHeart: Heart Tests failure on main, which blocks every Heart PR, including #373.
Plan
- Make the two
main()tests use a previous full-sweep time one day before the real now, so they test the "no main moved" path on any date. - Leave the gate and the 7-day rule untouched (test-only change).
- Verify with the sha-gate tests, the full Heart suite, and the two tests rerun under a clock shifted weeks ahead.
- Ship one corrective PR under AUTONOMY.md's "Corrective-PR exception for Heart RED".
- Tier: effective level: human-required; merge mode: human /prm
Detailed implementation plan
Affected Repositories
- PyAutoHeart (primary)
Branch Survey
| Repository | Current Branch | Dirty? |
|---|---|---|
| ./organs/PyAutoHeart | main | clean |
Suggested branch: feature/smoke-sha-gate-date-drift
Implementation Steps
tests/test_smoke_sha_gate.py: intest_main_writes_record_outputs_and_summaryandtest_main_reads_force_and_the_latest_run_from_the_environment, build the previous record with_previous(_shas(), full_ts=<real now - 1 day, %Y-%m-%dT%H:%M:%SZ>)via a small helper.- Test:
pytest tests/test_smoke_sha_gate.py, fullpytest tests, plus the two tests withdatetimeshifted +30 days in the gate module to prove date independence.
Key Files
tests/test_smoke_sha_gate.py— the twomain()tests (lines ~150-190).github/scripts/smoke_sha_gate.py—main()usesdatetime.now(utc)(line 224);FULL_SWEEP_MAX_AGE_DAYS = 7(unchanged)
Original Prompt
Click to expand starting prompt
Heart: smoke_sha_gate main() tests fail as the real clock passes their fixed dates
Type: bug
Target: PyAutoHeart
Repos:
- @PyAutoHeart
Themes: - ci
- tests
Difficulty: small
Autonomy: human-required
Priority: high
Status: formalised
Consequence: judge
Review-minutes: 5
Unattended: never
Lane: any
Request (human, 2026-11-26, verbatim)
Do this task here: "Fix date drift in Heart smoke_sha_gate tests"
Diagnosis (2026-11-26)
Heart Tests on main fail since 2026-11-26 (last green 2026-11-24, run 45364461481):
tests/test_smoke_sha_gate.py::test_main_writes_record_outputs_and_summarytests/test_smoke_sha_gate.py::test_main_reads_force_and_the_latest_run_from_the_environment[env2-no main moved since run 100]
.github/scripts/smoke_sha_gate.py main() passes datetime.now(utc) to the gate, which forces a
full sweep when the last one is >= FULL_SWEEP_MAX_AGE_DAYS (7) days old. Both tests build the
previous record with _previous()'s default full_ts="2026-11-18T03:00:00Z", which became 7 days
old on 2026-11-25, so main() now reports "...a full sweep runs at least every 7 days" instead of
"no main moved since run 100". The pure-function tests use a fixed NOW and are unaffected.
This is the Heart RED reason "PyAutoHeart: Heart Tests failure on main", which blocks merging
#373 (arcticpy 2.7 stopgap, issue PyAutoHeart#372).
Scope
Test-only: give the two main() tests a previous full-sweep timestamp relative to the real clock
(e.g. one day ago), so they keep exercising the "no main moved" path on any date. Do not change the
gate or loosen FULL_SWEEP_MAX_AGE_DAYS.
Activity
Jammy2211 commentedon Nov 26, 2026
Corrective-PR exception for Heart RED — authorization
pyauto-heart readiness --dev --repos PyAutoHeart, 2026-11-26):PyAutoHeart: Heart Tests failure on mainmain()tests intests/test_smoke_sha_gate.py) → diff (that file only)./prm; release stays blocked while Heart is RED.Jammy2211 commentedon Nov 26, 2026
Shipped
Merged #375 (
a8ac38b) via human/prm. The twosmoke_sha_gatemain()tests now use a full-sweep time one day before the real clock; full Heart suite 1523 passed, and the tests pass under a clock shifted +30/+365 days. This clears the Heart RED reasonPyAutoHeart: Heart Tests failure on mainonce Heart Tests on main re-run green. Unblocks #373.