From b07bc0643da15f63cad50f3e98eaea307aac9e0c Mon Sep 17 00:00:00 2001 From: Kyle Seaman Date: Fri, 13 Nov 2026 14:55:48 +0000 Subject: [PATCH] ci: install the otlp extra in backend test lanes so wire-level OTLP tests run --- .github/workflows/ci.yml | 4 ++-- .github/workflows/platform-tests.yml | 2 +- docs/ci/ci-and-reviews.md | 2 +- test/conftest.py | 1 + test/conftest_resets.py | 22 ++++++++++++++++++++++ test/metrics/test_otlp_session.py | 5 +++-- test/metrics/test_otlp_wire_e2e.py | 4 ++-- 7 files changed, 32 insertions(+), 8 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 435aa750e127..b6398d5ae8e6 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1205,7 +1205,7 @@ jobs: setup.cfg - name: Install dependencies - run: uv pip install --system -e ".[voice,desktop]" --group dev + run: uv pip install --system -e ".[voice,desktop,otlp]" --group dev # Setup/install stays under the runner identity. Select test scope also # stays there because it writes the runner-owned GITHUB_OUTPUT file. @@ -1504,7 +1504,7 @@ jobs: setup.cfg - name: Install dependencies - run: uv pip install --system -e ".[voice,desktop]" --group dev + run: uv pip install --system -e ".[voice,desktop,otlp]" --group dev - name: Verify Windows test prerequisites if: runner.environment == 'self-hosted' diff --git a/.github/workflows/platform-tests.yml b/.github/workflows/platform-tests.yml index d543940554ac..d04dc54d4ac2 100644 --- a/.github/workflows/platform-tests.yml +++ b/.github/workflows/platform-tests.yml @@ -171,7 +171,7 @@ jobs: enable-cache: false - name: Install dependencies - run: uv pip install --system -e ".[voice,desktop]" --group dev + run: uv pip install --system -e ".[voice,desktop,otlp]" --group dev # The macOS peer-identity check is admission-gating: gatewayd refuses any # connection that is not MATCH, so this canary -- a real transport.serve / diff --git a/docs/ci/ci-and-reviews.md b/docs/ci/ci-and-reviews.md index 90cc9bba7f42..f7fe5143ffb0 100644 --- a/docs/ci/ci-and-reviews.md +++ b/docs/ci/ci-and-reviews.md @@ -709,7 +709,7 @@ yet decided: install from a committed constraints file, or set | `lint-gate` | "Lint Gate". Aggregates `backend-lint` and `frontend-lint` for the heavy jobs (see [Lint first](#lint-first)). Runs when both ended `success` or `skipped`; SKIPPED when either failed or was cancelled, so the lint job is the one red and the heavy jobs skip behind it | | `cancel-superseded-run` | "Cancel Superseded Run". Runs only on a push to `main` (and not on a queue-landed push, like the barrier), beside `await-fast-gate` rather than behind it. It runs the barrier's script as a probe and, only when that proves this commit's Fast Gate run was evicted before it started, makes the workflow's one write: `POST /actions/runs/{run_id}/cancel` on its own run, so the run concludes `cancelled` instead of `failure`. Any other outcome cancels nothing and exits 0, leaving the verdict to the barrier. It is the only job in `ci.yml` with `actions: write`; pull requests and merge groups never start it. Nothing needs it, so it cannot release the matrix, and a cancelled run is never a green one | | `backend-lint` | `isort --check-only`, `flake8`, `mypy` on Python 3.12, plus `scripts/check_black_formatting.py` — black enforced on every file outside `.github/black-baseline.txt`, which can only shrink; on a PR it runs only on the changed `src/` and `test/` Python files (a baseline edit that only deletes entries adds those paths), and an edit to `pyproject.toml` or an added baseline entry forces the whole tree, as does `main-ratchet-audit.yml`. Black here and the four scope-resolving gates in `backend-ratchets` read their diff scope from the one shared resolver in `scripts/ratchet_scope.py`, so they cannot disagree about which lines a change added; the env-base gates (`check_brand_name.py`, `check_harness_parity.py`, `check_focus_cue.py`) share the same diff parsing through its explicit-base entry points while keeping their `*_BASE_REF` base semantics | -| `backend-test` | 8 whole-file shards on Python 3.12, assigned before import, an explicit xdist worker count within each (`-n "$WORKERS"`: one per 2 GiB after 2 GiB for the host, capped at the core count, so 6 on the 15 GiB fleet runner; the memory budget behind `-n auto` reserves 5 GiB a worker for a full-suite collection (it granted a file shard 4 when it reserved 3); the job logs its peak memory); 60-minute job budget on CodeBuild, 70 off the fleet where the shards run four-wide, both including coverage upload, with the 120-second per-test timeout retained. A test still running 30 seconds past its own pytest-timeout has every thread's stack dumped to the log (`scripts/ci_faulthandler_budget.py`, `--faulthandler-grace=30`), so a hang that timeout's `SIGALRM` could not end names its frame. The dump never fires inside a test's budget: faulthandler walks threads without the GIL, and a walk of a thread still running Python can segfault the worker. Large CodeBuild compute with the non-root boundary for eligible actors; hosted fallback | +| `backend-test` | 8 whole-file shards on Python 3.12, assigned before import, an explicit xdist worker count within each (`-n "$WORKERS"`: one per 2 GiB after 2 GiB for the host, capped at the core count, so 6 on the 15 GiB fleet runner; the memory budget behind `-n auto` reserves 5 GiB a worker for a full-suite collection (it granted a file shard 4 when it reserved 3); the job logs its peak memory); 60-minute job budget on CodeBuild, 70 off the fleet where the shards run four-wide, both including coverage upload, with the 120-second per-test timeout retained. A test still running 30 seconds past its own pytest-timeout has every thread's stack dumped to the log (`scripts/ci_faulthandler_budget.py`, `--faulthandler-grace=30`), so a hang that timeout's `SIGALRM` could not end names its frame. The dump never fires inside a test's budget: faulthandler walks threads without the GIL, and a walk of a thread still running Python can segfault the worker. Large CodeBuild compute with the non-root boundary for eligible actors; hosted fallback. Installs the `voice`, `desktop` and `otlp` extras, as `backend-test-windows` and `platform-tests.yml` do, so the `requires_otlp` wire tests run instead of skipping | | `backend-test-windows` | All 8 whole-file shards use large CodeBuild compute for eligible actors, windows-latest otherwise; `--no-cov`, 180s per-test timeout. On a fork pull request it runs only when the `changes` job finds a Windows path (including `.github/actions/setup-windows-tests/**`, `**/*.ps1`, `**/conftest.py` and the platform shims), an added or removed `*.py` line that branches on Windows, the `ci:windows` label or `ci-full-run` (the label takes effect on the next push); main's own CI always runs it. See the migration contract below | | `backend-test-ipv6` | Five native IPv6 cases on hosted Linux and Windows; fail-closed report check, Linux full-run coverage merged with the ordinary shards | | `backend-test-kernel-lock-owner` | Runs the two strict live-holder/orphan flock cases on an uncontainerized hosted VM (the `kirocrew-runners` group here, `ubuntu-latest` in a fork) with `KIROCREW_LOCK_OWNER_STRICT=1`; full-scope coverage is merged with the shard and IPv6 artifacts. **Skipped on a frontend-only diff** (`only_frontend`); Coverage Gate accepts `skipped` in that case | diff --git a/test/conftest.py b/test/conftest.py index 6cf1e75dab76..95a0d70e89f9 100644 --- a/test/conftest.py +++ b/test/conftest.py @@ -286,6 +286,7 @@ def bundled_python_with_user_site(monkeypatch: pytest.MonkeyPatch) -> None: _forget_legacy_auth_sweep_clean_roots, _forget_mount_source_sweep_pacing, _forget_sandbox_launch_mark, + _forget_tracing_switch, _fresh_aws_bin_dir_trust, _fresh_hardlink_spec_warnings, _fresh_reexec_environment, diff --git a/test/conftest_resets.py b/test/conftest_resets.py index 38cb9bce2248..e545607eb5e4 100644 --- a/test/conftest_resets.py +++ b/test/conftest_resets.py @@ -173,6 +173,28 @@ def _drop_live_config_snapshot(): live.reset_for_tests() +@pytest.fixture(autouse=True) +def _forget_tracing_switch(): + """Give every test an unread tracing switch. + + ``kiro_crew.tracing.provider`` resolves the switch once and serves the cached + answer until ``reset_for_testing()``. A test that boots the gateway services + (``service_boot`` calls ``watch_config``, which resolves it) leaves "off" cached, + so a later test on the same worker that writes its own config is told tracing + is off and exports nothing, with no log line. Measured: ``test_slack_gateway.py``'s + ``test_init_services_creates_all`` followed by ``test_tracing_otlp.py``'s + ``test_a_traced_turn_reaches_a_loopback_receiver_with_its_vault_header``. + + Reset at setup, not teardown, so ``_no_leaked_telemetry_exporter`` still sees + (and reports) an exporter thread a test left running. A test that never + imported the module pays one dict lookup. + """ + provider = sys.modules.get("kiro_crew.tracing.provider") + if provider is not None: + provider.reset_for_testing() + yield + + @pytest.fixture(autouse=True) def _reset_env_boot_record_and_ownership(): """Give every test an empty boot ``.env`` record and ``.env`` ownership set. diff --git a/test/metrics/test_otlp_session.py b/test/metrics/test_otlp_session.py index 83381985f457..9dc3d6f84949 100644 --- a/test/metrics/test_otlp_session.py +++ b/test/metrics/test_otlp_session.py @@ -1,8 +1,9 @@ """``metrics.otlp_session`` without the optional ``otlp`` extra. The loopback tests in ``test_otlp_no_redirect.py`` drive the real exporter and -skip when the extra is absent, as it is in CI. These cover every branch of the -session choice with the SDK module stubbed, so they always run. +skip when the extra is absent, as it is in a default dev install (CI's backend +test lanes install it). These cover every branch of the session choice with the +SDK module stubbed, so they run either way. """ from __future__ import annotations diff --git a/test/metrics/test_otlp_wire_e2e.py b/test/metrics/test_otlp_wire_e2e.py index 6debc30ce369..6dbf33b25ab3 100644 --- a/test/metrics/test_otlp_wire_e2e.py +++ b/test/metrics/test_otlp_wire_e2e.py @@ -13,8 +13,8 @@ what an exporter actually received. Two tiers, because the OTLP exporter is an optional extra -(``pip install "kirocrew[otlp]"``) that a default dev/CI environment does not -have: +(``pip install "kirocrew[otlp]"``) that a default dev environment does not have +(CI's backend test lanes install it): * **Tier 1 — serialization (always runs).** The live build's own JSONL exporter writes real records to disk. Asserts the full instrument roster arrives, that