Skip to content

fix(langfuse): stop relying on haystack.utils.base_serialization helpers#3563

Merged
davidsbatista merged 6 commits into
mainfrom
fix/langfuse-avoid-removed-serialization-helpers
Jul 8, 2026
Merged

fix(langfuse): stop relying on haystack.utils.base_serialization helpers#3563
davidsbatista merged 6 commits into
mainfrom
fix/langfuse-avoid-removed-serialization-helpers

Conversation

@davidsbatista

@davidsbatista davidsbatista commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

Related Issues

Proposed Changes:

  • serialize_class_instance/deserialize_class_instance in haystack.utils.base_serialization are being removed from haystack-ai as dead code (see chore!: removing deadcode haystack#11905).

  • to_dict: serialize span_handler with component_to_dict (from haystack.core.serialization) instead of serialize_class_instance.

  • from_dict: deserialize span_handler with deserialize_component_inplace (from haystack.utils) instead of deserialize_class_instance

How did you test it?

  • Updated test_langfuse_connector.py fixtures to match the new (flatter) span_handler serialization format.
  • Ran the full unit test suite, ruff, and mypy for the langfuse integration.

Checklist

@github-actions github-actions Bot added integration:langfuse type:documentation Improvements or additions to documentation labels Jul 8, 2026
@github-actions

github-actions Bot commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

Coverage report (langfuse)

Click to see where and how coverage changed

FileStatementsMissingCoverageCoverage
(new stmts)
Lines missing
  integrations/langfuse/src/haystack_integrations/components/connectors/langfuse
  langfuse_connector.py
Project Total  

This report was generated by python-coverage-comment-action

@davidsbatista davidsbatista changed the title fix(langfuse): stop relying on haystack.utils.base_serialization helpers fix(langfuse): stop relying on haystack.utils.base_serialization helpers Jul 8, 2026
@davidsbatista davidsbatista marked this pull request as ready for review July 8, 2026 12:08
@davidsbatista davidsbatista requested a review from a team as a code owner July 8, 2026 12:08
@davidsbatista davidsbatista requested review from anakin87 and removed request for a team July 8, 2026 12:08
Comment on lines -202 to +199
"data": {
"type": "tests.test_langfuse_connector.CustomSpanHandler",
"init_parameters": {},
},
"init_parameters": {},

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Would it be possible to keep the old serialization format working (handling this in from_dict)? Otherwise, this would break serialized pipelines

@davidsbatista davidsbatista Jul 8, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

What do you mean by the "old serialization format working"? Using the

def serialize_class_instance(obj: Any) -> dict[str, Any]:

The purpose of the PR is to avoid using that.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

or wait, you mean still being able to deserialise old formats?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I mean: if a user has a serialized Pipeline with LangfuseConnector and langfuse-haystack==5.0.2, the new from_dict method would not be able to load it.

So, to ease the transition, we could modify the from_dict method so it does not break deserialization and add a test covering this case.

@davidsbatista davidsbatista requested a review from anakin87 July 8, 2026 13:05

@anakin87 anakin87 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thank you!

Please release 5.1.0 after merging

@davidsbatista davidsbatista merged commit 05f741b into main Jul 8, 2026
16 checks passed
@davidsbatista davidsbatista deleted the fix/langfuse-avoid-removed-serialization-helpers branch July 8, 2026 13:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

integration:langfuse type:documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants