REUSE-WP-0014: T11 docs, roster stats, workplan finished
Some checks failed
ci / validate-registry (push) Has been cancelled

Link local-repo-roster in RegistryFederation; rollout milestone history;
update IntentScopeGapAnalysis (60 hub members). Add stats --roster
--federation-ready for workstation federation readiness.
This commit is contained in:
2026-06-16 02:09:57 +02:00
parent 993ffb42ea
commit 7c048a9f09
8 changed files with 253 additions and 40 deletions

View File

@@ -256,4 +256,95 @@ def format_stats_markdown(stats: dict[str, Any]) -> str:
def format_stats_json(stats: dict[str, Any]) -> str:
return json.dumps(stats, indent=2, sort_keys=True)
def collect_roster_stats(
roster_path: Path,
*,
federation_ready: bool = False,
) -> dict[str, Any]:
data = yaml.safe_load(roster_path.read_text(encoding="utf-8"))
repos = data.get("repos", [])
summary = data.get("summary", {})
publish_fail = [r["slug"] for r in repos if r.get("publish_check") == "fail"]
hub_missing = [r["slug"] for r in repos if not r.get("hub_registered")]
pending = [r["slug"] for r in repos if r.get("status") != "established"]
stats: dict[str, Any] = {
"roster_path": str(roster_path),
"workstation_root": data.get("workstation_root"),
"definition": data.get("definition"),
"summary": summary,
"counts": {
"total": summary.get("total", len(repos)),
"established": summary.get("established", 0),
"pending": summary.get("pending", 0),
"hub_registered": summary.get("hub_registered", 0),
"publish_pass": summary.get("publish_pass", 0),
"publish_fail": summary.get("publish_fail", len(publish_fail)),
"with_reuse_surface_seed": summary.get("with_reuse_surface_seed", 0),
},
"publish_fail_slugs": publish_fail,
"hub_unregistered_slugs": hub_missing,
"pending_slugs": pending,
"federation_ready": federation_ready,
}
if federation_ready:
total = stats["counts"]["total"] or len(repos)
publish_pass = stats["counts"]["publish_pass"] or 0
stats["federation_readiness"] = {
"all_established": stats["counts"]["pending"] == 0,
"all_hub_registered": len(hub_missing) == 0,
"all_publish_pass": len(publish_fail) == 0,
"publish_pass_ratio": f"{publish_pass}/{total}",
"publish_sweep": summary.get("publish_sweep"),
}
return stats
def format_roster_stats_markdown(stats: dict[str, Any]) -> str:
lines = ["# Workstation roster federation stats", ""]
lines.append(f"**Roster:** `{stats['roster_path']}`")
if stats.get("workstation_root"):
lines.append(f"**Workstation root:** `{stats['workstation_root']}`")
lines.append("")
counts = stats["counts"]
lines.append("## Summary")
lines.append(f"- total repos: **{counts['total']}**")
lines.append(f"- established: **{counts['established']}**")
lines.append(f"- pending: **{counts['pending']}**")
lines.append(f"- hub registered: **{counts['hub_registered']}**")
lines.append(f"- publish pass: **{counts['publish_pass']}**")
lines.append(f"- publish fail: **{counts['publish_fail']}**")
lines.append("")
if stats.get("federation_readiness"):
fr = stats["federation_readiness"]
lines.append("## Federation readiness")
lines.append(f"- all established: `{fr['all_established']}`")
lines.append(f"- all hub registered: `{fr['all_hub_registered']}`")
lines.append(f"- all publish pass: `{fr['all_publish_pass']}`")
lines.append(f"- publish pass ratio: **{fr['publish_pass_ratio']}**")
if fr.get("publish_sweep"):
lines.append(f"- last sweep: `{fr['publish_sweep']}`")
lines.append("")
if stats.get("publish_fail_slugs"):
lines.append("## Publish fail")
for slug in stats["publish_fail_slugs"]:
lines.append(f"- `{slug}`")
lines.append("")
if stats.get("hub_unregistered_slugs"):
lines.append("## Hub not registered")
for slug in stats["hub_unregistered_slugs"]:
lines.append(f"- `{slug}`")
lines.append("")
return "\n".join(lines) + "\n"
def format_roster_stats_json(stats: dict[str, Any]) -> str:
return json.dumps(stats, indent=2, sort_keys=True)