Repository navigation
test: model-based test of transact/retract/checkpoint/reopen (#385) - #475
Merged
Merged
Conversation
tests/model_based_test.rs runs random sequences of transacts (multi-valued batches, transaction- and fact-level valid-time windows), retracts, write transactions (committed or rolled back, retracting their own assertions), checkpoints, reopens (default, 4-page cache, auto-checkpoint every 2 writes) and simulated crashes (a copy of the .graph file and WAL taken while the handle is open, so the WAL is replayed) against a file in a temp dir. After every step, the tx counter, verify(), full rows with windows and tx counts, and six query shapes under :as-of N and :valid-at T must match a reference model. Normal CI runs 24 cases. The nightly property-test workflow becomes a matrix over property_test and model_based_test (30,000 cases). Spec: docs/superpowers/specs/2026-10-07-model-based-test-design.md Refs #385 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015GgLEs8YozJjYhwPEYgTUn
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.
Refs #385 (tracker #383)
What
tests/model_based_test.rs: a stateful proptest that runs random sequences of operations against a file-backed database in a temp dir. After every step it compares results with a plain reference model.transact(multi-valued batches, valid-time windows at transaction and fact level, a repeated triple with another window → API-011),retract(batched),WriteTransaction(0–4 statements, often retracting a triple it asserts, committed or rolled back),checkpoint, reopen (default,page_cache_size(4),wal_checkpoint_threshold(2)), and a simulated crash: the.graphfile and WAL are copied while the handle is open, then the copy is opened, so the WAL is replayed.current_tx_count;verify()after checkpoint, reopen and crash; full rows?e ?a ?v ?vf ?vt ?tc ?tiwith:any-valid-time, both current and at:as-of N. Six query shapes (full scan, entity, entity+attribute, attribute, attribute+value, value) are each run four ways: no temporal option,:valid-at T,:as-of N :valid-at T, and:as-of N.property-tests.ymlbecomes a matrix ofproperty_test(8,000,000 cases) andmodel_based_test(30,000 cases), so each runs on its own runner with its own 6-hour limit.Vec<Step>strategy replacesproptest-state-machineand still shrinks.Spec:
docs/superpowers/specs/2026-10-07-model-based-test-design.mdVerification
:as-of, inclusive:valid-to, exclusive:valid-from, same-tx retraction losing, no API-011.reader.rs), older on-disk transactions not hidden, seek skipping the:as-oftransaction, WAL replay skipping an entry, tx counter not restored after replay.Notes
v3becomesmain. Until then it can be started by hand:gh workflow run property-tests.yml --ref v3.wal_checkpoint_threshold(usize::MAX)still saves the file, becausePersistentFactStorage::dropsaves whenever the data is dirty. TheSyncMode::Normaldocs say this sentinel suppresses the close-time checkpoint.WriteTransaction, retracting a triple and then re-asserting it reads back as live. After commit, the triple is retracted, because both get the sametx_countand the retraction wins.🤖 Generated with Claude Code
https://claude.ai/code/session_015GgLEs8YozJjYhwPEYgTUn