Skip to content

README Rust Quick Start: recursive rule returns PRS-077, and alice_id/bob_id are undefined #884

Open

Description

@adityamukho

The Rust Quick Start in the README has two errors. Reported by email from grump.run. I checked both on main (v2.0.11).

1. Recursive rule example returns PRS-077

The README passes two rule forms to one execute() call:

db.execute(r#"(rule [(reachable ?a ?b) [?a :friend ?b]])
              (rule [(reachable ?a ?b) [?a :friend ?m] (reachable ?m ?b)])"#)?;

Since #305, the parser rejects input after the first complete form. This call now returns:

[PRS-077] unexpected trailing input after a complete form: LeftParen

Two separate execute() calls work. With the README's data, (reachable :alice ?x) then finds Bob.

2. alice_id and bob_id are not defined

The prepared statement lines use alice_id and bob_id, but the snippet never defines them. The code does not compile as pasted:

error[E0425]: cannot find value `alice_id` in this scope
error[E0425]: cannot find value `bob_id` in this scope

These are UUIDv5 values of the keyword. Only the tests show this (for example tests/prepared_statements_test.rs):

let alice_id = Uuid::new_v5(&Uuid::NAMESPACE_OID, b":alice");

Suggested fix

  • Split the recursive rule into two execute() calls.
  • Define alice_id and bob_id in the snippet, or show a public way to get an entity ID from a keyword, if one exists.
  • Check other docs (wiki, minigraf-docs, crate docs) for the same multi-form pattern.

The reporter says the rest of the Quick Start worked, and the Python sample printed what its comment says.

Reporter's verified fixes: https://grump.run/r/minigraf-1dd3ff/


Generated by Claude Code

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions