From e3d8df8425dd7788516e3b68203882a45f435b2d Mon Sep 17 00:00:00 2001 From: Aditya Mukhopadhyay Date: Fri, 13 Nov 2026 19:47:32 +0530 Subject: [PATCH] docs: fix Rust Quick Start examples (#884) --- CHANGELOG.md | 1 + README.md | 12 ++++++++---- docs/ERROR_REFERENCE.md | 1 + 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 77b6c565f..bfc757291 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -52,6 +52,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Documentation +- Fix the Rust Quick Start (#884): register recursive rule clauses in separate `execute()` calls and define the keyword entity IDs used by prepared queries. Clarify the entity ID in the prepared-query error example. - **Configuration reference** (#869): [docs/CONFIGURATION.md](docs/CONFIGURATION.md) lists every `OpenOptions` setting, where else it can be changed, and how `allow_overrides` gates query text. - **Heavy WAL entry replay test** (#865): a nightly acceptance test writes one WAL entry of 1,000,000 facts, reopens without a checkpoint and checks every replayed fact through entity, attribute and attribute-value lookups, then checkpoints, verifies and reopens. It passes; no production change. - **Failure-path correctness map** (#843): [X08's correctness-target map](docs/benchmarks/843-failure-correctness/README.md) ties invalid bounds, windows and binds, callback errors, exhaustion, corrupt pages, failed-handle retry, v1–v6 refusal and heavy single-entry WAL replay to 138 named tests at a pinned v3 revision, with their error and data invariants, and limits the C08 repair and C30 rollback claims to their fixtures. Gaps found: heavy WAL replay through `Minigraf::open` (#865) and the recursion round bound (#861). X08 stays excluded. No production, test, public API or nightly-route change. diff --git a/README.md b/README.md index 29ffa48f6..3b4d72e6d 100644 --- a/README.md +++ b/README.md @@ -168,12 +168,16 @@ std::thread::spawn(move || tx.commit()).join().unwrap()?; // Time travel — query as of past transaction counter db.execute("(query [:find ?age :as-of 1 :where [:alice :person/age ?age]])")?; -// Recursive rule — transitive reachability -db.execute(r#"(rule [(reachable ?a ?b) [?a :friend ?b]]) - (rule [(reachable ?a ?b) [?a :friend ?m] (reachable ?m ?b)])"#)?; +// Recursive rule — register each clause with a separate execute() call +db.execute("(rule [(reachable ?a ?b) [?a :friend ?b]])")?; +db.execute("(rule [(reachable ?a ?b) [?a :friend ?m] (reachable ?m ?b)])")?; +db.execute("(query [:find ?friend :where (reachable :alice ?friend)])")?; // Prepared statement — parse + plan once, execute many times -use minigraf::BindValue; +use minigraf::{BindValue, EntityId}; +// Keywords map to UUIDv5 IDs in the OID namespace, including the leading colon. +let alice_id = EntityId::new_v5(&EntityId::NAMESPACE_OID, b":alice"); +let bob_id = EntityId::new_v5(&EntityId::NAMESPACE_OID, b":bob"); let pq = db.prepare("(query [:find ?name :as-of $tx :where [$entity :person/name ?name]])")?; let r1 = pq.execute(&[("tx", BindValue::TxCount(1)), ("entity", BindValue::Entity(alice_id))])?; let r2 = pq.execute(&[("tx", BindValue::TxCount(2)), ("entity", BindValue::Entity(bob_id))])?; diff --git a/docs/ERROR_REFERENCE.md b/docs/ERROR_REFERENCE.md index f2bfc255a..875caa822 100644 --- a/docs/ERROR_REFERENCE.md +++ b/docs/ERROR_REFERENCE.md @@ -3422,6 +3422,7 @@ db.execute("(rule [(ancestor ?x ?y) [?x :parent ?y]])")?; - Prepare the query and supply a value for every slot: ```rust +let alice_id = minigraf::EntityId::new_v5(&minigraf::EntityId::NAMESPACE_OID, b":alice"); let pq = db.prepare("(query [:find ?status :as-of $tx :valid-at $date \ :where [$entity :employment/status ?status]])")?; let result = pq.execute(&[