Files
lainandSisyphus a6d6168fd5 chore: add community files, CI workflows, and host test tooling
Add the repository-facing scaffolding:

- Community/legal: README.md, LICENSE (GPL-3.0-or-later), NOTICE,
  CONTRIBUTING.md, SECURITY.md, CODE_OF_CONDUCT.md, .gitleaks.toml
- CI: .github/ workflows (ci.yml aggregate gate, nightly.yml, codeql.yml),
  issue/PR templates, dependabot config (pinned Actions per README)
- Host tooling: tools/frame_tools (ruff/pyright/pytest gates, partition,
  evidence-schema, doc-links, SBOM checks), tests/, pyproject.toml, uv.lock
- poc/ host side: poc/host contract-test suite (ASan/TSan-capable),
  poc/README.md, poc/poc-a.code-workspace

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <[email protected]>
2026-08-31 08:00:51 +08:00

43 lines
1.3 KiB
Python

"""Enforce LLVM branch coverage for the shared Frame contract headers."""
from __future__ import annotations
import argparse
import json
import sys
from collections.abc import Sequence
from pathlib import Path
def branch_percentage(report: Path) -> float:
data = json.loads(report.read_text(encoding="utf-8"))
try:
return float(data["data"][0]["totals"]["branches"]["percent"])
except (KeyError, IndexError, TypeError, ValueError) as error:
raise ValueError(f"{report}: invalid llvm-cov export") from error
def main(argv: Sequence[str] | None = None) -> int:
parser = argparse.ArgumentParser(description="Check Frame LLVM branch coverage")
parser.add_argument("report", type=Path)
parser.add_argument("--minimum", type=float, default=90.0)
args = parser.parse_args(argv)
try:
percentage = branch_percentage(args.report)
except (OSError, UnicodeError, json.JSONDecodeError, ValueError) as error:
print(error, file=sys.stderr)
return 1
if percentage < args.minimum:
print(
f"branch coverage {percentage:.2f}% is below {args.minimum:.2f}%",
file=sys.stderr,
)
return 1
print(f"branch coverage {percentage:.2f}% meets {args.minimum:.2f}%")
return 0
if __name__ == "__main__":
raise SystemExit(main())