Repository navigation
id-core: bounded triple-pattern queries with snapshot cursors - #11977
Merged
Merged
Conversation
Adds graph/query.rs (conjunctive patterns over a fixed snapshot, stable total order, provenance per row, read policy, page limit and step budget) and graph/cursor.rs (opaque cursors bound to the frontier and query). Checked against an independent reference matcher with cursor-page concatenation. Refs #10221 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 34 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
This was referenced Nov 22, 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.
Refs #10221
Before: there was no way to read the graph by pattern. Anything that wanted "who knows whom" or "what does this record assert" had to walk assertions by hand, with no page limit, no budget and no rule about which graphs the caller may see.
After:
graph/query.rsanswers conjunctive triple-pattern queries over a fixed snapshot of assertions. Each position is a wildcard, an exact term or a variable, and variables join across patterns. Rows come back in one stable total order with the matched assertions and theirsource_recordprovenance. Every page is limited, a request can't raise the operator profile's row ceiling, and running past the step budget fails withBudgetExceededrather than returning rows that look complete. A pattern naming a graph the caller can't read fails withUnauthorizedGraph; other unreadable graphs are never visited, so they change neither results nor costs.graph/cursor.rsgives opaque cursors bound to the snapshot frontier and the query.How:
(graph, subject, predicate, object, assertion id)per pattern, with terms compared by canonical bytes. The snapshot frontier is a BLAKE3 hash over the sorted assertion ids, so arrival order and duplicates don't change it.[1, frontier, query digest, rows already returned]in canonical CBOR. Another frontier givesCursorExpired; another query, or bytes that aren't a cursor, giveCursorMismatch. The page size may change between pages.Profile::INITIALis the design's suggested profile (page 100, ceiling 1,000, 1,000,000 steps). Response-byte and CPU ceilings aren't modelled yet; steps bound the work.tests/graph_query_reference.rshas an independent matcher (brute-force tuple enumeration, its own term encoding for ordering, its own step count). A property test (512 cases) follows cursors to the end and checks the pages concatenate to exactly the reference rows, only the last page is complete, every page cost matches, and unauthorized or over-budget queries fail. Six fixtures cover a two-hop join with provenance, graph authorization, budget and limits, malformed queries, cursor binding, and frontier stability.graph/mod.rs; slice 9110-09 owns that, so the test includes the files by path.Test:
cargo test -p id-core --test graph_query_reference(7 passed); clippy clean on the new files.Generated by Claude Code
Open in [code]smith · Need help on this PR? Tag
@codesmith-botwith what you need.