Skip to content

fix: preserve non-string dict keys in pipeline snapshot serialization - #13497

Closed
rupak-eng wants to merge 1 commit into
deepset-ai:mainfrom
rupak-eng:fix/breakpoint-snapshot-int-dict-keys-13492
Closed

rupak-eng wants to merge 1 commit into
deepset-ai:mainfrom
rupak-eng:fix/breakpoint-snapshot-int-dict-keys-13492

Conversation

@rupak-eng

Copy link
Copy Markdown

Related Issues

Proposed Changes

  • haystack/utils/base_serialization.py: dicts with non-string keys are now
    serialized as an explicit list of key/value entries (each key keeps its own
    schema) instead of through the properties/data mappings, whose keys
    json.dump stringifies. The deserializer restores each key from its own
    schema. Dicts with only string keys keep the historical properties
    envelope byte-identical, and snapshots written before this change still
    load exactly as before.
  • Regression tests: TestNonStringKeys in
    test/utils/test_base_serialization.py (int/float/bool/None keys, mixed
    keys, nested dicts, and a stringified collision, all through a real JSON
    round-trip) and test_resume_from_snapshot_file_preserves_int_dict_keys
    in test/core/pipeline/test_breakpoint.py (the issue's end-to-end repro:
    run with breakpoint, save snapshot file, load, resume).
  • Release note added.

How did you test it?

  • Reproduced the issue first with the issue's repro script (resumed result
    carried string keys {'1': 'a', '2': 'b'}); after the fix the same script
    returns {1: 'a', 2: 'b'} with int keys.
  • New tests pass; existing test/utils/test_base_serialization.py and
    test/core/pipeline/test_breakpoint.py suites pass (plus ruff check
    and ruff format --check on the touched files).

Notes for the reviewer

  • The shared _serialize_value_with_schema / _deserialize_value_with_schema
    helpers are also used for Agent/State data, so the fix applies there too;
    the change is additive (a new entries keyword only for dicts that
    previously could not round-trip) and does not alter string-keyed output.
  • Deliberately out of scope: the _serialize_with_field_fallback degraded
    path still drops a field it cannot serialize, as before.

Checklist

  • I have read the contributors guidelines and the code of conduct.
  • I have added unit tests and updated the docstrings.
  • I've used one of the conventional commit types for my PR title: fix:.
  • I have documented my code.
  • I have added a release note file, following the contributors guidelines.
  • I have run ruff check and ruff format --check on the touched files and fixed any issue.

AI assistance: this change was implemented with the help of an AI coding assistant; the bug was reproduced before the fix, and the tests and checks above were run as described.

@rupak-eng
rupak-eng requested a review from a team as a code owner October 30, 2026 05:25
@rupak-eng
rupak-eng requested review from davidsbatista and removed request for a team October 30, 2026 05:25
@vercel

vercel Bot commented Oct 30, 2026

Copy link
Copy Markdown
Contributor

@rupak-eng is attempting to deploy a commit to the deepset Team on Vercel.

A member of the Team first needs to authorize it.

@HaystackBot

Copy link
Copy Markdown
Contributor

Hi @rupak-eng, thanks a lot for your contribution! 🙏

We noticed that the Contributor License Agreement (CLA) check (license/cla) hasn't passed yet, so we've temporarily moved this PR to draft and paused the review assignment.

To get your PR reviewed, please sign the CLA via the link in the license/cla check below (or in the CLA bot comment). As soon as the check turns green, this PR will automatically be marked ready for review again and a reviewer will be re-assigned.

@HaystackBot
HaystackBot removed the request for review from davidsbatista October 30, 2026 06:34
@HaystackBot HaystackBot added the cla-pending PR is in draft until the contributor signs the CLA label Oct 30, 2026
@HaystackBot
HaystackBot marked this pull request as draft October 30, 2026 06:35
@CLAassistant

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@github-actions github-actions Bot added the P2 Medium priority, add to the next sprint if no P1 available label Nov 2, 2026
@HaystackBot

Copy link
Copy Markdown
Contributor

Hi @rupak-eng, just a friendly reminder: this PR is still in draft because the Contributor License Agreement (CLA) hasn't been signed yet. We'd love to review your contribution! Please sign the CLA via the link in the license/cla check, and this PR will automatically be marked ready for review.

@HaystackBot

Copy link
Copy Markdown
Contributor

Hi @rupak-eng, this PR is still waiting for the Contributor License Agreement (CLA) to be signed. Please note that if the CLA isn't signed within the next 4 days, this PR will be automatically closed as stale. Signing only takes a minute via the link in the license/cla check, and the PR will then automatically be marked ready for review.

@davidsbatista

Copy link
Copy Markdown
Contributor

@rupak-eng unless you sign the CLA we can't take this any further, if not signed in the next days, I will close it.

@HaystackBot

Copy link
Copy Markdown
Contributor

Hi @rupak-eng, we're closing this PR because the Contributor License Agreement (CLA) wasn't signed within two weeks. Thanks a lot for your interest in contributing to Haystack! If you'd still like to see this change merged, please sign the CLA and reopen this PR — it will then automatically be marked ready for review.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla-pending PR is in draft until the contributor signs the CLA P2 Medium priority, add to the next sprint if no P1 available topic:tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Resuming a pipeline from a snapshot file turns int dict keys into strings

4 participants