Skip to content

test: trust test modules under Haystack 3.0's deserialization allowlist#3537

Merged
julian-risch merged 2 commits into
mainfrom
test/trusted-modules-allowlist
Jul 3, 2026
Merged

test: trust test modules under Haystack 3.0's deserialization allowlist#3537
julian-risch merged 2 commits into
mainfrom
test/trusted-modules-allowlist

Conversation

@julian-risch

@julian-risch julian-risch commented Jul 2, 2026

Copy link
Copy Markdown
Member

Related Issues

  • Part of deepset-ai/haystack-private#446

Haystack 3.0 introduces a trusted-module allowlist for deserialization: from_dict/Pipeline.loads raise DeserializationError for classes and callables from modules outside haystack*, builtins, typing, and collections. Tests in ten integrations round-trip tools, splitting functions (hanlp), MCP transports, or OAuth token sources defined in the test modules themselves, which are not on that allowlist.

Proposed Changes:

For google_genai, hanlp, huggingface_api, langfuse, llama_cpp, mcp, nvidia, oauth, transformers, watsonx, plus (second commit) aimlapi, cometapi, meta_llama, mistral, openrouter, orcarouter, togetherai — whose test_serde_in_pipeline tests round-trip test-module tool functions through Pipeline.loads and hit the same guard once #3533/#3535 fix their other failures:

  • Add an autouse conftest fixture that sets HAYSTACK_DESERIALIZATION_ALLOWLIST="tests,test_*" — Haystack 3.0's documented opt-in mechanism, read per deserialization call, so monkeypatch.setenv is enough. Haystack 2.x ignores the variable entirely, so nothing changes there.
  • oauth: test_from_dict_unknown_source_type_raises now accepts DeserializationError in addition to ImportError — for an unknown/untrusted module, 3.0 refuses upfront with DeserializationError where 2.x fails at import time. (The guard working as intended for genuinely unknown types.)

How did you test it?

Notes for the reviewer

Checklist

🤖 Generated with Claude Code

Haystack 3.0 refuses to deserialize classes and callables from modules
outside its trusted-module allowlist. Tests that round-trip tools,
splitting functions, transports, or token sources defined in the test
modules now fail with DeserializationError. Add an autouse fixture that
allowlists the test modules via HAYSTACK_DESERIALIZATION_ALLOWLIST
(ignored by 2.x), and let the oauth unknown-source test accept the new
error type.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@github-actions

github-actions Bot commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

Coverage report (nvidia)

This PR does not seem to contain any modification to coverable code.

@github-actions

github-actions Bot commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

Coverage report (oauth)

This PR does not seem to contain any modification to coverable code.

@github-actions

github-actions Bot commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

Coverage report (watsonx)

This PR does not seem to contain any modification to coverable code.

@github-actions

github-actions Bot commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

Coverage report (langfuse)

This PR does not seem to contain any modification to coverable code.

@github-actions

github-actions Bot commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

Coverage report (huggingface_api)

This PR does not seem to contain any modification to coverable code.

@github-actions

github-actions Bot commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

Coverage report (google_genai)

This PR does not seem to contain any modification to coverable code.

@github-actions

github-actions Bot commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

Coverage report (mcp)

This PR does not seem to contain any modification to coverable code.

@github-actions

github-actions Bot commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

Coverage report (hanlp)

This PR does not seem to contain any modification to coverable code.

@github-actions

github-actions Bot commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

Coverage report (transformers)

This PR does not seem to contain any modification to coverable code.

@github-actions

github-actions Bot commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

Coverage report (llama_cpp)

This PR does not seem to contain any modification to coverable code.

Their serde-in-pipeline tests round-trip tools whose functions are
defined in the test modules, so Pipeline.loads hits the Haystack 3.0
trusted-module allowlist once #3533 fixes the dict comparison and #3535
lets the suites collect.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@github-actions

github-actions Bot commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

Coverage report (aimlapi)

This PR does not seem to contain any modification to coverable code.

@github-actions

github-actions Bot commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

Coverage report (orcarouter)

This PR does not seem to contain any modification to coverable code.

@github-actions

github-actions Bot commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

Coverage report (meta_llama)

This PR does not seem to contain any modification to coverable code.

@github-actions

github-actions Bot commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

Coverage report (cometapi)

This PR does not seem to contain any modification to coverable code.

@github-actions

github-actions Bot commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

Coverage report (togetherai)

This PR does not seem to contain any modification to coverable code.

@github-actions

github-actions Bot commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

Coverage report (mistral)

This PR does not seem to contain any modification to coverable code.

@github-actions

github-actions Bot commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

Coverage report (openrouter)

This PR does not seem to contain any modification to coverable code.

@julian-risch julian-risch marked this pull request as ready for review July 2, 2026 15:14
@julian-risch julian-risch requested a review from a team as a code owner July 2, 2026 15:14
@julian-risch julian-risch requested review from sjrl and removed request for a team July 2, 2026 15:14

@sjrl sjrl 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!

@julian-risch julian-risch merged commit 58b85ec into main Jul 3, 2026
126 of 140 checks passed
@julian-risch julian-risch deleted the test/trusted-modules-allowlist branch July 3, 2026 07:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment