Skip to content

matt-bat/got-skills / skills/skill-governance

skill-governance

Verified

Govern release-affecting, policy-changing, externally mutating, destructive, or otherwise high-risk work through typed effects, mandatory evidence, independent safety gates, and an explicit go/no-go decision. Do not use for ordinary answers, read-only inspection, tiny reversible edits, or a task made "multi-skill" only by optional process helpers.

FileKindSize
SKILL.mdskill md9.7 KB
fixtures/passed-artifact-evidence.jsonconfig104 B
fixtures/routing-scenarios.jsonconfig44.2 KB
references/governance-artifacts.mdmarkdown5.1 KB
references/risk-and-gates.mdmarkdown4.6 KB
requirements.txtmanifest89 B
schemas/governance-artifact.schema.jsonconfig13.6 KB
schemas/remote-configuration-policy.schema.jsonconfig4.3 KB
schemas/routing-result.schema.jsonconfig7.7 KB
schemas/task-descriptor.schema.jsonconfig13.3 KB
scripts/enforce_governance_ci.pyscript24.4 KB
scripts/generate_governance_artifact.pyscript43.4 KB
scripts/generate_routing_views.pyscript27.6 KB
scripts/governance_common.pyscript14.5 KB
scripts/record_routing_observation.pyscript9.3 KB
scripts/resolve_task_route.pyscript69.4 KB
scripts/validate_governance_artifact.pyscript39.9 KB
scripts/validate_skill_order_sync.pyscript4.0 KB
scripts/validate_skill_policy.pyscript32.3 KB
scripts/verify_remote_configuration.pyscript12.3 KB
tests/test_advanced_svg_render.pyscript5.1 KB
tests/test_conflict_matrix_integrity.pyscript2.1 KB
tests/test_default_skill_quality_gates.pyscript2.9 KB
tests/test_docs_website_navigation.pyscript2.7 KB
tests/test_enforce_governance_scope.pyscript1.7 KB
tests/test_generate_governance_startup.pyscript9.0 KB
tests/test_generate_routing_views.pyscript12.8 KB
tests/test_governance_history_and_pair_integrity.pyscript10.6 KB
tests/test_governance_integrity.pyscript55.7 KB
tests/test_new_skill_integration.pyscript8.3 KB
tests/test_project_index_integrity.pyscript6.4 KB
tests/test_remote_configuration.pyscript5.6 KB
tests/test_routing_observation.pyscript4.3 KB
tests/test_runtime_adapter.pyscript9.2 KB
tests/test_task_routing.pyscript47.5 KB
tests/test_validate_skill_order_sync.pyscript2.4 KB
tests/test_validate_skill_policy_smoke.pyscript869 B

tests/test_remote_configuration.py

View on GitHub
from __future__ import annotations

import copy
import importlib.util
import json
import subprocess
import sys
import tempfile
import unittest
from pathlib import Path


ROOT = Path(__file__).resolve().parents[3]
SCRIPT_PATH = ROOT / "skills" / "skill-governance" / "scripts" / "verify_remote_configuration.py"
POLICY_PATH = ROOT / ".github" / "branch-protection-policy.json"
SCHEMA_PATH = (
    ROOT / "skills" / "skill-governance" / "schemas" / "remote-configuration-policy.schema.json"
)

SPEC = importlib.util.spec_from_file_location("verify_remote_configuration", SCRIPT_PATH)
assert SPEC and SPEC.loader
remote = importlib.util.module_from_spec(SPEC)
SPEC.loader.exec_module(remote)


def github_response() -> dict:
    return {
        "url": "https://api.github.com/repos/matt-bat/agent-command-center/branches/main/protection",
        "required_status_checks": {
            "url": "https://api.github.com/status-checks",
            "strict": True,
            "contexts": ["governance"],
            "contexts_url": "https://api.github.com/contexts",
            "checks": [{"context": "governance", "app_id": 15368}],
        },
        "required_signatures": {"url": "https://api.github.com/signatures", "enabled": False},
        "enforce_admins": {"url": "https://api.github.com/admins", "enabled": True},
        "required_linear_history": {"enabled": False},
        "allow_force_pushes": {"enabled": False},
        "allow_deletions": {"enabled": False},
        "block_creations": {"enabled": False},
        "required_conversation_resolution": {"enabled": False},
        "lock_branch": {"enabled": False},
        "allow_fork_syncing": {"enabled": False},
    }


