Skip to content

Allow rfl::Rename to share wire name with skipped fields (#427) - #77

Closed
clockblocker wants to merge 2 commits into
mainfrom
fix-rename-skip-duplicate
Closed

clockblocker wants to merge 2 commits into
mainfrom
fix-rename-skip-duplicate

Conversation

@clockblocker

@clockblocker clockblocker commented Nov 27, 2026 •

Copy link
Copy Markdown
Owner

Summary

Allows rfl::Rename<"name", ...> to share a wire name with an rfl::Skipped field (or complementary rfl::SkipSerialization / rfl::SkipDeserialization fields) without triggering false duplicate field-name errors, while still rejecting genuine duplicate serialized or deserialized wire names.

Fixes munich-data-engineering#427

Details

  • Added wrapper-aware skip_traits<T> (is_skip.hpp) and rename_traits<T> (is_rename.hpp) across cpp20/cpp26 field name extraction and case-transform processors so both Rename<"items", SkipDeserialization<T>> and SkipDeserialization<Rename<"items", T>> resolve cleanly.
  • Updated no_duplicate_field_names<Fields>() to a single constexpr std::array pass checking direction-aware collisions (conflict iff both fields are serialized or both are deserialized) and enforced it on rfl::NamedTuple.
  • Updated find_index (find_matching_field_index) and NamedTuple / move_from_named_tuple so rfl::to_named_tuple / rfl::from_named_tuple / cross-type conversions disambiguate shared wire names by (skip_serialization, skip_deserialization) and flattened positional offsets.
  • Updated NamedTupleParser::write to pass the exact count of serialized fields (num_serialized_fields) to ParentType::add_object (preventing MessagePack / strict-size writer wire corruption).
  • Updated rfl::env::Reader::read_object to iterate ViewType::Fields skipping skip_deserialization_v fields (preventing duplicate reads of shared wire names).
  • Updated NamedTupleParser::add_field_to_schema to gate on !skip_serialization_v (note: standalone SkipDeserialization<T> fields now appear in schemas since they are serialized on the wire).

Verification

  • Full ctest suite (json, generic, cli, env, json_c_arrays_and_inheritance) under -Wall -Werror: 595/595 PASSED (including StrictCountingWriter MessagePack count tests, tests/env/test_rename_skip.cpp, and from_named_tuple round-trip tests).
  • Compile-fail verification (-fsyntax-only): all 6 genuine duplicate / ambiguous negative cases fail cleanly with static_assert.

@clockblocker

Copy link
Copy Markdown
Owner Author

Signed-off branch is preserved on fork and indexed in #116 (Easy & Landable — Parked for After Main Effort) so the open PR list tracks only the active 18-PR queue + live upstream PRs.

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.

Reflecting fields that are renamed with rfl::Rename that share their name with a skipped field still fail

1 participant