Files
hermes-agent/tests/ci/test_stable_release_graph.py
ethernet 284dbaf537 fix(pm): isolate bootstrap dependencies and unify YAML on ruamel
Activation reaches plugin discovery before the application dependencies
exist. Give PM its own locked Python project and runtime so it can install
or repair the application without importing that dependency tree.

Keep PM outside the application workspace. A shared uv workspace resolves
the application graph and cannot provide this isolation. Route mutations
through an isolated worker and preserve transaction callbacks, cancellation,
custom package registrations, and correlated receipts.

Use the same runtime builder for source installs and packaged payloads.
Keep offline wheelhouse support in that builder. Nix builds the independent
PM lock as a separate derivation. Refuse lazy-disabled bootstrap before
installing tools or dependencies.

Move first-party YAML readers and writers to ruamel. Keep the application
lock's transitive PyYAML requirements for third-party packages.

Verification:
- Focused canonical Python suite: 177 passed, 1 host-gated skip.
- Electron backend probes: 12 passed. Electron typecheck passed.
- Both uv locks, scoped lint, Bash syntax, and whitespace checks passed.
- Cold activation, corrupt-app repair, offline staging, and relocation ran.
- Built and exercised the Nix PM runtime and standalone YAML merge script.

Six broader caller test files retain the same 24 failing test IDs as an
archive of HEAD. The existing real-home guard blocks those tests before
they can exercise the affected paths. No full-suite pass is claimed.
Native Windows signing and full Bionic package execution remain unverified.
2026-09-11 12:23:51 -04:00

50 lines
2.0 KiB
Python

"""The release workflow's dependency graph enforces publication ordering."""
from pathlib import Path
from ruamel.yaml import YAML
ROOT = Path(__file__).resolve().parents[2]
def workflow(name):
return YAML(typ="base").load((ROOT / ".github/workflows" / name).read_text(encoding="utf-8"))
def ancestors(jobs, name):
seen = set()
pending = [name]
while pending:
needs = jobs[pending.pop()].get("needs", [])
for item in [needs] if isinstance(needs, str) else needs:
if item not in seen:
seen.add(item)
pending.append(item)
return seen
def test_release_reuses_whole_ci_and_docker_before_publication():
jobs = workflow("stable-release.yml")["jobs"]
assert jobs["ci"]["uses"] == "./.github/workflows/ci.yaml"
assert jobs["ci"]["with"]["release"] == "true"
assert "secrets" not in jobs["ci"]
assert jobs["docker"]["uses"] == jobs["publish-docker"]["uses"] == jobs["promote-docker"]["uses"]
assert jobs["docker"]["with"]["release-phase"] == "test"
assert "ci" in ancestors(jobs, "docker")
required = {"ci", "docker", "nix", "pm-bundle", "install-e2e", "windows-packaged", "macos-packaged", "termux-checks", "windows-live", "candidates"}
assert required <= ancestors(jobs, "acceptance")
for name in ("publish-docker", "publish-bundles"):
assert required <= ancestors(jobs, name)
for name in ("promote-docker", "promote-bundles"):
assert {"publish-docker", "publish-bundles", "publication"} <= ancestors(jobs, name)
assert {"promote-docker", "promote-bundles"} <= ancestors(jobs, "complete")
for name in ("acceptance", "publication", "complete"):
assert jobs[name]["if"] == "always()"
def test_all_applicable_ci_jobs_are_aggregated_and_desktop_e2e_stays_deferred():
jobs = workflow("ci.yaml")["jobs"]
checks = {name for name, job in jobs.items() if "uses" in job}
assert checks <= set(jobs["all-checks-pass"]["needs"])
assert jobs["e2e-desktop"]["if"] == "false"
assert "workflow_call" in workflow("ci.yaml")["on"]