Repository navigation
Retain session protection across document-store clients - #909
Merged
Merged
Conversation
zlareb1
marked this pull request as ready for review
November 18, 2026 20:17
Signed-off-by: zlareb1 <[email protected]>
Signed-off-by: zlareb1 <[email protected]>
Signed-off-by: zlareb1 <[email protected]>
zlareb1
force-pushed
the
docsrc-haystack-callback-protection
branch
from
November 18, 2026 20:24
e62532a to
cf263f7
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Changelog category (leave one):
Changelog entry
Document-store callbacks retain application-owned session protection across fresh clients, authentication waits and sequential retrieval requests.
Why
A new client for each document request loses the contributors observed by the store constructor or an earlier callback. A later automatic retrieval can then send content after one of those contributors is protected.
Scope and risk
The store and retriever retain contributors through the existing callback helper. The request scope begins before client creation and lasts through response conversion and close. Retrieval joins the store and retriever contributors across search, metadata and download requests. The shared helper merges concurrent contributors under its existing lock while resolving contributors outside the lock.
Only an application-owned automatic scope selects automatic behavior. Explicit document operations continue to observe retained contributors. Failed durable marking withholds results. Connection serialization keeps the existing environment Secret and excludes protection state. SDK calls, payloads and sender classifications are unchanged; the sender census renews the adapter source hash.
Compatibility, rollout and rollback
Tests
The unchanged implementation produces 14 failures and 16 passes on both hosted dependency legs, using Python 3.12 and Python 3.11 with Haystack 3.5.0. All 13 original cases and three positive controls pass. The entire 30-case module remains byte-identical for the implementation check. Reproduce with
python -m pytest sdk/python/tests/test_haystack.pyin the native adapter environment.The tests use native documents, writers, retrievers and pipelines with real SDK clients and a selected mock HTTP boundary. They cover constructor and earlier contributors, authentication waits, sequential and paged requests, marking failures, explicit operations, document bytes and metadata, and Secret restoration. Raw-download protection headers are not assumed.
Scoped Ruff lint, formatting, statement limits, strict mypy, source invariants, whitespace and prose checks pass. No local tests ran. On the final head the same 30 cases pass on both hosted legs: 1.90 seconds on Python 3.12 and 2.28 seconds on Python 3.11. Strict adapter mypy passes on both legs. Fresh independent review of the complete final diff reports no findings or nits. All 42 checks, all three applicable workflows and all 41 underlying jobs pass on the final head. The sender census preserves every other reviewed hash and the complete adapter, shared helper and test module. Current-main composition retains the published callback helper and every unrelated main change.
AI assistance in the code (leave one; writing this description with AI is fine):
AI-generated: An agent wrote the change. The complete product diff, unchanged test module, client factory, serialization and sender census were checked before publication. Native execution passes on both hosted legs; fresh independent review covers the complete final diff.
I can explain every line of this diff and how it interacts with the rest of Loom.
Checklist