Files
pulse/scripts/release_control/dev_runtime_governance_test.py
T
rcourtman 64c0a3f9df Scope browser OS acquisition to the runner's signed Ubuntu sources
An unrelated Microsoft repository returned 403 during fresh-index admission and stopped a browser shard before any test could run. Load the hosted runner's existing Ubuntu Deb822 definition for browser packages, preserving its mirrors and signature policy. Fail when that definition is missing, unreadable or empty and keep strict index and archive hash checks.

Exercise the real apt parser, exclusion of unrelated feeds, missing definitions and incomplete index failures in private acquisition directories. Register the package helper and policy with their exact verification routes, and update the fixture helper's governance assertion to its scoped proof contract.
2026-10-25 04:00:03 +00:00

271 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")
self.assertEqual(match["verification_requirement"]["id"], "dev-runtime-orchestration")
self.assertIn(
"scripts/release_control/ssh_host_key_policy_test.py",
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()