Skip to content

Retain session protection across document-store clients - #909

Merged
zlareb1 merged 3 commits into
mainfrom
docsrc-haystack-callback-protection
Nov 18, 2026
Merged

zlareb1 merged 3 commits into
mainfrom
docsrc-haystack-callback-protection

Conversation

@zlareb1

@zlareb1 zlareb1 commented Nov 18, 2026 •

Copy link
Copy Markdown
Member

Changelog category (leave one):

  • Bug Fix (user-visible misbehavior in a release)

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

  • Wire, schema, settings and dependencies: unchanged.
  • Operator steps: none.
  • Rollback: revert the callback retention and its regression cases.

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.py in 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

  • Original tests and all regression inputs and assertions are preserved.
  • Hosted regressions demonstrate the failure on both dependency legs.
  • The same native regressions pass after the correction.
  • Fresh independent review of the composed head has no unresolved findings.
  • Required CI checks pass on the composed head.
  • Commits are signed off.

@zlareb1 zlareb1 changed the title Exercise protection across native document-store clients Retain session protection across document-store clients Nov 18, 2026
@zlareb1
zlareb1 marked this pull request as ready for review November 18, 2026 20:17
@zlareb1
zlareb1 force-pushed the docsrc-haystack-callback-protection branch from e62532a to cf263f7 Compare November 18, 2026 20:24
@zlareb1
zlareb1 merged commit f4930b2 into main Nov 18, 2026
42 checks passed
@zlareb1 zlareb1 mentioned this pull request Nov 18, 2026
6 tasks done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant