[pull] main from databendlabs:main#504
Merged
pull[bot] merged 1 commit intoTCeason:mainfrom Aug 29, 2025
Merged
Conversation
…18632) * Add compile-time API freezing macro for struct compatibility Implements frozen_api procedural macro that prevents accidental breaking changes to critical data structures through SHA256 hash verification. Features: - Compile-time protection for struct definitions - Detects changes to field names, types, visibility, and order - Supports all struct types: named, tuple, unit, and generic - Automatic detection of nested structure changes - 8-character hash format for concise error messages Use cases: - Serialized/deserialized structs - Network protocol definitions - Cross-version compatibility requirements - Persistent storage formats * fix: remove unused proc-macro2 dependency from frozen_api Remove direct proc-macro2 dependency as it's already included as a transitive dependency through quote and syn crates. * feat: add frozen_api protection to critical statistics structures - Add frozen_api attribute to AdditionalStatsMeta (a2f68edd) - Add frozen_api attribute to ColumnStatistics (7731ad45) - Add frozen_api attribute to ClusterStatistics (de510c92) - Add frozen_api attribute to Statistics (a40b473c) - Improve error message with clear violation warning - Add databend-common-frozen-api dependency to table_meta These structures are now protected against accidental breaking changes that could cause serialization/deserialization failures in production environments. * feat: protect core segment and snapshot structures with frozen_api Add compile-time protection to prevent accidental breaking changes to critical serializable structures used in table metadata persistence: - v2::SegmentInfo, VirtualColumnMeta, VirtualBlockMeta, BlockMeta, ExtendedBlockMeta - v2::SegmentStatistics - v4::SegmentInfo, TableSnapshot, TableSnapshotStatistics This prevents compatibility disasters like the AdditionalStatsMeta.location field change that broke serialization between versions. * feat: extend frozen_api protection to draft and compact structures Add compile-time protection to remaining serializable structures: - DraftVirtualColumnMeta, DraftVirtualBlockMeta (v2) - RawBlockMeta, CompactSegmentInfo (v4) Completes comprehensive coverage of all critical table metadata structures to prevent serialization compatibility breakage. * feat: upgrade frozen_api to deep hash implementation and update all hash values - Enhance frozen_api macro with deep dependency detection capabilities - Include nested type information in hash computation for comprehensive protection - Add extensive test coverage for indirect dependency detection scenarios - Update all existing hash values in table_meta structures to work with new deep hash algorithm - Demonstrate cascading protection through multi-level dependency chains Updated structures: - v2: SegmentInfo, VirtualColumnMeta, VirtualBlockMeta, BlockMeta, ExtendedBlockMeta - v2: SegmentStatistics, ColumnStatistics, ClusterStatistics, AdditionalStatsMeta, Statistics - v4: SegmentInfo, RawBlockMeta, CompactSegmentInfo, TableSnapshot, TableSnapshotStatistics The deep hash implementation ensures changes to nested protected types are detected across dependency boundaries, providing stronger API compatibility guarantees. * refactor: implement deep hash algorithm with comprehensive dependency detection - Replace simple TokenStream hash with deep analysis including field type information - Add extract_field_types() and type_to_string() helper functions - Update compute_deep_hash() to include both structure and nested type data - Update all existing test hash values to work with enhanced algorithm - Add comprehensive test suite for indirect dependency detection scenarios This ensures changes to nested protected types trigger hash violations in dependent structures, providing stronger API compatibility guarantees across complex dependency chains. * fix: sort workspace members and dependencies alphabetically - Move src/common/frozen_api to correct alphabetical position in workspace members - Move databend-common-frozen-api to correct position in workspace dependencies - Ensures taplo formatting compliance * fix: apply taplo auto-formatting to Cargo.toml files - Reorder workspace dependencies alphabetically (frozen-api before functions) - Reorder frozen_api crate dependencies alphabetically (hex, quote, sha2, syn) - Ensure proper file endings and formatting compliance * add frozen api protect for more structs * add frozen api protect for more structs * Add license header to deep_test.rs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
See Commits and Changes for more details.
Created by
pull[bot] (v2.0.0-alpha.3)
Can you help keep this open source service alive? 💖 Please sponsor : )