(stats: list[WorkflowStats], since: dt.datetime)
| 298 | |
| 299 | |
| 300 | def render_markdown(stats: list[WorkflowStats], since: dt.datetime) -> str: |
| 301 | lines: list[str] = [] |
| 302 | lines.append( |
| 303 | f"# OS-49 Phase 1 — ARC baseline ({REPO}, last {stats[0].window_days} days)" |
| 304 | ) |
| 305 | lines.append("") |
| 306 | lines.append(f"Window: `{since.date().isoformat()}` → today (UTC).") |
| 307 | lines.append("") |
| 308 | lines.append( |
| 309 | "| Workflow | Runs | Success | Wall p50 | Wall p95 | Queue p50 | Queue p95 |" |
| 310 | ) |
| 311 | lines.append("|---|---:|---:|---:|---:|---:|---:|") |
| 312 | has_reusable = False |
| 313 | for s in stats: |
| 314 | name = f"`{s.workflow}`" |
| 315 | if s.reusable: |
| 316 | name += " †" |
| 317 | has_reusable = True |
| 318 | lines.append( |
| 319 | f"| {name} | {s.run_count} | {fmt_rate(s.success_rate)} " |
| 320 | f"| {fmt_seconds(s.wall_p50)} | {fmt_seconds(s.wall_p95)} " |
| 321 | f"| {fmt_seconds(s.queue_p50)} | {fmt_seconds(s.queue_p95)} |" |
| 322 | ) |
| 323 | lines.append("") |
| 324 | lines.append( |
| 325 | "Percentiles cover runs with conclusion `success` or `failure` only — " |
| 326 | "`skipped`/`cancelled`/`startup_failure` are excluded so `if:` guards and early aborts " |
| 327 | "don't poison wall-time p50. Success rate = `success / (success + failure)`. " |
| 328 | "Queue time = `run_started_at − created_at`. Wall time = `updated_at − run_started_at`." # noqa: RUF001 — U+2212 minus rendered in output markdown |
| 329 | ) |
| 330 | if has_reusable: |
| 331 | lines.append("") |
| 332 | lines.append( |
| 333 | "† Reusable workflow (`workflow_call`). Runs attributed via " |
| 334 | "`referenced_workflows` on caller runs; wall/queue times are the " |
| 335 | "caller's totals, so they overstate the reusable piece." |
| 336 | ) |
| 337 | return "\n".join(lines) + "\n" |
| 338 | |
| 339 | |
| 340 | def parse_args() -> argparse.Namespace: |
no test coverage detected