Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 43 additions & 0 deletions .github/workflows/release-integrate.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: Release Integrate

# The RELEASE-REHEARSAL channel (Stage 3): the workspace script matrix against
# the rehearsed TestPyPI wheels at release fidelity, plus verify_install A-F
# and the `{"stage": "integrate", ...}` report `pyauto-heart validate --ingest`
# understands. Thin entry over the shared body (workspace-validation.yml,
# workflow_call-only); there is deliberately NO mode input — this channel IS
# mode=release, so its run history never mixes with the continuous smoke
# channel (workspace-smoke.yml) that Heart's test_run leg reads.
#
# Dispatched by the Brain Release Agent (validate.sh Stage 3 plan / the
# nightly driver) after an M1 TestPyPI rehearsal on PyAutoHands release.yml.

on:
workflow_dispatch:
inputs:
testpypi_version:
description: "Rehearsed TestPyPI version to pip install (from the M1 rehearsal artifact)"
type: string
default: ""
commit_shas:
description: 'JSON {repo: sha} of the library main HEADs the wheels were built from'
type: string
default: "{}"
workflow_call:
inputs:
testpypi_version:
type: string
default: ""
commit_shas:
type: string
default: "{}"

permissions:
contents: read

jobs:
integrate:
uses: ./.github/workflows/workspace-validation.yml
with:
mode: release
testpypi_version: ${{ inputs.testpypi_version }}
commit_shas: ${{ inputs.commit_shas }}
23 changes: 23 additions & 0 deletions .github/workflows/workspace-smoke.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Workspace Smoke

# The CONTINUOUS workspace-readiness channel: every workspace's scripts and
# generated notebooks against the current source `main` of the 5 libraries,
# weekly and on demand. Thin entry over the shared body
# (workspace-validation.yml, workflow_call-only) — the split gives each
# meaning its own run history, so Heart's test_run leg
# (`gh run list --workflow workspace-smoke.yml`) can never confuse a failed
# release rehearsal (release-integrate.yml) with the smoke verdict.

on:
schedule:
- cron: "0 3 * * 1" # Mondays 03:00 UTC
workflow_dispatch:

permissions:
contents: read

jobs:
smoke:
uses: ./.github/workflows/workspace-validation.yml
with:
mode: smoke
50 changes: 20 additions & 30 deletions .github/workflows/workspace-validation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,15 @@ name: Workspace Validation
# Heart-owned workspace-integration validation (Stage 4 Phase B). M3 of the
# Brain->Health->Heart release-validation redesign gives it two modes:
#
# mode=smoke (default — schedule / bare workflow_dispatch / workflow_call)
# mode=smoke (entry: workspace-smoke.yml)
# Runs every workspace's scripts AND generated notebooks against the
# CURRENT source `main` of the 5 libraries (source-shadowed via PYTHONPATH,
# under the `smoke` env profile — config/build/profile_smoke.yaml).
# Unchanged by
# M3 — this remains the continuous readiness signal / weekly sweep, and
# `test_run`/`readiness` keep reading its conclusion the same way.
# This is the continuous readiness signal / weekly sweep;
# `test_run`/`readiness` read the smoke channel's conclusion.
#
# mode=release (Brain Release Agent dispatch only, after an M1 TestPyPI
# rehearsal on release.yml)
# mode=release (entry: release-integrate.yml — Brain Release Agent dispatch
# only, after an M1 TestPyPI rehearsal on release.yml)
# Re-points the SAME script matrix at the rehearsed TestPyPI wheels:
# `pip install` the 5 libraries pinned at `testpypi_version` — NO library
# source on PYTHONPATH (closes assessment Gap A: the smoke path shadows the
Expand All @@ -35,33 +34,25 @@ name: Workspace Validation
# in EITHER mode. Heart's own code (heart/checks/verify_install.sh,
# heart/validate.py) is checked out from THIS repo (default actions/checkout).
#
# Triggers: weekly schedule (mode=smoke, the continuous readiness signal),
# manual dispatch (either mode), and workflow_call (so the Brain Release Agent
# can invoke mode=release on demand). Heavy, so never in the <30s heart tick.
# Triggers: workflow_call ONLY — this file is the shared body behind two thin
# entry workflows, one per meaning:
#
# workspace-smoke.yml schedule + bare dispatch → mode=smoke
# release-integrate.yml dispatch + workflow_call → mode=release
#
# The split exists because `gh run list --workflow <file>` cannot filter on
# dispatch inputs: when both meanings shared one file, a failed nightly
# release rehearsal became the "latest run" and overwrote the continuous
# smoke verdict Heart's test_run leg reads. Runs are attributed to the CALLER
# workflow, so each channel's history is unambiguous. Heavy, so never in the
# <30s heart tick.
#
# Boundary: this workflow only executes what it's told (mode/version/shas come
# in as inputs). Dispatching it, polling it, and feeding its artifacts to
# `pyauto-heart validate --ingest` is the Brain Release Agent's job — Heart
# itself never dispatches a workflow or talks to GitHub's API.

