Skip to content

test: widen property tests to joins, negation, predicates and time travel (#386) - #491

Merged
adityamukho merged 3 commits into
v3from
test/386-wider-property-tests
Oct 8, 2026
Merged

adityamukho merged 3 commits into
v3from
test/386-wider-property-tests

Conversation

@adityamukho

Copy link
Copy Markdown
Collaborator

Refs #386 (tracker #383).

What

tests/property_test.rs gains two properties that write a random history and compare random queries with a reference evaluator:

  • Histories: 1–16 writes. Each is a batched transact (1–9 facts, tx- and fact-level valid-time windows), a retract, a write transaction mixing both, or a checkpoint. Every generated statement is accepted; rejections stay with the model-based test.
  • Queries: 1–3 patterns that share variables (entity joins and ref joins through ?e in value position, ?a, constants, _), an optional not / not-join, an optional comparison predicate (< <= > >= = !=), and :as-of N, :valid-at T, both, or :any-valid-time.
  • Backends: in memory, and a file with checkpoints inside the history, queried on the open handle and again after a reopen (default options or page_cache_size(4)).
  • Comparison: a sorted multiset when the find covers every variable and no pattern has _ (each binding is then a distinct row), and a set otherwise.
  • Errors: a write, checkpoint, reopen or query error fails the case. The three existing properties no longer count a query error as an empty result.

The temporal reference model of tests/model_based_test.rs (#385) moves unchanged to tests/reference_model/mod.rs, so both tests share the #435/#477 rules.

Checking the test catches bugs

Each of these mutations fails the test: :valid-at inclusive at :valid-to; < evaluated as <=; a predicate type error that keeps the row; the on-disk read skipping retractions; the on-disk read not hiding a triple's older transactions; in the reference, not ignoring :as-of; in the reference, patterns ignoring their attribute.

With the model-based generators, only 16% of queries returned any rows. The histories here favor small integers and entities and drop the hot triple, so about 35% return rows, over 13 visible facts on average.

Findings (no engine change in this PR)

  • Expression arguments can't be #uuid literals (PRS-070, documented), so predicate constants exclude refs. The two new regression seeds come from that.
  • Non-aggregate queries return one row per binding, not a set: [:find ?e :where [?e :c ?v]] gives one row per ?v. The test compares as sets whenever a projection could repeat rows, so it holds whichever way that goes.

CI

Normal CI runs 256 in-memory and 25 file-backed cases. The nightly property_test job drops from 8,000,000 to 1,000,000 cases: 1M in memory (~3 ms each), 100k file-backed (~57 ms each) and 1M of each one-pattern property, about 1.6 h locally.

Also

docs/TEST_COVERAGE.md was left empty by the merge of main into v3 (d61b9a4, #488). The first commit restores v3's version.

Spec: docs/superpowers/specs/2026-10-08-wider-property-tests-design.md. A v2.x backport to main follows as a separate PR (spec §9).

🤖 Generated with Claude Code

https://claude.ai/code/session_012wXxZguv7PgKQjMMH4yJ5h

adityamukho and others added 2 commits October 8, 2026 23:57
The merge of main into v3 (d61b9a4, #488) resolved a conflict in
docs/TEST_COVERAGE.md by leaving the file empty. Restore v3's version
from before the merge; main's v2.0.4 edits to it are v2.x-only.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012wXxZguv7PgKQjMMH4yJ5h
…avel (#386)

tests/property_test.rs now writes random histories (batched transacts,
retracts, write transactions, checkpoints) and compares random queries
(1-3 joined patterns, not/not-join, a comparison predicate, :as-of,
:valid-at, :any-valid-time) with a reference evaluator, in memory and
against a file before and after a reopen. A write or query error fails
the test; the three existing properties no longer count an error as an
empty result.

The temporal reference model of the model-based test (#385) moves to
tests/reference_model/ and is shared by both tests.

The nightly job drops from 8M to 1M cases (1M in memory, 100k file-backed,
~1.6 h locally). Mutation checks are listed in the spec.

Refs #386

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012wXxZguv7PgKQjMMH4yJ5h
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012wXxZguv7PgKQjMMH4yJ5h
@codecov

codecov Bot commented Oct 8, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@adityamukho
adityamukho merged commit a8fcfb7 into v3 Oct 8, 2026
24 checks passed
@adityamukho
adityamukho deleted the test/386-wider-property-tests branch October 8, 2026 19:02
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.

1 participant