From 4290111333aeb15a696c2060d75ecce8ee4a53fd Mon Sep 17 00:00:00 2001 From: Yiorgis Gozadinos Date: Fri, 4 Sep 2026 12:19:54 +0300 Subject: [PATCH] Stop tests from sending telemetry to logfire telemetry.configure() passes send_to_logfire="if-token-present", so on a machine with a logfire token the CLI tests configured a live exporter: spans and the periodic metrics export went to the developer's project, and where the export fired while a cassette was open, VCR rejected it with CannotOverwriteExistingCassetteException in record mode none. A token resolves from LOGFIRE_TOKEN or from logfire_credentials.json under LOGFIRE_CREDENTIALS_DIR (default .logfire, relative to the working directory), so an authenticated developer uploads with the variable unset. conftest drops the variable and points credentials discovery at an empty temporary directory, alongside the existing HAIKU_RAG_CONFIG_PATH setup and before any haiku.rag import. The explicit send_to_logfire argument beats LOGFIRE_SEND_TO_LOGFIRE, so denying the token is what disables the exporter. --- tests/conftest.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tests/conftest.py b/tests/conftest.py index 0b35d944..359bb013 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -21,6 +21,12 @@ embeddings: """) os.environ["HAIKU_RAG_CONFIG_PATH"] = str(_test_config_path) +# telemetry.configure() passes send_to_logfire="if-token-present" explicitly, +# which beats LOGFIRE_SEND_TO_LOGFIRE, so no token must resolve: drop the +# environment variable and point credentials discovery at an empty directory. +os.environ.pop("LOGFIRE_TOKEN", None) +os.environ["LOGFIRE_CREDENTIALS_DIR"] = tempfile.mkdtemp() + import pydantic_ai.models # noqa: E402 import pytest # noqa: E402 import yaml # noqa: E402