Skip to content

feat: insert if not exists#11

Merged
QuantumExplorer merged 7 commits into
masterfrom
feat/insert-if-not-exists
Dec 21, 2021
Merged

feat: insert if not exists#11
QuantumExplorer merged 7 commits into
masterfrom
feat/insert-if-not-exists

Conversation

@iammadab
Copy link
Copy Markdown
Contributor

Insert an element at a path only if that path is empty

@iammadab iammadab marked this pull request as ready for review December 20, 2021 17:32
@iammadab iammadab requested review from QuantumExplorer and fominok and removed request for QuantumExplorer December 20, 2021 17:32
Comment thread grovedb/src/tests.rs Outdated
iammadab and others added 2 commits December 20, 2021 19:38
Co-authored-by: Evgeny Fomin <fominok@hotmail.com>
@QuantumExplorer QuantumExplorer merged commit 3c327b7 into master Dec 21, 2021
@QuantumExplorer QuantumExplorer deleted the feat/insert-if-not-exists branch December 21, 2021 13:25
QuantumExplorer added a commit that referenced this pull request Mar 9, 2026
Finding #11 noted that child_aggregate_sum_data_as_i64() and similar
methods silently return 0 when encountering mismatched AggregateData
variants (e.g. Count under a SummedMerkNode parent). This is a false
positive because GroveDB enforces homogeneous TreeFeatureType within
each Merk tree via get_feature_type(), making cross-type mixing
impossible during normal operation.

Added debug_assert! guards to catch type mismatches during testing
(zero cost in release builds) and comprehensive documentation
explaining the type safety invariant on all four affected methods:
child_aggregate_sum_data_as_i64, child_aggregate_count_data_as_u64,
child_aggregate_sum_data_as_i128, and aggregate_data.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
QuantumExplorer added a commit that referenced this pull request Mar 9, 2026
* docs: document cross-type aggregate safety and add debug assertions

Finding #11 noted that child_aggregate_sum_data_as_i64() and similar
methods silently return 0 when encountering mismatched AggregateData
variants (e.g. Count under a SummedMerkNode parent). This is a false
positive because GroveDB enforces homogeneous TreeFeatureType within
each Merk tree via get_feature_type(), making cross-type mixing
impossible during normal operation.

Added debug_assert! guards to catch type mismatches during testing
(zero cost in release builds) and comprehensive documentation
explaining the type safety invariant on all four affected methods:
child_aggregate_sum_data_as_i64, child_aggregate_count_data_as_u64,
child_aggregate_sum_data_as_i128, and aggregate_data.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* docs: remove debug_assert! guards from cross-type aggregate branches

These branches are unreachable due to GroveDB's type enforcement
(homogeneous TreeFeatureType within each Merk tree). The doc comments
already explain why, making the debug_asserts unnecessary noise.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* docs: fix truncated doc comment on child_aggregate_sum_data_as_i128

Remove stray trailing "The" left over from previous edit.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
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.

3 participants