From b23c38897e7cf36a10dc285357b4d5d9bf3fc52e Mon Sep 17 00:00:00 2001 From: Codex Date: Tue, 3 Nov 2026 21:50:22 -0300 Subject: [PATCH 1/2] fix(ci): verify query contracts against the installed wheel --- .github/workflows/ci.yml | 21 +++++++++++++++++++ scripts/check_query_wheel.py | 40 ++++++++++++++++++++++++++++++++++++ 2 files changed, 61 insertions(+) create mode 100644 scripts/check_query_wheel.py diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 97ee1f7..059994b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -10,6 +10,27 @@ env: UV_PYTHON: "3.11" jobs: + query-wheel: + name: Query contracts (installed wheel) + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: astral-sh/setup-uv@v4 + with: + version: "latest" + - run: uv python install 3.11 + - name: Build and install the candidate wheel + run: | + uv build --wheel --out-dir "$RUNNER_TEMP/query-wheel-dist" + sha256sum "$RUNNER_TEMP"/query-wheel-dist/*.whl + uv venv --python 3.11 "$RUNNER_TEMP/query-wheel-env" + wheel=("$RUNNER_TEMP"/query-wheel-dist/*.whl) + test "${#wheel[@]}" -eq 1 + uv pip install --python "$RUNNER_TEMP/query-wheel-env/bin/python" "${wheel[0]}[dev]" + - name: Verify query contracts outside the source package + run: | + "$RUNNER_TEMP/query-wheel-env/bin/python" -I scripts/check_query_wheel.py + lint: name: Lint runs-on: ubuntu-latest diff --git a/scripts/check_query_wheel.py b/scripts/check_query_wheel.py new file mode 100644 index 0000000..e2d7c8d --- /dev/null +++ b/scripts/check_query_wheel.py @@ -0,0 +1,40 @@ +"""Run existing query contracts against the wheel installed in this environment.""" + +import sys +from importlib.metadata import version +from pathlib import Path + +import pytest + +import arc_client + +repo = Path(__file__).resolve().parents[1] +package = Path(arc_client.__file__).resolve().parent +assert repo not in package.parents, f"Imported checkout instead of wheel: {package}" +assert Path(sys.prefix).resolve() in package.parents, f"Package outside environment: {package}" +print(f"arc-tsdb-client {version('arc-tsdb-client')}: {package}", flush=True) + + +def check_imports(): + for name, module in tuple(sys.modules.items()): + if name == "arc_client" or name.startswith("arc_client."): + origin = Path(module.__file__).resolve() + assert package in origin.parents, f"Source import during wheel tests: {name}: {origin}" + + +check_imports() +contracts = repo / "tests/unit/http" +tests = [ + "test_query_metadata_contracts.py::test_query_metadata_sync", + "test_query_metadata_contracts.py::test_query_metadata_async", + "test_arrow_metadata.py::test_capped_native_arrow_and_schema_metadata", + "test_arrow_metadata.py::test_invalid_or_failed_arrow_never_returns_table", + "test_arrow_metadata.py::test_legacy_without_metadata_does_not_guess_cap", + "test_arrow_metadata.py::test_unobservable_announced_metadata_fails_closed", + "test_arrow_metadata.py::test_main_omitted_cap_with_execution_marker_is_uncapped", +] +result = pytest.main( + ["--import-mode=importlib", "-o", "addopts=", "-v", *[str(contracts / test) for test in tests]] +) +check_imports() +sys.exit(result) From 0679577b35246e20982c224b41b16cb5191f194f Mon Sep 17 00:00:00 2001 From: Ignacio Van Droogenbroeck <64545348+xe-nvdk@users.noreply.github.com> Date: Thu, 5 Nov 2026 09:06:23 -0600 Subject: [PATCH 2/2] ci: run the whole unit suite against the installed wheel The job ran 7 named query tests (2 of the files' 22). With the same isolation it now runs all of tests/unit against the built wheel, so a module or data file the wheel leaves out fails CI whichever feature it belongs to, not only the query path. The wheel is installed with [dev,all] so the pandas and polars tests run instead of skipping. The source-import guards are unchanged. Locally: 1121 passed against the wheel, and deleting arc_client/management/diagnostics.py from the installed package fails the job at collection (exit 2). Renamed the script to scripts/check_wheel.py and the job to "Unit tests (installed wheel)" to match. --- .github/workflows/ci.yml | 18 +++++++++--------- .../{check_query_wheel.py => check_wheel.py} | 19 +++++-------------- 2 files changed, 14 insertions(+), 23 deletions(-) rename scripts/{check_query_wheel.py => check_wheel.py} (50%) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 059994b..df08a5c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -10,8 +10,8 @@ env: UV_PYTHON: "3.11" jobs: - query-wheel: - name: Query contracts (installed wheel) + wheel: + name: Unit tests (installed wheel) runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 @@ -21,15 +21,15 @@ jobs: - run: uv python install 3.11 - name: Build and install the candidate wheel run: | - uv build --wheel --out-dir "$RUNNER_TEMP/query-wheel-dist" - sha256sum "$RUNNER_TEMP"/query-wheel-dist/*.whl - uv venv --python 3.11 "$RUNNER_TEMP/query-wheel-env" - wheel=("$RUNNER_TEMP"/query-wheel-dist/*.whl) + uv build --wheel --out-dir "$RUNNER_TEMP/wheel-dist" + sha256sum "$RUNNER_TEMP"/wheel-dist/*.whl + uv venv --python 3.11 "$RUNNER_TEMP/wheel-env" + wheel=("$RUNNER_TEMP"/wheel-dist/*.whl) test "${#wheel[@]}" -eq 1 - uv pip install --python "$RUNNER_TEMP/query-wheel-env/bin/python" "${wheel[0]}[dev]" - - name: Verify query contracts outside the source package + uv pip install --python "$RUNNER_TEMP/wheel-env/bin/python" "${wheel[0]}[dev,all]" + - name: Run the unit suite against the installed wheel run: | - "$RUNNER_TEMP/query-wheel-env/bin/python" -I scripts/check_query_wheel.py + "$RUNNER_TEMP/wheel-env/bin/python" -I scripts/check_wheel.py lint: name: Lint diff --git a/scripts/check_query_wheel.py b/scripts/check_wheel.py similarity index 50% rename from scripts/check_query_wheel.py rename to scripts/check_wheel.py index e2d7c8d..e28ca38 100644 --- a/scripts/check_query_wheel.py +++ b/scripts/check_wheel.py @@ -1,4 +1,4 @@ -"""Run existing query contracts against the wheel installed in this environment.""" +"""Run the unit suite against the wheel installed in this environment, not the checkout.""" import sys from importlib.metadata import version @@ -23,18 +23,9 @@ def check_imports(): check_imports() -contracts = repo / "tests/unit/http" -tests = [ - "test_query_metadata_contracts.py::test_query_metadata_sync", - "test_query_metadata_contracts.py::test_query_metadata_async", - "test_arrow_metadata.py::test_capped_native_arrow_and_schema_metadata", - "test_arrow_metadata.py::test_invalid_or_failed_arrow_never_returns_table", - "test_arrow_metadata.py::test_legacy_without_metadata_does_not_guess_cap", - "test_arrow_metadata.py::test_unobservable_announced_metadata_fails_closed", - "test_arrow_metadata.py::test_main_omitted_cap_with_execution_marker_is_uncapped", -] -result = pytest.main( - ["--import-mode=importlib", "-o", "addopts=", "-v", *[str(contracts / test) for test in tests]] -) +# The whole unit suite, so a module or data file the wheel leaves out fails +# here whichever feature it belongs to. Install with [dev,all]: without pandas +# and polars their tests skip instead of running. +result = pytest.main(["--import-mode=importlib", "-o", "addopts=", "-q", str(repo / "tests/unit")]) check_imports() sys.exit(result)