Skip to content

fix: improve Document compatibility/validation layer#12016

Merged
anakin87 merged 3 commits into
mainfrom
simplify-document
Jul 15, 2026
Merged

fix: improve Document compatibility/validation layer#12016
anakin87 merged 3 commits into
mainfrom
simplify-document

Conversation

@anakin87

@anakin87 anakin87 commented Jul 15, 2026

Copy link
Copy Markdown
Member

Related Issues

I was investigating whether we could simplify/drop some compatibility parts of Haystack Document in 3.0. I decided against this, but I found some bugs:

  • we were only checking keyword arguments for 1.x embedding conversion and for content validation
  • content type validation was also skipped when the value was falsy, such as 0.

Proposed Changes:

  • fix bugs
  • now the metaclass just drops legacy fields; validation and conversion are handled in __post_init__ that has better access to populated fields

How did you test it?

CI, new tests

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 15, 2026

Copy link
Copy Markdown

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

Project Deployment Actions Updated (UTC)
haystack-docs Ready Ready Preview, Comment Jul 15, 2026 3:37pm

Request Review

@github-actions github-actions Bot added topic:tests type:documentation Improvements on the docs labels Jul 15, 2026
@github-actions

github-actions Bot commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

Coverage report

Click to see where and how coverage changed

FileStatementsMissingCoverageCoverage
(new stmts)
Lines missing
  haystack/components/rankers
  lost_in_the_middle.py
  haystack/core/pipeline
  pipeline.py
  haystack/dataclasses
  document.py
Project Total  

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

@anakin87 anakin87 self-assigned this Jul 15, 2026
@anakin87 anakin87 marked this pull request as ready for review July 15, 2026 11:45
@anakin87 anakin87 requested a review from a team as a code owner July 15, 2026 11:45
@anakin87 anakin87 requested review from davidsbatista and removed request for a team July 15, 2026 11:45

@davidsbatista davidsbatista left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

looks good!

@anakin87 anakin87 force-pushed the simplify-document branch from 276cd62 to 200224b Compare July 15, 2026 15:34
@anakin87 anakin87 enabled auto-merge (squash) July 15, 2026 15:36
@anakin87 anakin87 merged commit bfb7a28 into main Jul 15, 2026
24 of 25 checks passed
@anakin87 anakin87 deleted the simplify-document branch July 15, 2026 15:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

topic:tests type:documentation Improvements on the docs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants