The existing workflows never built the `leleka` binary (crates/deploy) or ran the tests of leleka-deploy, leleka-memory,
leleka-runtime-client, leleka-runtime or leleka-cuda-driver (docs/ci-audit.md). New: scripts/check-local.sh --product and
.github/workflows/product.yml (default-member build, release build of the six shipped binaries, cargo check of the CUDA-feature
crates, tests, rustfmt/Clippy), scripts/check-ci-coverage.py + scripts/ci-coverage.json (fail when a workspace member has no CI
coverage entry), scripts/ci/nvidia-smi (hermetic stand-in for the deploy end-to-end tests).
Repairs found by running every step: check-local --fast failed on rustfmt in leleka-backend-api/leleka-context and on Clippy
type_complexity in leleka-tokenizer (formatting and a local type alias only); `cargo test -p leleka-cuda-driver` does not compile without
its cuda-driver feature (script now passes it); the desktop.yml hardware smoke step had no --bin (six binaries, no default-run);
the stale 8192 context assertion in crates/deploy/tests/e2e.rs (the laptop profile is 262144 since 621d35276); five trivial Clippy
lints in leleka-memory and leleka-deploy; the literal_port drift guard (red since the 2026-10-25 upstream sync) is reported as debt;
control-plane Clippy no longer lints its path dependencies; the sampler host-shim script works under Git Bash; worktree.sh creates
worktrees with core.autocrlf=false and .gitattributes marks the sealed PTX -text (a CRLF checkout makes the binary refuse to start).
No kernel, engine numeric or runtime behaviour is changed.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
93 lines
4.4 KiB
Python
Executable File
93 lines
4.4 KiB
Python
Executable File
#!/usr/bin/env python3
|
|
"""Fail when a workspace package is not covered by a CI step (docs/ci-audit.md).
|
|
|
|
`scripts/ci-coverage.json` assigns every workspace member exactly one level:
|
|
|
|
tested built and `cargo test`ed (directly or through check-local.sh) by a CI job
|
|
typechecked `cargo check`ed only (the crate cannot run on the CI host), with the reason in "notes"
|
|
exempt not covered, with the reason; each entry is an explicit, reviewed decision
|
|
|
|
The script reads the real member and default-member lists from `cargo metadata --locked`, so a crate added to the
|
|
workspace, or to default-members, without a line in the JSON fails the CI job instead of silently going unbuilt.
|
|
It also looks for evidence that the claimed coverage exists: for every `tested` or `typechecked` package the
|
|
workflows or check-local.sh must name it (`-p NAME`, `--manifest-path DIR/Cargo.toml`, or the strict_crates list).
|
|
|
|
Usage: scripts/check-ci-coverage.py [--root DIR] (no model, GPU or network access; needs cargo and the lockfile)
|
|
"""
|
|
import argparse
|
|
import json
|
|
import pathlib
|
|
import re
|
|
import subprocess
|
|
import sys
|
|
|
|
|
|
def main() -> int:
|
|
parser = argparse.ArgumentParser()
|
|
parser.add_argument("--root", default=str(pathlib.Path(__file__).resolve().parent.parent))
|
|
root = pathlib.Path(parser.parse_args().root).resolve()
|
|
|
|
metadata = json.loads(
|
|
subprocess.run(
|
|
["cargo", "metadata", "--locked", "--no-deps", "--format-version", "1"],
|
|
cwd=root, check=True, capture_output=True, text=True,
|
|
).stdout
|
|
)
|
|
packages = {p["id"]: p for p in metadata["packages"]}
|
|
members = {packages[i]["name"]: pathlib.Path(packages[i]["manifest_path"]).parent.relative_to(root).as_posix()
|
|
for i in metadata["workspace_members"]}
|
|
defaults = {packages[i]["name"] for i in metadata["workspace_default_members"]}
|
|
|
|
coverage = json.loads((root / "scripts" / "ci-coverage.json").read_text(encoding="utf-8"))
|
|
level = {}
|
|
errors = []
|
|
for name in coverage["tested"]:
|
|
level.setdefault(name, []).append("tested")
|
|
for name in coverage["typechecked"]:
|
|
level.setdefault(name, []).append("typechecked")
|
|
for name in coverage["exempt"]:
|
|
level.setdefault(name, []).append("exempt")
|
|
|
|
for name in sorted(members):
|
|
got = level.get(name, [])
|
|
if not got:
|
|
where = "default-member" if name in defaults else "member"
|
|
errors.append(f"{name}: workspace {where} with no CI coverage entry in scripts/ci-coverage.json")
|
|
elif len(got) > 1:
|
|
errors.append(f"{name}: listed more than once ({', '.join(got)})")
|
|
for name in sorted(level):
|
|
if name not in members:
|
|
errors.append(f"{name}: listed in scripts/ci-coverage.json but not a workspace member (stale entry)")
|
|
for name, reason in coverage["exempt"].items():
|
|
if not reason.strip():
|
|
errors.append(f"{name}: exempt without a reason")
|
|
for name in sorted(defaults & {n for n, v in level.items() if v == ["exempt"]}):
|
|
errors.append(f"{name}: a default-member (built by a plain `cargo build`) is exempt from CI; "
|
|
"give it a build/test step or take it out of default-members")
|
|
|
|
corpus = ""
|
|
for path in [*sorted((root / ".github" / "workflows").glob("*.yml")), root / "scripts" / "check-local.sh"]:
|
|
corpus += path.read_text(encoding="utf-8") + "\n"
|
|
strict = re.search(r"strict_crates=\(([^)]*)\)", corpus)
|
|
strict_names = set(strict.group(1).split()) if strict else set()
|
|
for name in sorted(n for n, v in level.items() if v and v[0] in ("tested", "typechecked") and n in members):
|
|
directory = members[name]
|
|
evidence = (
|
|
re.search(rf"-p\s+{re.escape(name)}(?![\w-])", corpus)
|
|
or re.search(rf"--manifest-path\s+{re.escape(directory)}/Cargo\.toml", corpus)
|
|
or name in strict_names
|
|
)
|
|
if not evidence:
|
|
errors.append(f"{name}: claimed {level[name][0]} but no workflow or check-local.sh step names it "
|
|
f"(-p {name} / --manifest-path {directory}/Cargo.toml)")
|
|
|
|
print(f"workspace members: {len(members)}; default-members: {len(defaults)}; "
|
|
f"tested {len(coverage['tested'])}, typechecked {len(coverage['typechecked'])}, exempt {len(coverage['exempt'])}")
|
|
for line in errors:
|
|
print(f"UNCOVERED: {line}", file=sys.stderr)
|
|
return 1 if errors else 0
|
|
|
|
|
|
if __name__ == "__main__":
|
|
sys.exit(main())
|