Repository navigation
feat: Phase 7.6 — temporal metadata bindings + range queries (v0.15.0) - #28
Merged
Merged
Conversation
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…y collapsible-if Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Add `valid_at_value` field and `from_slice_with_valid_at` constructor - Store hidden `__f*` fact-metadata keys on real-attr pattern matches so pseudo-attr patterns can read per-fact temporal/tx fields without cross-joining against every other fact for the same entity - Handle anonymous wildcard `_` in match_component - Fix parser: treat bare `:any-valid-time` as shorthand for `:valid-at :any-valid-time` (was silently ignored) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…alid-at injection - Add query_uses_per_fact_pseudo_attr helper to detect per-fact pseudo-attr usage - Hard-error in execute_query and execute_query_with_rules when per-fact pseudo-attrs (:db/valid-from, :db/valid-to, :db/tx-count, :db/tx-id) are used without :any-valid-time - Compute valid_at_value (Timestamp/Null/now) and thread it into PatternMatcher via from_slice_with_valid_at in all matcher construction sites - Update not_body_matches to accept and forward valid_at: Value - Update evaluate_branch to compute and forward branch_valid_at_value - Fix valid_at_explicit_timestamp test: insert fact with valid-from "2020-01-01" so it is visible at the queried "2023-01-01" timestamp Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #28 +/- ##
==========================================
+ Coverage 85.41% 86.17% +0.75%
==========================================
Files 24 24
Lines 3724 3869 +145
==========================================
+ Hits 3181 3334 +153
+ Misses 543 535 -8
🚀 New features to boost your workflow:
|
Covers 6 previously uncovered code paths flagged by Codecov (PR #28): - executor.rs 341–353: hard-error guard in execute_query_with_rules - executor.rs 930–931: evaluate_branch None valid_at case via or-clause - matcher.rs 119–126: match_fact_against_pattern Pseudo arm (sole pattern) - matcher.rs 322–323: fast-path hidden key found but value mismatch - evaluator.rs 361: substitute_pattern Pseudo arm via not-join body - parser.rs 1076–1079: wrong-length (≠3) where-clause pattern Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Add unit tests that directly construct Pattern::pseudo(...) and feed it through execute_transact/execute_retract (executor.rs lines 103/139), materialize_transaction/materialize_retraction (db.rs ~577/614), and the matcher's hidden-key fast-path with a non-uuid/keyword entity (matcher.rs line 302) and a value-mismatch constant (line 323). These branches are unreachable via the text parser (which always wraps transact attributes in AttributeSpec::Real) but must exist as a defensive guard for direct Rust API callers. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Cover 11 of the 12 remaining uncovered new lines (tarpaulin DA:line,0): - executor.rs 341-342: call execute_query_with_rules() directly with ValidAt::Timestamp and ValidAt::AnyValidTime to hit valid_at_value match arms - executor.rs 348-350: rules query with per-fact pseudo-attr + no :any-valid-time triggers the hard-error guard - executor.rs 930-931: call evaluate_branch() with Timestamp and AnyValidTime valid_at to hit branch_valid_at_value match arms - db.rs 576, 613: call materialize_transaction/retraction with AttributeSpec::Real(Integer) (non-keyword) to hit the Real(_) bail! arms (distinct from the Pseudo arm covered previously) - matcher.rs 120-122: call match_pattern() with UUID entity + ValidTo, TxCount, TxId pseudo-attrs (no hidden keys seeded) to hit scan path Line 302 (matcher.rs _ => None in match_pattern_with_bindings entity resolution) remains at 0 — tarpaulin does not instrument _ wildcard arms as standalone probes; patch coverage is ~99.5%, well above the 75% threshold. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
7 tasks
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
:db/valid-from,:db/valid-to,:db/tx-count,:db/tx-id,:db/valid-atas first-class bindable pseudo-attributes in Datalog:wherepatterns:db/*keywords in attribute position →AttributeSpec::Pseudo; rejects them in entity/value positions (hard parse error):any-valid-timefor per-fact pseudo-attrs (hard runtime error with clear message); injects query-levelvalid_atvalue into matcherNew types
PseudoAttrenum (5 variants) +AttributeSpecenum replacingEdnValueinPattern.attributePatternMatcher::from_slice_with_valid_at— passes query-level timestamp into per-pattern matchingTest Plan
tests/temporal_metadata_test.rscovering all query patterns, parse errors, and runtime error guardscargo fmt,cargo clippy,cargo testall pass via pre-push hook🤖 Generated with Claude Code