ops-warden/tests/test_workload_join.py

59 lines
2.1 KiB
Python
Raw Normal View History

"""Explicit lane-to-workload join tests (WARDEN-WP-0032 / RMGR-WP-0010-T06)."""
from pathlib import Path
import yaml
from scripts.report_workload_join import build
ROOT = Path(__file__).resolve().parents[1]
def test_repo_catalog_uses_only_explicit_workload_references():
report = build(ROOT / "registry/routing/catalog.yaml", Path.home())
assert report["ok"] is True
assert len(report["resolved"]) == 3
Revert the npm field, re-measure coverage, and hold the layer divergence Five inbox items worked, none of which changed a credential value or moved a secret. whynot-design-npm-publish: field reverted npm_token -> NPM_AUTH_TOKEN and the path confirmed, on railiance-platform's attended, read-only, no-value field enumeration (their docs/evidence/2026-09-10-npm-lane-field-resolution.json). Exactly one field is present at the governed path. The 2026-09-09 change was adopted from a coordination message and would have failed at the WP-0037-T03 rotation. The ungoverned second location is recorded as an explicit non-lane, not deleted and not tidied away. pep-stance coverage: published figures were stale by eight lanes (unknown 18->20, not_applicable 12->15) while resolved stayed at 3 — the denominator moved, the classification did not. Caught by the test that asserts the published block equals what report_coverage.py measures. tests/test_workload_join.py held the same stale counts; both now measure the same populations. rapp-qonto-keycape-client: blocker character updated — authority exists and is unexercised by owner decision ("not yet", offer open), which is not the same as no authority existing. Reopen triggers are events, never elapsed time. flex-auth -> access-engine rename (WARDEN-IN-0003): access-engine added to the policy-check lane's keywords so routing resolves under both names from today. owner_repo deliberately not flipped — policy.py sends it as resource.system on every /v1/check, and FLEX-DEC-2026-013 keeps runtime names as flex-auth. layer declaration: INTENT.md says Staff, layer.yaml says staff, section 11 does not say which governs. Neither changed; gate-house holds the ruling. Position in docs/layer-declaration-precedence.md, wait in WARDEN-WP-0034-T06, and a comment in layer.yaml telling the next session not to "fix" it — the divergence is the evidence the ruling is made against. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Assistant: claude-code Assistant-Model: opus Assistant-Process: 63291@bnt-lap001 Assistant-Session: 8bd77868-ca68-4f49-bb1e-d539ecc0d703
2026-09-21 02:16:33 +02:00
assert len(report["unknown"]) == 20
# 15 since 2026-09-21: the layer-declaration route is repository conformance
# guidance, not a workload delivery lane, and the two NetKingdom SSO lanes
# (c374d41) remain provider/control-plane credentials. Lanes added after
# 2026-09-09 moved the denominator without moving `resolved`; these counts
# and pep-stance.yaml's classification_coverage measure the same populations
# and must be updated together.
assert len(report["not_applicable"]) == 15
assert {row["lane"] for row in report["resolved"]} == {
"ops-warden-warden-sign-token",
"issue-core-ingestion-api-key",
"rapp-qonto-keycape-client",
}
def test_invalid_exact_deployable_resolves_unknown(tmp_path):
rapp = tmp_path / "rapp-x" / "declarations"
rapp.mkdir(parents=True)
(rapp / "rapp.yaml").write_text(yaml.safe_dump({
"rapp_id": "rapp-x",
"workload_identity": {"name": "x"},
"composition": {"member_repos": [{"deployables": ["api"]}]},
}))
catalog_dir = tmp_path / "ops-warden" / "registry" / "routing"
catalog_dir.mkdir(parents=True)
catalog = catalog_dir / "catalog.yaml"
catalog.write_text(yaml.safe_dump({"entries": [{
"id": "x",
"workload_ref": {
"applicability": "applicable",
"rapp_id": "rapp-x",
"name": "x",
"deployable": "missing",
},
}]}))
posture = catalog_dir.parent / "policy"
posture.mkdir()
(posture / "security-posture.yaml").write_text("dataclass_floor: {}\n")
report = build(catalog, tmp_path)
assert not report["resolved"]
assert report["unknown"][0]["lane"] == "x"
assert "deployable" in report["unknown"][0]["reason"]