INNER CODE UNIT · Python
discover_policy_source_paths
apache/shardingsphere · .codex/harness/agents/run.py:478
def discover_policy_source_paths(repo_root: Path) -> set[str]:
"""Discover policy-like repository files that must be registered explicitly."""
result = set()
for pattern in POLICY_SOURCE_GLOBS:
result.update(
path.relative_to(repo_root).as_posix()
for path in repo_root.glob(pattern)
if path.is_file()
)
return result
def load_policy_manifest(repo_root: Path, manifest_path: Path | None = None) -> dict[str, Any]:
"""Load, validate, inventory, and hash the exact policy-source bundle."""
override_path = repo_root / "AGENTS.override.md"
if override_path.is_file() and override_path.read_text(encoding="utf-8").strip():
raise ValueError("Policy harness requires repository AGENTS.override.md to be absent or empty.")
manifest_path = manifest_path or Path(__file__).with_name(MANIFEST_NAME)