From 732afaead6754864eb74435279e41e1bddd69ee5 Mon Sep 17 00:00:00 2001 From: arpan Date: Sat, 12 Sep 2026 06:24:18 +0530 Subject: [PATCH] The docs job installs the postgres extra, so it counts the suite check runs The readiness block in ctrlrun-docs records what `pytest --collect-only` finds across both checkouts, and the audit fails when a checkout collects fewer tests than the block claims. The docs job installed every extra but `postgres`, and 76 tests exist only when psycopg is importable: 3,461 collected without it against 3,537 with, on the same tree. So the audit has been comparing a block generated with the full suite against a job that could never see all of it, and reporting the block as stale when it was right. The job now installs the same extras as `check`, and a repository-signals test reads both install lines and holds them equal. Signed-off-by: arpan --- .github/workflows/ci.yml | 7 +++++-- tests/test_repository_signals.py | 17 +++++++++++++++++ 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ed7a3fd..ca923fa 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -293,10 +293,13 @@ jobs: - name: Install # Every extra: a runnable guide block that exports to OpenTelemetry or opens the # gateway's client needs the extra installed, and a block that skipped would be a - # sample nobody ran. + # sample nobody ran. `postgres` too, and for a different reason: the readiness block + # records what `pytest --collect-only` finds, and 76 of the tests exist only when + # psycopg is importable. The same extras as `check`, so this job counts the suite + # that job runs; `test_the_docs_job_installs_the_extras_the_check_job_runs` holds it. run: | python -m pip install --upgrade pip - pip install -e "./ctrlrun[dev,gateway,otel,identity]" + pip install -e "./ctrlrun[dev,gateway,otel,identity,postgres]" pip install griffe pyyaml # `_core.py` raises when it cannot find the library, so this prints a path or the job diff --git a/tests/test_repository_signals.py b/tests/test_repository_signals.py index 8cb174f..2170705 100644 --- a/tests/test_repository_signals.py +++ b/tests/test_repository_signals.py @@ -165,6 +165,23 @@ def test_codeql_does_not_gate_a_merge(): assert "Nothing here gates a merge" in workflow +def test_the_docs_job_installs_the_extras_the_check_job_runs(): + """The readiness block records what `pytest --collect-only` finds, and the Postgres tests + are collected only when psycopg is importable. A `docs` job installed with fewer extras + than `check` counts a smaller suite than the one that ran, and fails the audit against a + number that was right.""" + workflow = _workflow("ci.yml") + + def extras(job: str) -> set[str]: + for step in workflow["jobs"][job]["steps"]: + match = re.search(r'pip install -e "\.?/?(?:ctrlrun)?\[([^]]+)\]"', step.get("run", "")) + if match: + return set(match.group(1).split(",")) + raise AssertionError(f"no editable install in the {job} job") + + assert extras("docs") == extras("check") + + # --- community files -----------------------------------------------------------------------