on:
schedule:
- cron: "0 3 * * 1" # Mondays 03:00 UTC (always mode=smoke — no inputs on schedule)
workflow_dispatch:
inputs:
mode:
description: "smoke (source-shadowed current main) or release (wheel-based release-fidelity)"
type: choice
options: [smoke, release]
default: smoke
testpypi_version:
description: "Rehearsed TestPyPI version to pip install (required for mode=release; from the M1 rehearsal artifact)"
type: string
default: ""
commit_shas:
description: 'JSON {repo: sha} of the library main HEADs the wheels were built from (mode=release)'
type: string
default: "{}"
workflow_call:
inputs:
mode:
Expand Down Expand Up @@ -93,10 +84,9 @@ jobs:
mode: ${{ steps.mode.outputs.mode }}
steps:
# Resolved once here (rather than read from `inputs.mode` directly in
# every downstream `if:`) because `inputs` is only meaningfully populated
# for workflow_dispatch/workflow_call — routing every mode check through
# this job output means the weekly `schedule` trigger can never be
# affected by that ambiguity; it always resolves to plain "smoke".
# every downstream `if:`) so every mode check routes through one job
# output; the entry workflows always pass mode explicitly, and a bare
# input still resolves to plain "smoke", never an empty string.
- name: Resolve mode
id: mode
env:
Expand Down
12 changes: 7 additions & 5 deletions docs/release_validation.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,14 @@
This document is the **spec** half of Heart's release-validation tier. Heart
owns the *definition* of what a release-grade validation run must do; it does not
execute the build or the integration run (that is the Brain Release Agent
dispatching Build's `release.yml` and the evolved `workspace-validation.yml`).
dispatching Build's `release.yml` and Heart's `release-integrate.yml` channel).

M2 shipped the report schema, `pyauto-heart validate --ingest`, and the
readiness hard gate. **M3 wires the acceptance criteria below into
`workspace-validation.yml` itself** via a `mode: release` input (alongside the
untouched, default `mode: smoke` per-PR path):
readiness hard gate. **M3 wires the acceptance criteria below into the shared
`workspace-validation.yml` body** via a `mode: release` input. The two modes
now have separate entry workflows (one run history per meaning):
`workspace-smoke.yml` (the continuous smoke channel) and
`release-integrate.yml` (this release-fidelity channel):

- The `release` env profile lives in each workspace/`*_workspace_test` repo as
`config/build/profile_release.yaml` — a self-contained sibling of
Expand Down Expand Up @@ -151,7 +153,7 @@ it actually verified. Development-only `index: find-links` evidence does not
satisfy this release gate.

Before M3 (or if the Release Agent only runs the M1 rehearsal and skips
dispatching `workspace-validation.yml` in `mode: release`), an ingested
dispatching the `release-integrate.yml` channel), an ingested
rehearsal-only report still (correctly) gates YELLOW: the source was built and
TestPyPI-installed, but not yet exercised at release fidelity. `mode: release`
is what supplies the `integrate` stage that flips this to GREEN-eligible.
10 changes: 6 additions & 4 deletions health_agent/capabilities.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,10 +82,12 @@ only — the colour is the gate. Persisted to `~/.pyauto-heart/release_ready.jso
`open_prs` sweep; opens/updates one `[heart-health]` issue, closes when clean.
- **url-check.yml** ("URL Check (central)") — weekly ecosystem URL sweep into one
`[url-check]` issue. Monitoring only.
- **workspace-validation.yml** — heavy scripts + notebooks validation against the
libraries' current `main`; writes the `report.json` the `test_run` check +
`readiness` consume. Reuses Build's executor primitives — does not duplicate
them.
- **workspace-smoke.yml** → **workspace-validation.yml** (workflow_call-only
body) — heavy scripts + notebooks validation against the libraries' current
`main`; the run history the `test_run` check + `readiness` consume. The
release rehearsal runs on its own entry, **release-integrate.yml**, so a
failed rehearsal never overwrites the smoke verdict. Reuses Build's executor
primitives — does not duplicate them.

## State (`~/.pyauto-heart/`)

Expand Down
35 changes: 23 additions & 12 deletions health_agent/capabilities.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,8 @@ release_validation:
consumes: >-
the M1 TestPyPI rehearsal artifact (rehearsal.json / testpypi_version.txt),
a {repo: sha} commit_shas.json, and (M3, wired) the wheel-based
`release-stage-report` artifact emitted by workspace-validation.yml's
mode=release path — collected and handed over by the Brain Release Agent.
`release-stage-report` artifact emitted by the release-integrate.yml
channel — collected and handed over by the Brain Release Agent.
produces: >-
validation_report.json (schema_version 1): release_ready, testpypi_version,
profile, per-repo commit_shas, per-stage status, per-project counts,
Expand Down Expand Up @@ -186,16 +186,26 @@ workflows:
name: "URL Check (central)"
role: "weekly central URL-hygiene sweep; one consolidated [url-check] issue (monitoring only)"
- file: .github/workflows/workspace-validation.yml
name: "Workspace Validation"
name: "Workspace Validation (body)"
role: >-
two modes. mode=smoke (default; schedule/bare dispatch): scripts + notebooks
vs current library main, source-shadowed via PYTHONPATH; writes the report.json
the test_run check + readiness consume. mode=release (Brain Release Agent
dispatch only, M3): pip-installs the rehearsed TestPyPI wheels (no source on
PYTHONPATH) under the `release` env profile, runs verify_install A-F against
the same wheels, and emits the `release-stage-report` artifact
`pyauto-heart validate --ingest` consumes. Reuses Build's executor primitives
(script_matrix/run_python/aggregate_results) unmodified in both modes.
workflow_call-only shared body behind the two channel entries below;
reuses Build's executor primitives (script_matrix/run_python/
aggregate_results) unmodified in both modes.
- file: .github/workflows/workspace-smoke.yml
name: "Workspace Smoke"
role: >-
the CONTINUOUS channel (weekly schedule + bare dispatch → body mode=smoke):
scripts + notebooks vs current library main, source-shadowed via
PYTHONPATH; the run history the test_run check + readiness consume.
- file: .github/workflows/release-integrate.yml
name: "Release Integrate"
role: >-
the REHEARSAL channel (Brain Release Agent dispatch only → body
mode=release): pip-installs the rehearsed TestPyPI wheels (no source on
PYTHONPATH) under the `release` env profile, runs verify_install A-F
against the same wheels, and emits the `release-stage-report` artifact
`pyauto-heart validate --ingest` consumes. Separate entry so a failed
rehearsal never overwrites the smoke verdict.

# Operational surface (reporting / triage) the agent can cite in recommendations.
operations:
Expand All @@ -210,7 +220,8 @@ boundary:
heart: >-
owns all health/readiness checks, the release-validation report spec + ingest,
and the authoritative readiness verdict. Ingest-and-judge only: it NEVER
dispatches release.yml / workspace-validation.yml or mutates a repo.
dispatches release.yml / workspace-smoke.yml / release-integrate.yml or
mutates a repo.
brain_health: "reasons over Heart's outputs (the Health Agent, read-only); owns no checks; never dispatches"
brain_release: >-
the Release Agent ORCHESTRATES release validation: dispatches the M1 TestPyPI
Expand Down
15 changes: 9 additions & 6 deletions heart/checks/test_run.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,16 @@
or Path.home() / ".pyauto-heart"
)

# The cloud workspace-validation workflow (Heart-owned, lives in PyAutoHeart's
# own .github/workflows/workspace-validation.yml) is the continuous source of
# the workspace-integration verdict. The tick reads only its conclusion +
# timestamp (cheap, same budget as ci_status); the full report.json detail still
# comes from a local `autohands run_all` when one is present.
# The cloud SMOKE channel (Heart-owned entry workflow workspace-smoke.yml,
# calling the shared workspace-validation.yml body) is the continuous source of
# the workspace-integration verdict. The continuous verdict may only come from
# this channel — release rehearsals run on their own entry
# (release-integrate.yml) and reach readiness via `validate --ingest`, so a
# failed rehearsal can never overwrite the smoke verdict here. The tick reads
# only the conclusion + timestamp (cheap, same budget as ci_status); count
# detail comes from a local `autohands run_all` or the run's report artifact.
VALIDATION_REPO = os.environ.get("GITHUB_REPOSITORY", "PyAutoLabs/PyAutoHeart")
VALIDATION_WORKFLOW = "workspace-validation.yml"
VALIDATION_WORKFLOW = "workspace-smoke.yml"
# The aggregated per-run report the workflow's `analyze` job uploads; it holds
# the real counts and per-script failures for a cloud run — the only place they
# exist when there is no local run_logs/.
Expand Down
11 changes: 6 additions & 5 deletions heart/validate.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,10 @@
``validation_report.json``, computes ``release_ready``, persists it in Heart
state, and archives a history copy.
3. ``to_stage_report`` / ``pyauto-heart validate --emit-stage-report`` — the M3
bridge run **inside** ``workspace-validation.yml`` itself (still Heart's own
code, in Heart's own CI, writing only to the job workspace — not a foreign
repo, not a build dispatch). It reshapes Build's ``aggregate_results.py``
bridge run **inside** the ``workspace-validation.yml`` body (the
``release-integrate.yml`` channel; still Heart's own code, in Heart's own
CI, writing only to the job workspace — not a foreign repo, not a build
dispatch). It reshapes Build's ``aggregate_results.py``
report.json (Build's own vocabulary: ``ready``, ``file``, no ``stage``) into
the ``{"stage": ..., "status": "pass"|"fail", ...}`` contract ``--ingest``
expects, optionally folding in a ``verify_install`` sidecar. The Release
Expand Down Expand Up @@ -76,7 +77,7 @@
- ``commit_shas.json`` — ``{repo: sha}`` (or ``{"commit_shas": {...}}``), the
HEADs the Release Agent built from (it has the GitHub access to read them).
- a **stage report** — any JSON carrying a ``stage`` key (``unit`` /
``integrate`` from M3's ``workspace-validation.yml``): ``status``, ``profile``,
``integrate`` from the ``release-integrate.yml`` channel): ``status``, ``profile``,
``summary``, ``per_project``, ``failures``, ``run_url``, ``commit_shas``.
- a full ``validation_report.json`` — merged as a base (idempotent re-ingest).
"""
Expand Down Expand Up @@ -488,7 +489,7 @@ def to_stage_report(
) -> dict[str, Any]:
"""Translate a Build ``aggregate_results.py`` report.json into a stage report.

This is the M3 bridge: ``workspace-validation.yml`` runs Build's
This is the M3 bridge: the ``workspace-validation.yml`` body runs Build's
``aggregate_results.py`` (unmodified — Heart reuses the executor primitive,
it does not reimplement it) to get a ``{ready, summary, per_project,
failures, ...}`` blob keyed by Build's own vocabulary (``file`` not
Expand Down
62 changes: 62 additions & 0 deletions tests/test_workflow_wiring.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
"""tests/test_workflow_wiring.py — the validation-channel split stays wired.

One workflow file per meaning (PyAutoHeart#121): workspace-validation.yml is a
workflow_call-only body; workspace-smoke.yml (the continuous channel Heart's
test_run leg reads) and release-integrate.yml (the Stage 3 rehearsal channel
Brain dispatches) are the only entries. These tests parse the YAML so a trigger
or mode drifting back onto the body — recreating the one-channel ambiguity —
fails loudly.

PyYAML parses the bare `on:` key as boolean True, hence the `data[True]` reads.
"""

from __future__ import annotations

from pathlib import Path

import yaml

from heart.checks.test_run import VALIDATION_WORKFLOW

WORKFLOWS = Path(__file__).resolve().parent.parent / ".github" / "workflows"


def _load(name):
return yaml.safe_load((WORKFLOWS / name).read_text())


def _triggers(data):
return data.get("on", data.get(True))


def test_body_is_workflow_call_only():
triggers = _triggers(_load("workspace-validation.yml"))
assert set(triggers) == {"workflow_call"}


def test_smoke_entry_owns_the_schedule_and_calls_body_in_smoke_mode():
data = _load("workspace-smoke.yml")
triggers = _triggers(data)
assert set(triggers) == {"schedule", "workflow_dispatch"}
(job,) = data["jobs"].values()
assert job["uses"].endswith("workspace-validation.yml")
assert job["with"]["mode"] == "smoke"


def test_release_entry_has_no_mode_input_and_calls_body_in_release_mode():
data = _load("release-integrate.yml")
triggers = _triggers(data)
assert set(triggers) == {"workflow_dispatch", "workflow_call"}
for trig in triggers.values():
inputs = (trig or {}).get("inputs", {})
assert "mode" not in inputs # the channel IS the mode
assert set(inputs) == {"testpypi_version", "commit_shas"}
(job,) = data["jobs"].values()
assert job["uses"].endswith("workspace-validation.yml")
assert job["with"]["mode"] == "release"


def test_test_run_reads_an_existing_entry_workflow():
assert (WORKFLOWS / VALIDATION_WORKFLOW).is_file()
# ...and specifically the smoke channel, never the body or release entry.
assert VALIDATION_WORKFLOW == "workspace-smoke.yml"
Loading