Skip to content

Skip serialized variants during type trace#91

Open
avvlas wants to merge 1 commit intozefchain:mainfrom
avvlas:skip-serialized-variants
Open

Skip serialized variants during type trace#91
avvlas wants to merge 1 commit intozefchain:mainfrom
avvlas:skip-serialized-variants

Conversation

@avvlas
Copy link
Contributor

@avvlas avvlas commented Mar 3, 2026

Summary

The tracer now records enum variants whose serialized VariantFormat is already complete, and deserialize_enum skips re-exploring those variants during type tracing. That avoids overwriting a complete serialized shape with a less precise deserialization-derived shape, while still allowing partially traced variants to be revisited and completed.

Motivation:

This change fixes the issue that can be reproduced with test: test_trace_type_skips_fully_serialized_bytes_variant

In mixed tracing flows, an enum variant may already be fully learned from trace_value before trace_type runs. For example, if tracing first sees Message::Send(Exact16([7; 16])), serialization can already determine that the variant payload is Bytes. During a later trace_type::<Message>(), re-exploring Send through deserialization is unnecessary and can be actively harmful, because the deserializer only has synthetic placeholder input and may fail or infer a weaker shape.

Test Plan

Tests added:

  • test_trace_type_revisits_partially_serialized_enum_variants
  • test_trace_type_skips_fully_serialized_bytes_variant

@avvlas avvlas requested a review from ma2bd as a code owner March 3, 2026 12:13
@avvlas
Copy link
Contributor Author

avvlas commented Mar 19, 2026

Hey, @ma2bd!
Please take a look when you have time :)

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