diff --git a/docs/progress_dashboard.md b/docs/progress_dashboard.md index 88647e1f02..cea57bfbb1 100644 --- a/docs/progress_dashboard.md +++ b/docs/progress_dashboard.md @@ -29,7 +29,7 @@ are read directly; there is no need to re-save them as UTF-8. | Shader corpus | `--work `: counts per stage from `/shaders/dxbc/index.json` and `/shaders/spirv/index.json` | shaders, aggregated per stage | | Pull requests into main | `--github`: every pull request into `main` of the main repository (`--repo`, default `ubiquitarianism/leonida`), grouped by the item ID its title names (`D3D-86: …`, `… (SHADER-339)`) | pull request | | D3D12 layer | `--github`: the `D3D-` table of the D3D12 tracking issue, read through `gh` and checked against the merged and open pull requests. The issue is the open one whose title starts with "D3D12 → Vulkan layer", or the one `--d3d-issue N` names; when the repository has neither, the sources list says so and the panel stays empty (the number is not fixed: it was #313 in the original repository) | item | -| CI on main | `--github`: the latest completed run of each workflow on `main` | workflow | +| CI | `--github`: the latest observed run per workflow on `--ci-branch` (default `main`) plus repository-wide workflow configuration | workflow | Every run with `--github` reads the pull requests again, so a merge into `main` shows up on the next run as IMPLEMENTED, even before a tracking table (such as the D3D12 tracking issue's PR column) is edited. A pull request closed without merging is @@ -44,6 +44,44 @@ grabs", "Ready for review or a GPU test", "Needs a rebase on `main`") in the pag ` the page also lists that account's claims in the coordination issue (and the issue it continues) and its 50 latest pull requests. Nothing is posted: every `gh` call is a read. +## CI results + +Pass `--ci-branch` to inspect another branch while keeping the pull-request panels on `main`. + +```powershell +python -I tools/progress_dashboard.py --out ..\leonida_progress --github --ci-branch my-branch +``` + +The CI panel selects the newest observed run of each workflow, including incomplete runs. An older pass cannot +hide a newer cancellation or authorization request. Workflows are matched by ID, so a rename does not split a +workflow, and two workflows with the same name stay separate. Run details include the raw status and conclusion, +GitHub's associated `headSha`, event, run ID, attempt, link, and suggested action. A pull request runner can check out +a different merge commit. Rows without a run link to the workflow or repository Actions page. + +| CI state in JSON/details | Dashboard status | What to do | +|---|---|---| +| `passed` | VERIFIED | Inspect the linked successful run for its actual scope | +| `failed` (`failure`, `timed_out`, `startup_failure`) | FAILED | Inspect failed jobs and steps; keep the failing gate | +| `skipped` | UNKNOWN | Check conditions and prerequisites; no execution is established | +| `cancelled` | UNKNOWN | Check cancellation or a superseding run before requesting a rerun | +| `authorization_pending` (`action_required`) | BLOCKED | A maintainer reviews the external workflow before authorizing it | +| `pending` (`queued`, `requested`, `waiting`, `pending`, `in_progress`) | UNKNOWN | Wait; inspect queue, concurrency and approval blockers | +| `not_configured` | MISSING | The repository inventory explicitly reports a disabled/deleted workflow, or returns no workflows; a maintainer checks whether it should be enabled/restored | +| `not_observed` | UNKNOWN | An active workflow has no run in the queried history; check branch/path/event triggers and a wider history | +| `source_unavailable` | UNKNOWN | Check GitHub CLI authentication, read access and network, then refresh | +| `neutral` or `unknown` | UNKNOWN | Inspect the metadata; neither establishes a passing check | + +Configuration and execution are separate evidence. A disabled workflow with an observed failure keeps that failure +visible and records its disabled configuration too. A failed query never establishes a disabled workflow. No run +in the history does **not** prove a path-filter skip, pending authorization, or missing configuration. + +The run query covers at most 40 runs on the selected branch across all events, and selects one latest run per +workflow. Older events and runs may be absent. The separate repository-wide inventory includes disabled workflows, +at most 1000 entries, and is not a branch-specific workflow or CTest inventory. Both limits and query errors appear +under Sources. The panel reports workflow metadata. To check individual jobs, steps, test cases, or the commit that +ran, follow the run link. GitHub queries are read-only, and reported CI failures do not change the dashboard +generator's exit code. + ## How a status is decided | Status | Unit tests and CTest | Contract row | Import | Pull request | D3D- item | diff --git a/tests/test_progress_dashboard_ci.py b/tests/test_progress_dashboard_ci.py new file mode 100644 index 0000000000..1549ac6319 --- /dev/null +++ b/tests/test_progress_dashboard_ci.py @@ -0,0 +1,203 @@ +"""Regression tests for the dashboard CI panel. Synthetic gh responses; no network or game data.""" +import contextlib +import io +import json +from pathlib import Path +import subprocess +import sys +import tempfile +import unittest +from unittest import mock + +ROOT = Path(__file__).resolve().parents[1] +sys.path.insert(0, str(ROOT / "tools")) +import progress_dashboard as pd + + +def workflow(wid=1, name="CI", state="active"): + return {"id": wid, "name": name, "path": f".github/workflows/{wid}.yml", "state": state} + + +def run(conclusion="success", status="completed", wid=1, rid=100, date="2026-11-24T10:00:00Z"): + return {"workflowDatabaseId": wid, "workflowName": "CI", "databaseId": rid, "attempt": 1, + "conclusion": conclusion, "status": status, "headSha": "a" * 40, "event": "push", + "createdAt": date, "url": f"https://github.com/o/r/actions/runs/{rid}"} + + +class CIReporting(unittest.TestCase): + def collect(self, runs, workflows=None, branch=None): + calls = [] + + def fake_gh(args, timeout=60): + calls.append(args) + if args[:2] == ["run", "list"]: + return runs + if args[:2] == ["workflow", "list"]: + return workflows + return [] + + col = pd.Collector() + with mock.patch.object(pd, "gh_json", side_effect=fake_gh), \ + mock.patch.object(pd.shutil, "which", return_value="gh"): + kwargs = {} if branch is None else {"ci_branch": branch} + pd.collect_github(col, "o/r", None, **kwargs) + return col, [c for c in col.components if c["panel"] == "ci"], calls + + def test_completed_results_are_distinct_and_actionable(self): + cases = [("success", "verified", "passed"), ("failure", "failed", "failed"), + ("timed_out", "failed", "failed"), ("startup_failure", "failed", "failed"), + ("skipped", "unknown", "skipped"), ("cancelled", "unknown", "cancelled"), + ("neutral", "unknown", "neutral"), ("stale", "unknown", "unknown"), + ("", "unknown", "unknown"), ("future_result", "unknown", "unknown"), + ("action_required", "blocked", "authorization_pending")] + for conclusion, status, ci_state in cases: + with self.subTest(conclusion=conclusion): + _, rows, _ = self.collect([run(conclusion)], [workflow()]) + self.assertEqual(len(rows), 1) + self.assertEqual((rows[0]["status"], rows[0]["ci_state"]), (status, ci_state)) + self.assertTrue(rows[0]["action"]) + self.assertIn(rows[0]["action"], rows[0]["detail"]) + self.assertEqual(rows[0]["head_sha"], "a" * 40) + self.assertEqual(rows[0]["url"], "https://github.com/o/r/actions/runs/100") + + def test_pending_states_do_not_reuse_a_completed_conclusion(self): + for status in ("queued", "requested", "waiting", "pending", "in_progress"): + with self.subTest(status=status): + _, rows, _ = self.collect([run("success", status)], [workflow()]) + self.assertEqual((rows[0]["status"], rows[0]["ci_state"]), ("unknown", "pending")) + self.assertIn(status, rows[0]["detail"]) + + def test_authorization_status_is_blocked_without_counting_a_failure(self): + _, rows, _ = self.collect([run("", "action_required")], [workflow()]) + self.assertEqual((rows[0]["status"], rows[0]["ci_state"]), ("blocked", "authorization_pending")) + self.assertIn("review", rows[0]["action"].lower()) + + def test_newest_run_replaces_old_pass_even_if_api_order_changes(self): + old = run(rid=99, date="2026-11-23T10:00:00Z") + new = run("action_required", rid=100) + for runs in ([old, new], [new, old]): + with self.subTest(runs=runs): + _, rows, _ = self.collect(runs, [workflow()]) + self.assertEqual(len(rows), 1) + self.assertEqual(rows[0]["ci_state"], "authorization_pending") + self.assertTrue(rows[0]["url"].endswith("/100")) + + def test_newer_incomplete_runs_replace_an_older_pass(self): + old = run(rid=99, date="2026-11-23T10:00:00Z") + for new, expected in ((run("cancelled"), "cancelled"), (run("", "queued"), "pending")): + with self.subTest(new=new): + _, rows, _ = self.collect([old, new], [workflow()]) + self.assertEqual((rows[0]["status"], rows[0]["ci_state"]), ("unknown", expected)) + self.assertEqual(rows[0]["url"], new["url"]) + + def test_same_time_runs_have_a_deterministic_id_tie_break(self): + _, rows, _ = self.collect([run(rid=99), run("cancelled", rid=100)], [workflow()]) + self.assertEqual(rows[0]["ci_state"], "cancelled") + + def test_workflow_rename_does_not_duplicate_the_run(self): + _, rows, _ = self.collect([run()], [workflow(name="Renamed CI")]) + self.assertEqual(len(rows), 1) + self.assertEqual(rows[0]["name"], "Renamed CI") + self.assertEqual(rows[0]["workflow_id"], 1) + + def test_unrecognized_status_does_not_reuse_success(self): + _, rows, _ = self.collect([run("success", "future_status")], [workflow()]) + self.assertEqual((rows[0]["status"], rows[0]["ci_state"]), ("unknown", "unknown")) + + def test_active_workflow_without_run_has_unknown_trigger_reason(self): + _, rows, _ = self.collect([], [workflow()]) + self.assertEqual((rows[0]["status"], rows[0]["ci_state"]), ("unknown", "not_observed")) + self.assertIn("trigger", rows[0]["action"].lower()) + self.assertEqual(rows[0]["url"], "https://github.com/o/r/actions/workflows/1.yml") + + def test_disabled_workflow_is_explicitly_not_configured(self): + for state in ("disabled_manually", "disabled_inactivity", "disabled_fork", "deleted"): + with self.subTest(state=state): + _, rows, _ = self.collect([], [workflow(state=state)]) + self.assertEqual((rows[0]["status"], rows[0]["ci_state"]), ("missing", "not_configured")) + self.assertIn(state, rows[0]["detail"]) + + def test_disabled_configuration_does_not_hide_a_recorded_failure(self): + _, rows, _ = self.collect([run("failure")], [workflow(state="disabled_manually")]) + self.assertEqual(rows[0]["ci_state"], "failed") + self.assertEqual(rows[0]["configuration_state"], "disabled_manually") + self.assertIn("disabled_manually", rows[0]["detail"]) + + def test_empty_inventory_is_not_a_green_baseline(self): + _, rows, _ = self.collect([], []) + self.assertEqual((rows[0]["status"], rows[0]["ci_state"]), ("missing", "not_configured")) + + def test_unknown_configuration_state_is_never_assumed_disabled(self): + _, rows, _ = self.collect([], [workflow(state="future_state")]) + self.assertEqual((rows[0]["status"], rows[0]["ci_state"]), ("unknown", "unknown")) + + def test_inventory_error_preserves_known_run_and_records_source_error(self): + col, rows, _ = self.collect([run("failure")], None) + self.assertEqual(rows[0]["ci_state"], "failed") + self.assertEqual(next(s for s in col.sources if s["id"] == "github_ci_workflows")["status"], "invalid") + + def test_run_query_error_does_not_claim_skipped_or_missing_configuration(self): + col, rows, _ = self.collect(None, [workflow()]) + self.assertEqual(rows[0]["ci_state"], "source_unavailable") + self.assertEqual(next(s for s in col.sources if s["id"] == "github_ci")["status"], "invalid") + + def test_both_queries_failing_still_explain_the_missing_evidence(self): + _, rows, _ = self.collect(None, None) + self.assertEqual(rows[0]["ci_state"], "source_unavailable") + + def test_names_are_not_workflow_identity(self): + _, rows, _ = self.collect([run(wid=1), run("failure", wid=2)], [workflow(1), workflow(2)]) + self.assertEqual(len({r["id"] for r in rows}), 2) + self.assertEqual({r["ci_state"] for r in rows}, {"passed", "failed"}) + + def test_selected_branch_and_limits_are_explicit(self): + col, _, calls = self.collect([run()], [workflow()], "integration/ci-recovery") + query = next(c for c in calls if c[:2] == ["run", "list"]) + self.assertEqual(query[query.index("--branch") + 1], "integration/ci-recovery") + self.assertIn("--all", query) + inventory = next(c for c in calls if c[:2] == ["workflow", "list"]) + self.assertIn("--all", inventory) + self.assertEqual(col.panels["ci"]["title"], "CI on integration/ci-recovery") + source = next(s for s in col.sources if s["id"] == "github_ci") + self.assertIn("40", source["note"]) + self.assertTrue(all(c[:2] in (["pr", "list"], ["run", "list"], ["workflow", "list"], ["issue", "list"]) + for c in calls)) + + def test_missing_gh_explains_how_to_get_evidence(self): + col = pd.Collector() + with mock.patch.object(pd.shutil, "which", return_value=None): + pd.collect_github(col, "o/r", None) + self.assertIn("install", next(s for s in col.sources if s["id"] == "github")["note"].lower()) + + def test_cli_branch_requires_github(self): + with tempfile.TemporaryDirectory() as out: + result = subprocess.run([sys.executable, "-I", str(ROOT / "tools/progress_dashboard.py"), + "--out", out, "--ci-branch", "integration/ci-recovery"], capture_output=True) + self.assertEqual(result.returncode, 2) + self.assertIn(b"--ci-branch requires --github", result.stderr) + + def test_report_generation_preserves_its_exit_code_and_failure_evidence(self): + def fake_gh(args, timeout=60): + if args[:2] == ["run", "list"]: + return [run("failure")] + if args[:2] == ["workflow", "list"]: + return [workflow()] + return [] + + with tempfile.TemporaryDirectory() as out, contextlib.ExitStack() as stack: + for name in ("collect_unit", "collect_ctest", "collect_gpu", "collect_contract", "collect_imports", "collect_corpus"): + stack.enter_context(mock.patch.object(pd, name)) + stack.enter_context(mock.patch.object(pd, "git_info", return_value={"available": False})) + stack.enter_context(mock.patch.object(pd, "gh_json", side_effect=fake_gh)) + stack.enter_context(mock.patch.object(pd.shutil, "which", return_value="gh")) + with contextlib.redirect_stdout(io.StringIO()): + result = pd.main(["--out", out, "--github", "--ci-branch", "integration/ci-recovery"]) + self.assertEqual(result, 0) # The reporting tool is not a CI gate. + snapshot = json.loads(next(Path(out, "snapshots").glob("*.json")).read_text(encoding="utf-8")) + row = next(c for c in snapshot["components"] if c["panel"] == "ci") + self.assertEqual((row["status"], row["ci_state"]), ("failed", "failed")) + self.assertIn(row["action"], Path(out, "progress.html").read_text(encoding="utf-8")) + + +if __name__ == "__main__": + unittest.main() diff --git a/tools/progress_dashboard.py b/tools/progress_dashboard.py index 9e9d0eb28b..6fb8c27aa9 100644 --- a/tools/progress_dashboard.py +++ b/tools/progress_dashboard.py @@ -19,7 +19,7 @@ imports the measured import tables in docs/runtime_imports.md corpus --work: counts per stage from /shaders/dxbc/index.json and /shaders/spirv/index.json github --github, read-only through `gh`: every pull request into main (merged = implemented, open = - partial), latest CI runs on main, the D3D- table of the D3D12 tracking issue checked against those merges, the + partial), latest CI runs on --ci-branch (default main), the D3D- table of the D3D12 tracking issue checked against those merges, the coordination issue's section sizes and, with --login, that account's claims and pull requests No game data leaves the inputs: the page and the JSON carry counts, pass/fail, error classes and the project's @@ -40,6 +40,7 @@ import time import xml.etree.ElementTree as ET from concurrent.futures import ThreadPoolExecutor +from urllib.parse import quote sys.path.insert(0, os.path.dirname(os.path.abspath(__file__))) from file_mode import published_mode # noqa: E402 @@ -848,11 +849,101 @@ def find_d3d_issue(repo): return None -def collect_github(col, repo, login, d3d_issue=None): +CI_RUN_LIMIT = 40 +CI_WORKFLOW_LIMIT = 1000 + + +def ci_run_result(run): + """Dashboard status, precise CI state and next action; never turn missing evidence into a pass.""" + status, conclusion = run.get("status"), run.get("conclusion") + if status == "action_required" or conclusion == "action_required": + return "blocked", "authorization_pending", "Maintainer: review the external workflow before authorizing it." + if status in ("queued", "requested", "waiting", "pending", "in_progress"): + return "unknown", "pending", "Wait for completion; inspect the run for queue, concurrency or approval blockers." + if status == "completed": + if conclusion == "success": + return "verified", "passed", "Inspect the linked run for its scope; this is not a verdict on all required checks." + if conclusion in ("failure", "timed_out", "startup_failure"): + return "failed", "failed", "Inspect failed jobs and steps in the linked run; preserve the failing gate." + if conclusion == "skipped": + return "unknown", "skipped", "Check workflow/job conditions and prerequisites; skipped is not tested." + if conclusion == "cancelled": + return "unknown", "cancelled", "Check cancellation or a superseding run; rerun only if still needed." + if conclusion == "neutral": + return "unknown", "neutral", "Inspect the run; a neutral result does not establish a passing check." + return "unknown", "unknown", "Inspect the run's status and conclusion; no pass or failure can be inferred." + + +def collect_ci(col, repo, branch): + """Read metadata only. Run history is bounded; absence does not identify a trigger skip.""" + runs = gh_json(["run", "list", "-R", repo, "--branch", branch, "--all", "--limit", str(CI_RUN_LIMIT), + "--json", "workflowDatabaseId,workflowName,conclusion,status,headSha,createdAt,url,databaseId,attempt,event"]) + workflows = gh_json(["workflow", "list", "-R", repo, "--all", "--limit", str(CI_WORKFLOW_LIMIT), + "--json", "id,name,path,state"]) + actions_url = f"https://github.com/{repo}/actions" + latest = {} + # Stable IDs keep renamed workflows together and equally named workflows separate. + for r in sorted(runs or [], key=lambda r: (r.get("createdAt") or "", r["databaseId"]), reverse=True): + latest.setdefault(r["workflowDatabaseId"], r) + inventory = {w["id"]: w for w in workflows or []} + col.source("github_ci", None, "invalid" if runs is None else "ok", len(latest), + note=f"Latest observed run per workflow on {branch}, within {CI_RUN_LIMIT} runs across all events. " + + ("Run query failed: check gh authentication, read access and network." + if runs is None else "Absence does not prove a skip or missing configuration; not a required-check verdict.")) + col.source("github_ci_workflows", None, "invalid" if workflows is None else "ok", len(inventory), + note=("Workflow inventory query failed: check gh authentication, read access and network." + if workflows is None else f"Repository-wide configuration, including disabled workflows; limit {CI_WORKFLOW_LIMIT}." + + (" Limit reached; inventory may be incomplete." if len(workflows) >= CI_WORKFLOW_LIMIT else ""))) + for wid in sorted(set(latest) | set(inventory)): + r, w = latest.get(wid), inventory.get(wid, {}) + configuration = w.get("state") + disabled = configuration in ("disabled_manually", "disabled_inactivity", "disabled_fork", "deleted") + if r: + status, state, action = ci_run_result(r) + what = f"{state}: status={r.get('status') or 'unknown'}, conclusion={r.get('conclusion') or 'unknown'}" + what += f"; associated head {(r.get('headSha') or 'unknown')[:10]}; event={r.get('event') or 'unknown'}" + elif disabled: + status, state = "missing", "not_configured" + what = "not configured for execution" + action = "Maintainer: check whether this workflow should be enabled or restored." + elif runs is None: + status, state = "unknown", "source_unavailable" + what = "run evidence unavailable" + action = "Check gh authentication, read access and network; refresh the report." + elif configuration == "active": + status, state = "unknown", "not_observed" + what = f"no run observed on {branch} in the last {CI_RUN_LIMIT} runs" + action = "Check branch/path/event triggers and a wider run history; do not infer a skip." + else: + status, state = "unknown", "unknown" + what = "workflow configuration is unknown" + action = "Inspect repository Actions settings and workflow metadata." + if configuration: + what += f"; repository configuration={configuration}" + if r and disabled: + action += " Maintainer: also check whether this disabled workflow should be enabled or restored." + workflow_file = (w.get("path") or "").removeprefix(".github/workflows/") + workflow_url = f"{actions_url}/workflows/{quote(workflow_file, safe='')}" if workflow_file else actions_url + r = r or {} + col.add(f"ci.{wid}", "ci", "latest observed run per workflow", w.get("name") or r.get("workflowName") or str(wid), + status, detail=f"{what}. {action}", ci_state=state, action=action, configuration_state=configuration, + workflow_id=wid, workflow_path=w.get("path"), branch=branch, head_sha=r.get("headSha"), + run_id=r.get("databaseId"), run_attempt=r.get("attempt"), event=r.get("event"), + run_status=r.get("status"), conclusion=r.get("conclusion"), at=r.get("createdAt"), url=r.get("url") or workflow_url) + if not latest and not inventory: + unavailable = runs is None or workflows is None + state = "source_unavailable" if unavailable else "not_configured" + action = ("Check gh authentication, read access and network; refresh the report." if unavailable else + "Maintainer: inspect Actions settings and expected workflow files; no workflows were returned.") + col.add("ci.inventory", "ci", "workflow configuration", "CI workflows", "unknown" if unavailable else "missing", + detail=f"{state}. {action}", ci_state=state, action=action, branch=branch, url=actions_url) + + +def collect_github(col, repo, login, d3d_issue=None, ci_branch="main"): col.panel("d3d12", "D3D12 → Vulkan layer items", "D3D- items") - col.panel("ci", "CI on main", "workflows") + col.panel("ci", f"CI on {ci_branch}", "workflows") if not shutil.which("gh"): - col.source("github", None, "missing", note="gh is not installed") + col.source("github", None, "missing", note="gh is not installed; install GitHub CLI to read CI evidence") return {} summary = {"repo": repo} # every pull request into main, so a merge shows up on the next run even before a tracking table is edited @@ -867,27 +958,7 @@ def collect_github(col, repo, login, d3d_issue=None): else: summary["merged_latest"] = collect_pulls(col, repo, merged, open_prs) merged_set, open_set = {p["number"] for p in merged}, {p["number"] for p in open_prs} - runs = gh_json(["run", "list", "-R", repo, "--branch", "main", "--limit", "40", - "--json", "workflowName,conclusion,status,headSha,createdAt,url"]) - if runs is None: - col.source("github_ci", None, "invalid", note="gh run list failed (not logged in?)") - else: - latest, pending = {}, {} - for r in runs: # newest first: the first completed run per workflow decides; a newer one still running is noted - if r["status"] == "completed": - latest.setdefault(r["workflowName"], r) - elif r["workflowName"] not in latest: - pending.setdefault(r["workflowName"], r) - for name in sorted(set(latest) | set(pending)): - r, newer = latest.get(name), pending.get(name) - if r is None: - status, what, r = "unknown", f"no completed run in the last 40; one {newer['status']}", newer - else: - status, what = ("verified" if r["conclusion"] == "success" else "failed"), r["conclusion"] - col.add(f"ci.{name}", "ci", "latest completed run per workflow", name, status, - detail=f"{what} on {r['headSha'][:10]}" + (f"; a newer run is {newer['status']}" if newer and newer is not r else ""), - at=r["createdAt"], url=r.get("url")) - col.source("github_ci", None, "ok", len(latest)) + collect_ci(col, repo, ci_branch) d3d_number = d3d_issue or find_d3d_issue(repo) issue = None if d3d_number is None: @@ -980,7 +1051,7 @@ def build(args, out_dir): collect_contract(col) collect_imports(col) collect_corpus(col, args.work) - gh = collect_github(col, args.repo, args.login, args.d3d_issue) if args.github else {} + gh = collect_github(col, args.repo, args.login, args.d3d_issue, args.ci_branch or "main") if args.github else {} if not args.github: col.source("github", None, "skipped", note="pass --github to read pull requests into main, CI, the D3D12 tracking issue and the " "coordination issue") @@ -1047,11 +1118,16 @@ def main(argv=None): ap.add_argument("--github", action="store_true", help="read pull requests into main, CI runs, the D3D12 tracking issue and the coordination issue " "through gh") ap.add_argument("--repo", default=DEFAULT_REPO, help=f"GitHub repository (default {DEFAULT_REPO})") + ap.add_argument("--ci-branch", help="with --github, CI branch to inspect (default main; PR panels still use main)") ap.add_argument("--d3d-issue", type=int, metavar="N", help=f'with --github, the issue holding the D3D- table (default: the open issue titled ' f'"{D3D_ISSUE_TITLE} ...")') ap.add_argument("--login", help="with --github, show this account's claims and pull requests") args = ap.parse_args(argv) + if args.ci_branch is not None and not args.github: + ap.error("--ci-branch requires --github") + if args.ci_branch is not None and not args.ci_branch.strip(): + ap.error("--ci-branch must not be empty") if args.login is not None and not args.github: ap.error("--login requires --github") if args.d3d_issue is not None and not args.github: