Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

chore(tests): keep document embedding fixtures within query bounds (#130722)

Paul D'Ambra1af4fdeabe63
diff --git a/posthog/hogql_queries/test/test_document_embeddings_query_runner.py b/posthog/hogql_queries/test/test_document_embeddings_query_runner.py
index 97ffb81c7987..039b5284146a 100644
--- a/posthog/hogql_queries/test/test_document_embeddings_query_runner.py
+++ b/posthog/hogql_queries/test/test_document_embeddings_query_runner.py
@@ -32,8 +32,8 @@ def build_document_similarity_query(
limit: int | None = None,
offset: int | None = None,
) -> DocumentSimilarityQuery:
- date_from = (origin.timestamp - timedelta(days=1)).date().isoformat()
- date_to = (origin.timestamp + timedelta(days=1)).date().isoformat()
+ date_from = (origin.timestamp - timedelta(days=1)).isoformat()
+ date_to = (origin.timestamp + timedelta(days=1)).isoformat()
return DocumentSimilarityQuery(
kind="DocumentSimilarityQuery",
@@ -54,7 +54,9 @@ def build_document_similarity_query(
class TestDocumentEmbeddingsQueryRunner(ClickhouseTestMixin, APIBaseTest):
# Must track real now(): the tables carry a 3-month real-clock TTL on timestamp, so a fixed past date seeds already-expired rows.
- base_timestamp = datetime.now(tz=ZoneInfo("UTC")) - timedelta(hours=1)
+ base_timestamp = datetime.now(tz=ZoneInfo("UTC")).replace(hour=23, minute=57, second=0, microsecond=0) - timedelta(
+ days=1
+ )
product_documents = (
("product_a", "document_a", "doc_product_a"),
("product_b", "document_b", "doc_product_b"),