Repository navigation
fix(query): include asserted flag in selective_fact_fetch dedup key (#285) - #286
Merged
Merged
Conversation
…285) When a WriteTransaction commits both a retraction and a new assertion for the same (entity, attribute) they share a tx_count, causing the previous dedup key (entity, attribute, tx_count) to silently drop the assertion. Adding `asserted` to the key ensures both facts survive the dedup and net_asserted_facts can correctly compute the final state. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
retract+transactin aWriteTransactionreturned empty results via theselective_fact_fetchpath(entity, attribute, tx_count)collapsed retraction and new assertion into one entry when they shared atx_count(all facts in a committedWriteTransactionreceive the same counter value)(entity, attribute, tx_count, asserted)— retraction (asserted=false) and assertion (asserted=true) are now treated as distinct factsChanged files
src/query/datalog/executor.rs— two dedupHashSetkey tuples updated from 3-tuple to 4-tuple; doc comment updatedtests/retraction_test.rs— regression test: atomic retract+transact inWriteTransactionwith plain query (exercisesselective_fact_fetch)Test plan
test_write_transaction_retract_and_transact_same_attr_query_sees_new_valueadded and confirmed red before fix, green aftercargo test) passes — 963 tests, 0 failures🤖 Generated with Claude Code