Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ Auto-migrates v1/v2/v3/v4/v5/v6 → v7 on open/checkpoint.

## Test Coverage

**1250 tests** (1241 passing, 9 ignored; unit + integration + doc).
**1251 tests** (1242 passing, 9 ignored; unit + integration + doc).
See `docs/TEST_COVERAGE.md` for the full per-file breakdown.

**Testing conventions** — see the Testing Conventions section below before writing any tests.
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ let r2 = pq.execute(&[("tx", BindValue::TxCount(2)), ("entity", BindValue::Entit

```bash
cargo run # interactive Datalog REPL
cargo test # run 1250 tests
cargo test # run 1251 tests
cargo run < demos/demo_recursive.txt # recursive rules demo
```

Expand Down
2 changes: 1 addition & 1 deletion docs/TEST_COVERAGE.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

**Verified**: 2026-10-11 with `cargo test`

**Result**: 1,241 passing tests and 9 ignored tests (1,250 total), including the golden-file corpus (#391)
**Result**: 1,242 passing tests and 9 ignored tests (1,251 total), including the golden-file corpus (#391)

For v2.0.5, `tests/edge_cases_test.rs` checks that a file of 1 to 4,095 bytes is `STG-045`, unchanged and with no WAL, when it is a database cut below one page or foreign bytes, and opens as a new database that takes a write and reads it back after reopen when it is a prefix of the initial header or all zeros (#506).

Expand Down
44 changes: 44 additions & 0 deletions src/storage/index.rs
Original file line number Diff line number Diff line change
Expand Up @@ -467,6 +467,50 @@ mod tests {
assert_eq!(indexes.vaet.len(), 1);
}

/// `lookup_vaet_ref` was covered only when a proptest query happened to
/// plan `[?e ?a <entity>]` first, so the coverage gate flaked (#563).
#[test]
fn test_lookup_vaet_ref_returns_only_refs_to_target() {
let alice = Uuid::new_v4();
let bob = Uuid::new_v4();
let target = Uuid::new_v4();
let other = Uuid::new_v4();
let mut indexes = Indexes::new();
let facts = [
(alice, ":friend", target, 1),
(bob, ":manager", target, 2),
(alice, ":friend", other, 3),
];
for (source, attr, ref_target, page_id) in facts {
let fact = Fact::with_valid_time(
source,
attr.to_string(),
Value::Ref(ref_target),
0,
page_id,
0,
VALID_TIME_FOREVER,
);
indexes.insert(
&fact,
FactRef {
page_id,
slot_index: 0,
},
);
}

let mut pages: Vec<u64> = indexes
.lookup_vaet_ref(target)
.iter()
.map(|r| r.page_id)
.collect();
pages.sort_unstable();
assert_eq!(pages, vec![1, 2]);
assert_eq!(indexes.lookup_vaet_ref(other).len(), 1);
assert!(indexes.lookup_vaet_ref(Uuid::new_v4()).is_empty());
}

#[test]
fn test_indexes_insert_populates_all_four() {
let entity = Uuid::new_v4();
Expand Down
Loading