diff --git a/agents/conductors/release/nightly.sh b/agents/conductors/release/nightly.sh index 1d894c5..216269d 100644 --- a/agents/conductors/release/nightly.sh +++ b/agents/conductors/release/nightly.sh @@ -16,8 +16,9 @@ # step 4 validate validate.sh Phases A→C — the emitted dispatch # plans are EXECUTED here with `gh` (in CI, unlike # the MCP-only cloud sessions the plans were written -# for, gh is available to bash) -# step 5 gate vitals faculty → `pyauto-heart readiness +# for, gh is available to bash); 4c ingests, runs +# Heart's rehearsal-ancestry check, then aggregates +# step 5 gate vitals faculty → `pyauto-heart readiness # --profile release-ci` — GREEN only; STALE/YELLOW/ # RED stop and page; there is NO force input # step 6 live release dispatch Build's release.yml (rehearsal=false, @@ -413,6 +414,14 @@ bash "$HEART_DIR/heart/checks/open_prs.sh" || echo "nightly: open_prs check fail page "could not ingest the validation artifacts into Heart" exit 1 } +# M2.4 (PyAutoHands#337): a library main that moved FORWARD from the rehearsed +# commit keeps the rehearsal fresh, but only when this check proves the +# ancestry (it reads the ingested validation_report + ci_status, writes the +# rehearsal_ancestry sidecar that aggregate folds in). Without it every merge +# during the validation window read as "ancestry unproven" → STALE (#721). +# A failure is non-fatal: the moved repos stay unproven, i.e. STALE. +PYTHONPATH="$HEART_DIR" python3 -m heart.checks.rehearsal_ancestry \ + || echo "nightly: rehearsal_ancestry check failed (moved repos read as unproven)" >&2 PYTHONPATH="$HEART_DIR" python3 -c "from heart import state; state.aggregate()" || { page "could not aggregate the Heart snapshot" exit 1 diff --git a/tests/test_release_rehearsed_shas.py b/tests/test_release_rehearsed_shas.py index 20d8ac5..5b94a40 100644 --- a/tests/test_release_rehearsed_shas.py +++ b/tests/test_release_rehearsed_shas.py @@ -122,6 +122,20 @@ def test_nightly_uses_the_record_not_main_heads(): assert '{"rehearsal": "false", "minor_version": "1"}' not in NIGHTLY +def test_nightly_proves_rehearsal_ancestry_before_aggregate(): + # PyAutoBrain#721: without the ancestry sidecar, Heart reads any main that + # moved during the validation window as "ancestry unproven" → STALE. + # The check needs the ingested validation_report, and aggregate must fold + # its sidecar in, so the order is ingest → ancestry → aggregate. + ingest = NIGHTLY.index('"$heart" validate --ingest "$ART_DIR"') + ancestry = NIGHTLY.index("python3 -m heart.checks.rehearsal_ancestry") + aggregate = NIGHTLY.index("state.aggregate()") + assert ingest < ancestry < aggregate + # Non-fatal, like ci_status: a failure leaves the repos unproven (STALE). + line = NIGHTLY[ancestry:NIGHTLY.index("\n", NIGHTLY.index("\n", ancestry) + 1)] + assert "|| echo" in line + + # --- rehearse.sh ingest: the record is the commit_shas authority ----------------------- def _fake_heart(tmp_path, log):