Skip to content

test(instrument): tier-2 test port for langfuse (port-as-is)#147

Closed
mmercuri wants to merge 1 commit into
feat/instrument-frameworks-langfuse-closurefrom
feat/instrument-tier2-tests-langfuse
Closed

test(instrument): tier-2 test port for langfuse (port-as-is)#147
mmercuri wants to merge 1 commit into
feat/instrument-frameworks-langfuse-closurefrom
feat/instrument-tier2-tests-langfuse

Conversation

@mmercuri

Copy link
Copy Markdown
Contributor

Summary

Ports the deeper Langfuse adapter test suite from ateam as-is. The Langfuse adapter is a batch importer/exporter (not a runtime instrumentation adapter), so tests focus on lifecycle, sync semantics, and the REPLAY surface — NOT streaming.

Source: `A:/github/layerlens/ateam/tests/adapters/langfuse/test_lifecycle.py` (232 LOC)
Target: `tests/instrument/adapters/frameworks/langfuse/test_lifecycle.py`
Owning PR: #110 (`feat/instrument-frameworks-langfuse-closure`)

What was ported

22 tests covering:

  • Adapter initialization, FRAMEWORK/VERSION constants
  • `has_stratix` / `is_connected` flags with and without a STRATIX instance
  • `connect()` without config — adapter is usable standalone, status HEALTHY
  • `connect()` with config — creates LangfuseAPIClient, runs health check
  • `connect()` with failed health check — status DEGRADED
  • `connect(config=cfg)` direct-arg path
  • `disconnect()` clears client/importer/exporter/sync references
  • `health_check()` no-config branch ("No Langfuse config" message)
  • `health_check()` connected branch ("reachable" message)
  • `get_adapter_info()` capabilities (TRACE_TOOLS, TRACE_MODELS, REPLAY)
  • `serialize_for_replay()` — REPLAY surface returns ReplayableTrace with sync_state metadata
  • `get_status()` — both empty and configured (host, mode, langfuse_healthy)
  • `import_traces()` / `export_traces()` / `sync()` — error semantics when not connected
  • `sync_state` and `config` properties

Adjustments (port-as-is — minimal only)

  • `from stratix.sdk.python.adapters.base` → `from layerlens.instrument.adapters._base`
  • `from stratix.sdk.python.adapters.langfuse.config` → `from layerlens.instrument.adapters.frameworks.langfuse.config`
  • `from stratix.sdk.python.adapters.langfuse.lifecycle` → `from layerlens.instrument.adapters.frameworks.langfuse.lifecycle`
  • `@patch("stratix.sdk.python.adapters.langfuse.lifecycle.LangfuseAPIClient")` → `@patch("layerlens.instrument.adapters.frameworks.langfuse.lifecycle.LangfuseAPIClient")`

No test bodies, assertions, or semantics were changed. `MockStratix` retained verbatim. No `org_id` kwarg added (PR #118 still draft — base adapter does not yet accept it).

Honest scope (CLAUDE.md item 11)

  • All 22 source tests ported. Zero skipped. Zero rewritten.
  • No streaming assertions added — Langfuse has no streaming entry point and PR feat(instrument): Langfuse adapter closure — sample + doc + LayerLens alias (lifecycle_preview → mature) #110 honestly excludes STREAMING from its capability declaration. REPLAY surface IS asserted via `test_serialize_for_replay` and `test_serialize_includes_sync_state`.
  • Coexists with the existing `tests/instrument/adapters/frameworks/test_langfuse_adapter.py` (12 tests, different stylistic shape) on the closure branch — both files pass together (34/34).

Test plan

  • `uv run python -m pytest tests/instrument/adapters/frameworks/langfuse/ -x` — 22/22 pass
  • Co-run with existing closure-branch test file — 34/34 pass, no regression
  • CI green on PR

@mmercuri mmercuri requested a review from m-peko May 10, 2026 16:31
@m-peko m-peko closed this May 21, 2026
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.

2 participants