class TestRemoteConfiguration(unittest.TestCase):
    def test_checked_in_policy_is_schema_valid_and_matches_verified_shape(self) -> None:
        self.assertEqual(remote.validate_policy_file(POLICY_PATH, SCHEMA_PATH), [])
        policy = json.loads(POLICY_PATH.read_text(encoding="utf-8"))
        normalized = remote.normalize_github_protection(
            github_response(), repository=policy["repository"], branch=policy["branch"]
        )
        self.assertEqual(remote.compare_state(policy["protection"], normalized), [])

    def test_target_identity_mismatch_fails_closed(self) -> None:
        with self.assertRaisesRegex(remote.RemotePolicyError, "target mismatch"):
            remote.normalize_github_protection(
                github_response(), repository="different/repository", branch="main"
            )

    def test_unknown_remote_field_fails_closed(self) -> None:
        actual = github_response()
        actual["new_unmodeled_control"] = {"enabled": True}
        with self.assertRaisesRegex(remote.RemotePolicyError, "unsupported fields"):
            remote.normalize_github_protection(
                actual, repository="matt-bat/agent-command-center", branch="main"
            )

    def test_unknown_policy_field_and_wrong_schema_pointer_fail_closed(self) -> None:
        policy = json.loads(POLICY_PATH.read_text(encoding="utf-8"))
        schema = json.loads(SCHEMA_PATH.read_text(encoding="utf-8"))
        policy["unknown_policy"] = True
        policy["$schema"] = "different.schema.json"
        errors = remote.validate_policy(policy, schema)
        self.assertTrue(any("Additional properties" in error for error in errors), errors)
        self.assertTrue(any(error.startswith("$schema:") for error in errors), errors)

    def test_setting_drift_is_reported_at_exact_path(self) -> None:
        policy = json.loads(POLICY_PATH.read_text(encoding="utf-8"))
        actual = github_response()
        actual["allow_force_pushes"]["enabled"] = True
        normalized = remote.normalize_github_protection(
            actual, repository=policy["repository"], branch=policy["branch"]
        )
        self.assertEqual(
            remote.compare_state(policy["protection"], normalized),
            ["protection.allow_force_pushes: expected False, actual True"],
        )

    def test_cli_passes_exact_state_and_rejects_drift(self) -> None:
        with tempfile.TemporaryDirectory() as raw:
            actual_path = Path(raw) / "actual.json"
            actual_path.write_text(json.dumps(github_response()), encoding="utf-8")
            command = [
                sys.executable,
                str(SCRIPT_PATH),
                "--policy",
                str(POLICY_PATH),
                "--actual",
                str(actual_path),
                "--schema",
                str(SCHEMA_PATH),
            ]
            passed = subprocess.run(command, capture_output=True, text=True, check=False)
            self.assertEqual(passed.returncode, 0, passed.stdout + passed.stderr)

            drifted = copy.deepcopy(github_response())
            drifted["enforce_admins"]["enabled"] = False
            actual_path.write_text(json.dumps(drifted), encoding="utf-8")
            failed = subprocess.run(command, capture_output=True, text=True, check=False)
            self.assertEqual(failed.returncode, 1)
            self.assertIn("protection.enforce_admins", failed.stderr)

    def test_cli_accepts_actual_state_on_standard_input(self) -> None:
        result = subprocess.run(
            [
                sys.executable,
                str(SCRIPT_PATH),
                "--policy",
                str(POLICY_PATH),
                "--actual",
                "-",
                "--schema",
                str(SCHEMA_PATH),
            ],
            input=json.dumps(github_response()),
            capture_output=True,
            text=True,
            check=False,
        )
        self.assertEqual(result.returncode, 0, result.stdout + result.stderr)


if __name__ == "__main__":
    unittest.main()
reverse-engineer-anythingmorluto/reaReverse engineer native, managed, Electron/JavaScript, packaged, firmware, and browser targets with REA, and build agent environments (AgentEnv bundles) of web applications from a live instance or a capture, and of Linux desktop apps with a task from a request. Use shipped-artifact or requested runtime evidence to explain features, compare versions, decompile code, or guide a reconstruction. Skip REA for ordinary source-repository architecture analysis.Stars: 472kUpdated Claude CodeCodexVerifiedInstall
diagnosing-superpowersobra/superpowersUse when a superpowers session went wrong and your human partner wants to know why — repeated work, ignored plans, stumbles, poor results, a skill that didn't fire, "it took too long", "why is it so expensive", "what is it doing" — or wants to build a bug report for the superpowers maintainers, for the current session or a past one identified by id or path, on any harness.Stars: 322kUpdated Claude CodeCodexVerifiedInstall
dispatching-parallel-agentsobra/superpowersUse when facing 2+ independent tasks that can be worked on without shared state or sequential dependenciesStars: 322kUpdated Claude CodeCodexVerifiedInstall
executing-plansobra/superpowersUse when executing an implementation plan in the current session as the implementer yourself — your human partner chose inline execution, or no subagent tool is availableStars: 322kUpdated Claude CodeCodexVerifiedInstall