Skip to content

chore: consolidate serialize outputs to state string functions - #11898

Closed
davidsbatista wants to merge 3 commits into
mainfrom
chore/consolidate-_serialize_outputs_to_state-string-functions
Closed

chore: consolidate serialize outputs to state string functions#11898
davidsbatista wants to merge 3 commits into
mainfrom
chore/consolidate-_serialize_outputs_to_state-string-functions

Conversation

@davidsbatista

Copy link
Copy Markdown
Contributor

Related Issues

Proposed Changes:

  • 4 functions in tools/tool.py had the same small loop copy-pasted: copy a config dict, and if it has a handler, convert it with serialize_callable/deserialize_callable.
  • Pulled that loop out into two small shared helpers (_convert_handler, _convert_handler_in_configs), and had all 4 functions call them instead.
  • The logic difference between the two config types stays where it was.

How did you test it?

  • Added test_serialize_outputs_to_state/test_deserialize_outputs_to_state first (they had no dedicated unit tests before, only indirect coverage via Tool.to_dict/from_dict round-trips), confirmed they pass against the old implementation, then refactored.

Checklist

  • I have read the contributors guidelines and the code of conduct.
  • I have updated the related issue with new insights and changes.
  • I have added unit tests and updated the docstrings.
  • I've used one of the conventional commit types for my PR title: fix:, feat:, build:, chore:, ci:, docs:, style:, refactor:, perf:, test: and added ! in case the PR includes breaking changes.
  • I have documented my code.
  • I have added a release note file, following the contributors guidelines.
  • I have run pre-commit hooks and fixed any issue.

@vercel

vercel Bot commented Jul 7, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
haystack-docs Ignored Ignored Jul 7, 2026 1:39pm

Request Review

@github-actions github-actions Bot added topic:tests type:documentation Improvements on the docs labels Jul 7, 2026
@davidsbatista davidsbatista added the ignore-for-release-notes PRs with this flag won't be included in the release notes. label Jul 7, 2026
@github-actions

github-actions Bot commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

Coverage report

Click to see where and how coverage changed

FileStatementsMissingCoverageCoverage
(new stmts)
Lines missing
  haystack/tools
  tool.py
Project Total  

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

@davidsbatista
davidsbatista marked this pull request as ready for review July 7, 2026 14:10
@davidsbatista
davidsbatista requested a review from a team as a code owner July 7, 2026 14:10
@davidsbatista
davidsbatista requested review from anakin87 and removed request for a team July 7, 2026 14:10
@claude

claude Bot commented Jul 7, 2026

Copy link
Copy Markdown

Code review

No issues found. Checked for bugs and CLAUDE.md compliance.

@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.

To avoid duplicate work or fixing stuff that has been removed, I suggest targeting v3 branch (not main).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ignore-for-release-notes PRs with this flag won't be included in the release notes. topic:tests type:documentation Improvements on the docs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants