mirror of
https://github.com/rcourtman/Pulse.git
synced 2026-11-28 16:58:31 +01:00
The existing identity migration explicitly moved dev-deploy-agent.sh out of dev-runtime-orchestration. The old lookup assertion fails identically on the assigned parent. Expect the already-published identity rule and its real build-recipe proof; leave the registry, helper and SSH host-key tests unchanged. Validate those SSH checks separately rather than dropping their runtime invariant. Contract-Neutral: Correct only a stale lookup-test expectation to match existing main policy; runtime, registry and SSH verification are unchanged. Change-source: pulse-maintainer
275 lines
12 KiB
Python
275 lines
12 KiB
Python
import unittest
|
|
|
|
from canonical_completion_guard import infer_impacted_subsystems, is_test_or_fixture
|
|
from subsystem_lookup import lookup_paths
|
|
|
|
|
|
class DevRuntimeGovernanceTest(unittest.TestCase):
|
|
def test_e2e_image_distribution_has_exact_scoped_proof(self) -> None:
|
|
files = [
|
|
".github/workflows/test-e2e.yml",
|
|
"scripts/e2e_test_images.py",
|
|
"tests/integration/docker-compose.test.yml",
|
|
]
|
|
result = lookup_paths(files)
|
|
self.assertEqual(result["unowned_runtime_files"], [])
|
|
for entry in result["files"]:
|
|
self.assertEqual(entry["classification"], "runtime")
|
|
self.assertEqual(len(entry["matches"]), 1)
|
|
match = entry["matches"][0]
|
|
self.assertEqual(match["subsystem"], "deployment-installability")
|
|
proof = match["verification_requirement"]
|
|
self.assertEqual(proof["id"], "e2e-image-distribution")
|
|
self.assertEqual(proof["exact_files"], ["scripts/tests/test_e2e_test_images.py"])
|
|
self.assertFalse(proof["allow_same_subsystem_tests"])
|
|
self.assertEqual(proof["test_prefixes"], [])
|
|
|
|
def test_shell_smoke_tests_are_classified_as_tests(self) -> None:
|
|
self.assertTrue(is_test_or_fixture("scripts/tests/test-hot-dev-bg.sh"))
|
|
self.assertEqual(infer_impacted_subsystems(["scripts/tests/test-hot-dev-bg.sh"]), {})
|
|
|
|
def test_lookup_leaves_unmatched_tests_without_matches(self) -> None:
|
|
result = lookup_paths(["tests/example.spec.ts"])
|
|
self.assertEqual(result["files"][0]["classification"], "test-or-fixture")
|
|
self.assertEqual(result["files"][0]["matches"], [])
|
|
|
|
def test_lookup_maps_hot_dev_bg_proof_file_to_installability(self) -> None:
|
|
result = lookup_paths(["scripts/tests/test-hot-dev-bg.sh"])
|
|
self.assertEqual(result["unowned_runtime_files"], [])
|
|
self.assertEqual(result["impacted_subsystems"], [])
|
|
|
|
file_entry = result["files"][0]
|
|
self.assertEqual(file_entry["classification"], "test-or-fixture")
|
|
self.assertEqual(
|
|
{match["subsystem"] for match in file_entry["matches"]},
|
|
{"deployment-installability"},
|
|
)
|
|
self.assertEqual(
|
|
{
|
|
match["verification_requirement"]["id"]
|
|
for match in file_entry["matches"]
|
|
},
|
|
{"dev-runtime-orchestration", "frontend-build-output"},
|
|
)
|
|
match = next(
|
|
match
|
|
for match in file_entry["matches"]
|
|
if match["verification_requirement"]["id"]
|
|
== "dev-runtime-orchestration"
|
|
)
|
|
self.assertEqual(
|
|
match["contract"],
|
|
"docs/release-control/v6/internal/subsystems/deployment-installability.md",
|
|
)
|
|
self.assertEqual(match["lane_context"]["lane_id"], "L1")
|
|
self.assertEqual(match["verification_requirement"]["id"], "dev-runtime-orchestration")
|
|
self.assertIn(
|
|
"scripts/tests/test-hot-dev-bg.sh",
|
|
match["verification_requirement"]["exact_files"],
|
|
)
|
|
|
|
def test_lookup_maps_dev_agent_deploy_helper_to_installability(self) -> None:
|
|
result = lookup_paths(["scripts/dev-deploy-agent.sh"])
|
|
self.assertEqual(result["unowned_runtime_files"], [])
|
|
self.assertEqual(
|
|
{entry["subsystem"] for entry in result["impacted_subsystems"]},
|
|
{"deployment-installability"},
|
|
)
|
|
|
|
file_entry = result["files"][0]
|
|
self.assertEqual(file_entry["classification"], "runtime")
|
|
self.assertEqual(
|
|
{match["subsystem"] for match in file_entry["matches"]},
|
|
{"deployment-installability"},
|
|
)
|
|
match = file_entry["matches"][0]
|
|
self.assertEqual(
|
|
match["contract"],
|
|
"docs/release-control/v6/internal/subsystems/deployment-installability.md",
|
|
)
|
|
self.assertEqual(match["lane_context"]["lane_id"], "L1")
|
|
# The canonical identity migration deliberately moved this helper
|
|
# out of dev-runtime-orchestration. Its registered proof exercises
|
|
# the actual build/deploy recipe, not only static SSH options.
|
|
# SSHHostKeyPolicyTest continues to cover those options separately.
|
|
self.assertEqual(match["verification_requirement"]["id"], "agent-executable-identity")
|
|
self.assertIn(
|
|
"scripts/installtests/build_agents_test.go",
|
|
match["verification_requirement"]["exact_files"],
|
|
)
|
|
|
|
def test_lookup_maps_integration_browser_default_surfaces_to_installability(self) -> None:
|
|
result = lookup_paths(
|
|
[
|
|
"tests/integration/README.md",
|
|
"tests/integration/QUICK_START.md",
|
|
"tests/integration/playwright.config.ts",
|
|
"tests/integration/tests/runtime-defaults.ts",
|
|
]
|
|
)
|
|
self.assertEqual(result["unowned_runtime_files"], [])
|
|
self.assertEqual(
|
|
{entry["subsystem"] for entry in result["impacted_subsystems"]},
|
|
{"deployment-installability"},
|
|
)
|
|
|
|
for file_entry in result["files"]:
|
|
self.assertEqual(file_entry["classification"], "runtime")
|
|
self.assertEqual(
|
|
{match["subsystem"] for match in file_entry["matches"]},
|
|
{"deployment-installability"},
|
|
)
|
|
match = file_entry["matches"][0]
|
|
self.assertEqual(
|
|
match["contract"],
|
|
"docs/release-control/v6/internal/subsystems/deployment-installability.md",
|
|
)
|
|
self.assertEqual(match["lane_context"]["lane_id"], "L1")
|
|
self.assertEqual(match["verification_requirement"]["id"], "dev-runtime-orchestration")
|
|
self.assertIn(
|
|
"scripts/tests/test-hot-dev-bg.sh",
|
|
match["verification_requirement"]["exact_files"],
|
|
)
|
|
|
|
def test_lookup_maps_browser_helpers_to_scoped_fixture_proof(self) -> None:
|
|
result = lookup_paths(["tests/integration/tests/helpers.ts"])
|
|
self.assertEqual(result["unowned_runtime_files"], [])
|
|
match = result["files"][0]["matches"][0]
|
|
self.assertEqual(match["subsystem"], "deployment-installability")
|
|
proof = match["verification_requirement"]
|
|
self.assertEqual(proof["id"], "browser-fixture-helpers")
|
|
self.assertIn("tests/integration/scripts/fixture-auth.test.mjs", proof["exact_files"])
|
|
self.assertIn("tests/integration/scripts/organization-fixtures.test.mjs", proof["exact_files"])
|
|
self.assertFalse(proof["allow_same_subsystem_tests"])
|
|
|
|
def test_lookup_maps_browser_acquisition_to_signed_package_proof(self) -> None:
|
|
result = lookup_paths(["scripts/playwright-apt.conf", "scripts/browser_os_packages.py"])
|
|
self.assertEqual(result["unowned_runtime_files"], [])
|
|
for entry in result["files"]:
|
|
self.assertEqual(entry["classification"], "runtime")
|
|
self.assertEqual(len(entry["matches"]), 1)
|
|
match = entry["matches"][0]
|
|
self.assertEqual(match["subsystem"], "deployment-installability")
|
|
proof = match["verification_requirement"]
|
|
self.assertEqual(proof["id"], "browser-os-acquisition")
|
|
self.assertEqual(proof["exact_files"], [
|
|
"scripts/tests/test_browser_os_packages.py",
|
|
"scripts/tests/test_playwright_acquisition.py",
|
|
])
|
|
self.assertFalse(proof["allow_same_subsystem_tests"])
|
|
self.assertEqual(proof["test_prefixes"], [])
|
|
|
|
def test_lookup_maps_release_promotion_workflows_to_installability(self) -> None:
|
|
result = lookup_paths(
|
|
[
|
|
".github/workflows/publish-docker.yml",
|
|
".github/workflows/promote-floating-tags.yml",
|
|
".github/workflows/promote-private-pro-runtime.yml",
|
|
".github/workflows/release-convergence.yml",
|
|
".github/workflows/retry-release-convergence.yml",
|
|
"pulse-pro:.github/workflows/promote-paid-runtime-release.yml",
|
|
"pulse-pro:scripts/validate_paid_runtime_distribution.py",
|
|
]
|
|
)
|
|
self.assertEqual(result["unowned_runtime_files"], [])
|
|
self.assertEqual(
|
|
{entry["subsystem"] for entry in result["impacted_subsystems"]},
|
|
{"deployment-installability"},
|
|
)
|
|
|
|
for file_entry in result["files"]:
|
|
self.assertEqual(file_entry["classification"], "runtime")
|
|
self.assertEqual(
|
|
{match["subsystem"] for match in file_entry["matches"]},
|
|
{"deployment-installability"},
|
|
)
|
|
match = file_entry["matches"][0]
|
|
self.assertEqual(
|
|
match["contract"],
|
|
"docs/release-control/v6/internal/subsystems/deployment-installability.md",
|
|
)
|
|
self.assertEqual(match["lane_context"]["lane_id"], "L1")
|
|
self.assertEqual(
|
|
match["verification_requirement"]["id"],
|
|
"release-promotion-metadata-runtime",
|
|
)
|
|
self.assertIn(
|
|
"scripts/release_control/release_promotion_policy_test.py",
|
|
match["verification_requirement"]["exact_files"],
|
|
)
|
|
|
|
def test_lookup_maps_release_artifact_follow_on_surfaces_to_installability(self) -> None:
|
|
result = lookup_paths(
|
|
[
|
|
".github/workflows/helm-pages.yml",
|
|
".github/workflows/publish-helm-chart.yml",
|
|
".github/workflows/update-demo-server.yml",
|
|
"scripts/trigger-release-dry-run.sh",
|
|
"scripts/trigger-release.sh",
|
|
]
|
|
)
|
|
self.assertEqual(result["unowned_runtime_files"], [])
|
|
self.assertEqual(
|
|
{entry["subsystem"] for entry in result["impacted_subsystems"]},
|
|
{"deployment-installability"},
|
|
)
|
|
|
|
for file_entry in result["files"]:
|
|
self.assertEqual(file_entry["classification"], "runtime")
|
|
self.assertEqual(
|
|
{match["subsystem"] for match in file_entry["matches"]},
|
|
{"deployment-installability"},
|
|
)
|
|
match = file_entry["matches"][0]
|
|
self.assertEqual(
|
|
match["contract"],
|
|
"docs/release-control/v6/internal/subsystems/deployment-installability.md",
|
|
)
|
|
self.assertEqual(match["lane_context"]["lane_id"], "L1")
|
|
self.assertEqual(
|
|
match["verification_requirement"]["id"],
|
|
"release-promotion-metadata-runtime",
|
|
)
|
|
self.assertIn(
|
|
"scripts/release_control/release_promotion_policy_test.py",
|
|
match["verification_requirement"]["exact_files"],
|
|
)
|
|
|
|
def test_lookup_maps_release_promotion_runbook_and_dispatch_checker_to_installability(self) -> None:
|
|
result = lookup_paths(
|
|
[
|
|
"docs/releases/V6_PRERELEASE_RUNBOOK.md",
|
|
"scripts/check-workflow-dispatch-inputs.py",
|
|
]
|
|
)
|
|
self.assertEqual(result["unowned_runtime_files"], [])
|
|
self.assertEqual(
|
|
{entry["subsystem"] for entry in result["impacted_subsystems"]},
|
|
{"deployment-installability"},
|
|
)
|
|
|
|
for file_entry in result["files"]:
|
|
self.assertEqual(file_entry["classification"], "runtime")
|
|
self.assertEqual(
|
|
{match["subsystem"] for match in file_entry["matches"]},
|
|
{"deployment-installability"},
|
|
)
|
|
match = file_entry["matches"][0]
|
|
self.assertEqual(
|
|
match["contract"],
|
|
"docs/release-control/v6/internal/subsystems/deployment-installability.md",
|
|
)
|
|
self.assertEqual(match["lane_context"]["lane_id"], "L1")
|
|
self.assertEqual(
|
|
match["verification_requirement"]["id"],
|
|
"release-promotion-metadata-runtime",
|
|
)
|
|
self.assertIn(
|
|
"scripts/release_control/release_promotion_policy_test.py",
|
|
match["verification_requirement"]["exact_files"],
|
|
)
|
|
|
|
|
|
if __name__ == "__main__":
|
|
unittest.main()
|