Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
2de3631
docs: add Phase 7.3 disjunction (or/or-join) design spec
adityamukho Mar 26, 2026
5a10bd3
docs: revise Phase 7.3 spec β€” fix 12 issues from reviewer
adityamukho Mar 26, 2026
01da108
docs: fix 5 issues in Phase 7.3 spec (second reviewer pass)
adityamukho Mar 26, 2026
c1fb770
docs: fix final blocking issue in Phase 7.3 spec (missing has_negated…
adityamukho Mar 26, 2026
db8bd11
docs: add Phase 7.3 disjunction implementation plan
adityamukho Mar 26, 2026
c56b58e
feat(types): add Or/OrJoin WhereClause variants with compile-error fixes
adityamukho Mar 26, 2026
862155c
feat(stratification): add collect_clause_deps, handle Or/OrJoin in de…
adityamukho Mar 26, 2026
3eb6beb
feat(matcher): add match_patterns_seeded for seeded branch evaluation
adityamukho Mar 26, 2026
fcc794e
feat(parser): parse or/or-join/and syntax with safety checks
adityamukho Mar 26, 2026
81f30c5
refactor(evaluator): expose rule_invocation_to_pattern as pub(crate)
adityamukho Mar 26, 2026
ec897b0
feat(executor): add evaluate_branch, apply_or_clauses; wire into exec…
adityamukho Mar 26, 2026
0cda6ee
feat(evaluator): route or/or-join rules to mixed_rules path, wire app…
adityamukho Mar 26, 2026
f8be584
test(disjunction): core or tests β€” union, filter, dedup, not inside b…
adityamukho Mar 26, 2026
5387a2e
test(disjunction): or-join, safety errors, rules, bi-temporal, strati…
adityamukho Mar 26, 2026
041bc2f
docs: update CHANGELOG, ROADMAP, and Datalog-Reference for Phase 7.3 …
adityamukho Mar 26, 2026
ce650d2
fix: reject or/or-join inside not bodies at parse time; clean up TODO…
adityamukho Mar 26, 2026
9cd349b
style: cargo fmt
adityamukho Mar 26, 2026
f58f94b
fix: replace {:?} with {} on cmd.err() in or parse tests (CodeQL)
adityamukho Mar 26, 2026
bf25994
style: cargo fmt on parser.rs or parse test assertions
adityamukho Mar 26, 2026
4adad1c
fix: remove cmd-derived values from or parse test assert messages (Co…
adityamukho Mar 26, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,18 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [0.13.0] β€” 2026-03-26

### Added
- **Disjunction (`or` / `or-join`)**: queries and rule bodies can now use `(or branch1 branch2 ...)` and `(or-join [?v...] branch1 branch2 ...)` where-clauses. Branches support all other clause types including `not`, `not-join`, `Expr`, and nested `or`/`or-join`. `(and ...)` groups multiple clauses into a single branch.
- `match_patterns_seeded` on `PatternMatcher` for seeded branch evaluation.
- `evaluate_branch` and `apply_or_clauses` as `pub(crate)` helpers in `executor.rs`.

### Technical
- `WhereClause` enum gains `Or(Vec<Vec<WhereClause>>)` and `OrJoin { join_vars, branches }` variants.
- `DependencyGraph::from_rules` refactored with recursive `collect_clause_deps` helper; `Or`/`OrJoin` branches contribute positive dependency edges.
- Rules with `or`/`or-join` in their bodies route to the `mixed_rules` path in `StratifiedEvaluator`.

## [0.12.0] - 2026-03-25

### Added
Expand Down
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "minigraf"
version = "0.12.0"
version = "0.13.0"
edition = "2024"
description = "Zero-config, single-file, embedded graph database with bi-temporal Datalog queries"
license = "MIT OR Apache-2.0"
Expand Down
30 changes: 16 additions & 14 deletions ROADMAP.md
Original file line number Diff line number Diff line change
Expand Up @@ -514,7 +514,7 @@ Current v5 stores index data as paged blobs (page type `0x11`). v6 introduces pr
- **7.2a** βœ… Aggregation (`count`, `count-distinct`, `sum`, `sum-distinct`, `min`, `max`, `:with`)
- **7.2b** βœ… Arithmetic & predicate expression clauses (`[(< ?v 100)]`, `[(+ ?a ?b) ?c]`, string predicates, type predicates)
- **7.2** ~~Aggregation (`count`, `sum`, `min`, `max`, `distinct`, `:with`) β€” includes arithmetic filter predicates~~ β†’ split into 7.2a + 7.2b
- **7.3** Disjunction (`or` / `or-join`)
- **7.3** βœ… Disjunction (`or` / `or-join`)
- **7.4** Query Optimizer Improvements (deferred from Phase 6.3)
- **7.5** Tests + Error Coverage (β‰₯90% branch coverage target)
- **7.6** Prepared Statements (parse + plan once, execute many times, temporal bind slots)
Expand Down Expand Up @@ -657,7 +657,7 @@ Current v5 stores index data as paged blobs (page type `0x11`). v6 introduces pr

**Spec**: `docs/superpowers/specs/2026-03-25-phase-7-2b-arithmetic-predicates-design.md`

### 7.3 Disjunction (`or` / `or-join`)
### 7.3 Disjunction (`or` / `or-join`) βœ… COMPLETE

**Goal**: Express "match condition A or condition B" without running two queries and unioning in application code.

Expand Down Expand Up @@ -1488,7 +1488,8 @@ When evaluating features, ask:
- βœ… Phase 7.1: Complete (March 2026) - Stratified negation (`not` / `not-join`), 407 tests
- βœ… Phase 7.2a: Complete (March 2026) - Aggregation (`count`/`sum`/`min`/`max`/`distinct`/`:with`), 461 tests
- βœ… Phase 7.2b: Complete (March 2026) - Arithmetic & predicate expression clauses, 527 tests
- 🎯 Phase 7.3–7.7: disjunction, optimizer, prepared statements, temporal metadata bindings; β‰₯90% branch coverage - **NEXT**
- βœ… Phase 7.3: Complete (March 2026) - Disjunction (`or` / `or-join`), 0.13.0
- 🎯 Phase 7.4–7.7: optimizer, prepared statements, temporal metadata bindings; β‰₯90% branch coverage - **NEXT**
- 🎯 Phase 8: 3-4 months (Cross-platform β€” WASM, mobile, language bindings)
- 🎯 Phase 9: Ongoing (Ecosystem β€” integration examples, cookbook, GraphRAG/LangChain examples)
- 🎯 **v1.0.0: 9-12 months**
Expand All @@ -1499,19 +1500,20 @@ When evaluating features, ask:

## Current Focus

**Right Now**: Phase 7.2b Complete β€” Phase 7.3 Next (Disjunction)
**Right Now**: Phase 7.3 Complete β€” Phase 7.4 Next (Query Optimizer Improvements)

**Phase 7.2b Achievements**:
1. βœ… `BinOp` (14 variants), `UnaryOp` (5 variants), `Expr` AST, `WhereClause::Expr { expr, binding }` in `types.rs`
2. βœ… `parse_expr` / `parse_expr_clause`; dispatch at all 4 clause sites; parse-time regex validation; forward-pass safety check recursing into `not`/`not-join` bodies
3. βœ… `eval_expr` / `eval_binop` / `is_truthy` / `apply_expr_clauses` in `executor.rs`; type-safe with silent row drop on mismatch/div-by-zero/NaN
4. βœ… `apply_expr_clauses_in_evaluator` in `evaluator.rs` for rule body and `not-join` evaluation
5. βœ… 28 integration tests in `tests/predicate_expr_test.rs`; 527 total tests; version bumped to v0.12.0
**Phase 7.3 Achievements**:
1. βœ… `WhereClause::Or(Vec<Vec<WhereClause>>)` and `WhereClause::OrJoin { join_vars, branches }` variants in `types.rs`
2. βœ… `parse_or` / `parse_or_join` / `(and ...)` grouping in `parser.rs`; safety checks at all 4 clause sites
3. βœ… `match_patterns_seeded` on `PatternMatcher` for seeded branch evaluation
4. βœ… `evaluate_branch` / `apply_or_clauses` in `executor.rs`; union + deduplication across branches
5. βœ… `DependencyGraph::from_rules` refactored with `collect_clause_deps`; `Or`/`OrJoin` contribute positive edges
6. βœ… Rules with `or`/`or-join` route to `mixed_rules` path in `StratifiedEvaluator`
7. βœ… Integration tests in `tests/or_test.rs` and `tests/or_join_test.rs`; version bumped to v0.13.0

**Immediate Next Steps (Phase 7.3)**:
1. Add disjunction (`or` / `or-join`)
2. Query optimizer improvements for new clause types β€” Phase 7.4
3. Push error-path coverage toward β‰₯90% target
**Immediate Next Steps (Phase 7.4)**:
1. Query optimizer improvements for new clause types
2. Push error-path coverage toward β‰₯90% target

**Key Decisions Made**:
- βœ… Datalog query language (simpler, better for temporal)
Expand Down
Loading
Loading