Skip to content

test: follow observation cursors past empty pages - #2099

Merged
hassiebp merged 2 commits into
langfuse:mainfrom
DavidTraina:test/observations-empty-page-helpers
Nov 5, 2026
Merged

hassiebp merged 2 commits into
langfuse:mainfrom
DavidTraina:test/observations-empty-page-helpers

Conversation

@DavidTraina

@DavidTraina DavidTraina commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor

What does this PR do?

Updates test code that relied on the old observations v2 pagination rules (see langfuse/langfuse#19043).

get_observations helper (tests/support/utils.py)

  • It stopped on an empty page. The API can now return one while meta.cursor is set.
  • It now stops only when the cursor is absent.
  • The existing unit test adds an empty middle page; it fails on main.

Two e2e tests (test_get_observations_for_unknown_trace_is_empty, test_get_observations_empty)

  • They asserted cursor is None for a no-match query with no time bound. That only holds if the server scans back to 2020-01-01 within its 45 s budget, so it depends on how much data the server holds.
  • They now pass from_start_time one day back. That fits inside the server's first 7-day scan window, so a completed request reliably returns no cursor.

CI passes today because its database is small. These changes keep the tests correct on servers with more history. Test-only change.

Related PRs

Independent follow-ups to langfuse/langfuse#19043, mergeable in any order: #2097 (batch evaluation stops on empty pages), #2096 (batch evaluation fetch timeout), #2098 (docs), #2101 (pagination helper).

Type of change

  • Bug fix
  • New feature
  • Breaking change
  • Refactor
  • Documentation update
  • Tooling, CI, or repo maintenance

Verification

List the main commands you ran:

uv run --frozen ruff check .                                  # All checks passed!
uv run --frozen ruff format --check .                         # 593 files already formatted
uv run --frozen mypy langfuse --no-error-summary              # no issues
uv run --frozen pytest -n auto --dist worksteal tests/unit    # 1003 passed, 2 skipped
# The updated test fails on main: ['obs-0', 'obs-2'] == ['obs-0', 'obs-1', 'obs-2']
uv run --frozen pytest tests/unit/test_e2e_support.py::test_get_observations_follows_cursor_past_empty_pages_and_sorts

I did not run the e2e tests locally; they need a Langfuse server.

Checklist

  • I self-reviewed the diff using code_review.md.
  • I added or updated tests for behavior changes.
  • I updated docs, examples, or .env.template if needed.
  • I did not hand-edit generated files; if generated files changed, I used the upstream regeneration path.
  • I did not commit secrets or credentials.

RetriggerView in GreptileConfidence Score: 5/5

This test-only change appears safe to merge.

Summary

Updates observation tests for pages that can be empty while still carrying a cursor.

  • The test helper follows observation cursors past empty pages.
  • No-match observation checks search only the past day.

No actionable issues found. Tests were not run during this review.

Reviews (1) · Last reviewed commit: "test: follow observation cursors past em..." · Reviewed by Greptile

The e2e helper get_observations stopped on an empty page, which the
observations v2 API can now return while meta.cursor is set. Two e2e tests
also asserted no cursor for unbounded no-match queries, which depends on
how fast the server scans back to 2020-01-01; bound them to the last day so
the server covers the range in one scan window.

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Claude Code Review

This pull request is from a fork — automated review is disabled. A repository maintainer can comment @claude review to run a one-time review.

@CLAassistant

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you all sign our Contributor License Agreement before we can accept your contribution.
1 out of 2 committers have signed the CLA.

✅ DavidTraina
❌ hassiebp
You have signed the CLA already but the status is still pending? Let us recheck it.

@hassiebp
hassiebp merged commit 8faf84d into langfuse:main Nov 5, 2026
1 of 3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants