Skip to content

fix: raise DeserializationError for unimportable classes#11890

Merged
davidsbatista merged 3 commits into
mainfrom
fix/deserialize-value-import-error
Jul 7, 2026
Merged

fix: raise DeserializationError for unimportable classes#11890
davidsbatista merged 3 commits into
mainfrom
fix/deserialize-value-import-error

Conversation

@davidsbatista

@davidsbatista davidsbatista commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

Proposed Changes:

_deserialize_value raised a raw ImportError when a serialized snapshot referenced a class that no longer exists. Now it raises DeserializationError, consistent with the rest of the function.

How did you test it?

  • Added test_deserialize_value_with_schema_class_not_importable.

Notes for the reviewer

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 6, 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 Preview Jul 6, 2026 4:41pm

Request Review

@github-actions

github-actions Bot commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

Coverage report

Click to see where and how coverage changed

FileStatementsMissingCoverageCoverage
(new stmts)
Lines missing
  haystack/utils
  base_serialization.py
Project Total  

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

@davidsbatista davidsbatista changed the title adding try/catch to import_class_by_name to show incorreted imported … fix: raise DeserializationError for unimportable classes Jul 6, 2026
@davidsbatista davidsbatista marked this pull request as ready for review July 6, 2026 16:14
@davidsbatista davidsbatista requested a review from a team as a code owner July 6, 2026 16:14
@davidsbatista davidsbatista requested review from julian-risch and removed request for a team July 6, 2026 16:14
@claude

claude Bot commented Jul 6, 2026

Copy link
Copy Markdown

Code review

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

1 similar comment
@claude

claude Bot commented Jul 6, 2026

Copy link
Copy Markdown

Code review

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

… prefix

import_class_by_name raises ValueError (not ImportError) when the type
name has no dot to split on, so a corrupted snapshot with a dotless type
name would still escape as a raw ValueError.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@davidsbatista davidsbatista merged commit da17b3e into main Jul 7, 2026
36 of 38 checks passed
@davidsbatista davidsbatista deleted the fix/deserialize-value-import-error branch July 7, 2026 07:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants