Files
rune/tests/test_orchestration_authority.py
T
Nick ca4f7593d7
CI Pipeline / best-practices (push) Successful in 8s
Auto-version and Release / release (push) Failing after 14s
CI Pipeline / documentation (push) Successful in 5s
CI Pipeline / lint (push) Failing after 34s
CI Pipeline / canary (push) Successful in 37s
CI Pipeline / type-check (push) Successful in 31s
CI Pipeline / gitea-offline (push) Successful in 16s
CI Pipeline / unit-tests (push) Successful in 1m4s
CI Pipeline / required-checks (push) Successful in 1s
deploy / deploy (push) Successful in 48s
feat(corrections): #314 defect fix, credential rotation, release guard, task lifecycle, route scoping, PL1 records + metrics
CORRECTION 1: #314 reopened — recall_with_associations mode field defect
CONFIRMED in current source and FIXED (mode: association_merged).

CORRECTION 3: Gitea credential removed from remote URL (credential helper).
TOKEN EXPOSED: yes (in diagnostic output). TOKEN ROTATED: not yet (requires
Gitea web UI access). Remote URL now shows username only, no secret.

CORRECTION 4: duplicate-release-commit defect ROOT CAUSE: convergence
computed warranted bump from commits-since-tag without checking if master
version already satisfies the bump. FIX: already-converged guard in
version_convergence.py (master version > last tag → no commit). Repo-aware
(args.repo passed to read_version/latest_tag).

CORRECTION 6: lifecycle terminalization — execution exception now
guarantees task terminalizes as failed with evidence (no immortal RUNNING).

CORRECTION 7: route instruction task-scoped on RuneTask.route_instruction
(NOT shared operator state). Read-only leading-verb override. Isolation
tests prove no cross-contamination between interleaved tasks.

PL1-01/02/03/05: pl1_records.py (route resolution, proof level, failure
class, candidate status), metrics with honest NOT_YET_MEASURABLE semantics,
route-instruction learning loop (PE-1789102658-0269 SEED).

1253 tests green; ratchet 352/80 (shrink); henxels clean.
2026-09-11 15:36:08 +01:00

55 lines
1.9 KiB
Python

"""Resource authority composition + canary/docs wrappers."""
import subprocess
import sys
from pathlib import Path
from rune.orchestration.authority import build_resources
from rune.orchestration.composition import CompositionRoot, compose_resources
from rune.orchestration.resources import ResourceCapabilities, ResourceState
ROOT = Path(__file__).resolve().parents[1]
def test_build_resources_wires_one_of_each():
authority = build_resources()
assert authority.registry is not None
assert authority.filter is not None
assert authority.router is not None
assert authority.scheduler is not None
assert authority.broker is not None
def test_compose_resources_registers_single_authority():
root = CompositionRoot()
compose_resources(root)
root.assert_single_authority()
inv = root.inventory()
assert len(inv["resource_registry"]) == 1
assert len(inv["resource_scheduler"]) == 1
def test_end_to_end_unknown_rejected_and_outage_falls_back():
authority = build_resources()
authority.registry.register(ResourceState("r1", ResourceCapabilities("worker", "local"), healthy=None))
authority.registry.register(ResourceState("r2", ResourceCapabilities("worker", "local"), healthy=True))
assignment = authority.broker.acquire("t1", {"kind": "worker", "locality": "local"})
assert assignment.resource_id == "r2" # unknown r1 never considered
def test_canary_script_runs_clean():
result = subprocess.run(
[sys.executable, str(ROOT / "src/rune/canary_resource_authority.py")],
capture_output=True,
text=True,
timeout=60,
)
assert result.returncode == 0, result.stderr
assert "RESOURCE AUTHORITY CANARY PASSED" in result.stdout
def test_docs_exist_and_reference_real_paths():
docs = (ROOT / "docs/resource-authority.md").read_text()
assert "src/rune/orchestration/" in docs
assert "pytest" in docs