Repository navigation
feat: cursor API — Minigraf::query and PreparedQuery::query (#432) - #461
Merged
Merged
Conversation
Both return an owned, Send `Cursor` that delivers a query's rows in batches (`vars`, `next_batch`, `close`, row iterator). The answer is fixed when the cursor opens. The current evaluator still computes the answer at open, under execute()'s limits; the API is shaped so streaming operators can replace it in 3.x without breaking callers (option 2 of #432). Non-queries are rejected with the new API-012. Design: docs/superpowers/specs/2026-10-07-cursor-api-design.md Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015GgLEs8YozJjYhwPEYgTUn
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
This was referenced Oct 7, 2026
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.
Part of #432 (option 2: the API in 3.0.0, with the current evaluator behind it; streaming operators land in 3.x without further API changes).
What changes
Minigraf::query(&str) -> Result<Cursor, MinigrafError>andPreparedQuery::query(binds) -> Result<Cursor, MinigrafError>.Cursor:vars(),next_batch(max_rows) -> Result<Option<Batch>, _>,close(),Iterator<Item = Result<Vec<Value>, _>>. Owned andSend: it borrows nothing from the handle, so a streaming cursor later can holdArcs and atx_countbound instead of a lock or a borrow. This is the one choice that would otherwise break callers later.Batch:len,is_empty,rows,into_rows,IntoIterator. Row-major with private fields; internal operator batches can become columnar behind it.transact, aWriteTransactioncommit, a retract and a checkpoint).API-012:query()giventransact/retract/rule. Bind slots giveAPI-010, aWriteTransactionthread givesINT-001, as inexecute().execute()is unchanged.Design:
docs/superpowers/specs/2026-10-07-cursor-api-design.md.Notes for review
max_resultsandmax_derived_factsonly bound recursive rule evaluation today; they never cap a plain query's rows. So nothing changes there now, andquery()applies the same limits asexecute().PreparedQuery::execute(and nowPreparedQuery::query) uses the default limits, not theOpenOptionsones.WriteTransaction::query(additive), operator rewrite, and the memory-bound design, which is still open per the 2026-10-03 comment on enhancement (v3.0.0): rework the query and transaction engine as a streaming, pull-based operator pipeline with bounded memory #432.Tests
tests/cursor_test.rs(17 tests) plus a doctest. Full suite: 1,276 passing, 9 ignored.cargo clippy -- -D warningsand--all-featuresare clean.🤖 Generated with Claude Code
https://claude.ai/code/session_015GgLEs8YozJjYhwPEYgTUn