Skip to content

Fix externally tagged enum payload deserialization - #308

Open
fallenmi wants to merge 1 commit into
qdrant:devfrom
fallenmi:fix/payload-externally-tagged-enums-20261022
Open

fallenmi wants to merge 1 commit into
qdrant:devfrom
fallenmi:fix/payload-externally-tagged-enums-20261022

Conversation

@fallenmi

Copy link
Copy Markdown

Summary

Payload::deserialize rejects Serde's default externally tagged representation for enum variants carrying data. For example, a payload field containing {"Newtype": 32} fails with invalid type: map, expected enum ..., even though the corresponding serde_json::Value deserializes successfully.

This change routes a single-entry object through EnumAccess and carries its associated Value into VariantAccess. It supports newtype, tuple, struct, and object-form unit variants while preserving string-form unit variants. Empty and multi-entry variant objects remain errors.

Only the handwritten src/serde_deser.rs changes. There are no public signature, generated protobuf, dependency, or lint-policy changes.

Tests

Identical tests were run against dev 03a01faa905313cb1efb567af0dd7dd24c5a9b2c with unchanged production code and against the patch, using separate build directories:

  • cargo test --offline --locked --jobs 2 --lib serde_deser --all-features: BASE 12 passed / 6 failed; PATCH 18 passed. The six failures reproduce the enum defect.
  • Added round-trip coverage and independent serde_json::from_value comparisons for newtype, tuple, struct, unit, optional-newtype, and malformed representations.
  • cargo clippy --offline --locked --jobs 2 --workspace --all-targets --all-features -- -D warnings: passed.
  • cargo fmt --all -- --check: passed with stable Rust 1.97 and the scoped nightly-2026-10-22 formatter. The stable formatter emits the existing warnings about nightly-only formatting options; the nightly check also passes.

Dependencies were fetched separately and pinned in a local generated Cargo.lock, which remains uncommitted as required for this library.

A broader cargo test --offline --locked --jobs 2 --lib --all-features -- --skip tests::test_qdrant_queries run yielded BASE 33 passed / 8 failed and PATCH 39 passed / 2 failed. The two remaining failures are the same existing collection/query tests attempting TCP to localhost:6334 in the network-denied environment. This is not a fully green integration-suite claim. Live Qdrant integration tests were not run locally.

Checklist

  • Branch is based on dev.
  • Read the contribution guidelines and current repository/organization policies.
  • Checked current open PR file coverage and all-state enum/deserialization searches for duplicates.
  • Explained the change and added regression tests.
  • Ran the scoped tests and formatting/Clippy checks described above.

AI disclosure

Claude Code prepared the production proposal and initial regression. Codex independently reproduced the failure, added reference-based edge tests, verified the patch, and handled submission.

This branch has not been deployed

No deployments
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