8000 minigraf/ROADMAP.md at main · project-minigraf/minigraf · GitHub
[go: up one dir, main page]

Skip to content

Latest commit

 

History

History
338 lines (220 loc) · 25.8 KB

ROADMAP.md

File metadata and controls

338 lines (220 loc) · 25.8 KB

Minigraf Roadmap

Planned work for Minigraf, a bi-temporal Datalog database. v2.x has known data-integrity issues (pinned list); v3.0.0 fixes them (v3.0.0 milestone).

Minigraf runs inside agent processes, mobile apps and browsers. The project prioritizes embedded deployment and reliable storage.

For the unreleased v3.0.0, main implements ordinary avg with the same numeric inputs as window avg (#777). Ordinary sum and sum-distinct skip nil and nonnumeric values, and ordinary min and max compare non-nil values in the same order as the window functions (#789). Existing empty-group results are unchanged. These changes were not backported to v2.x. See the changelog for details.

Completed releases and their implementation details live in the CHANGELOG. This roadmap lists planned work and research.


v2.0.12 — BrowserDb Flush Patch (released 2026-11-18)

File format stays v7 and the public API does not change. Details are in the CHANGELOG.

Shipped:

  • BrowserDb IndexedDB flushes are atomic, settle on abort and, after a failure, refuse later durable work with STG-046; STG-048 names the failed write (#894)
  • Browser library linted on wasm32-unknown-unknown in CI; BrowserDb tests run in Firefox, Chrome and Safari (#905, #906)

v2.0.11 — Query and Write-Transaction Patch (released 2026-10-26)

File format stays v7 and the public API does not change. Details are in the CHANGELOG.

Shipped:

  • An expression's = and != equate a keyword with a ref to the entity it names, as patterns and joins do (#744)
  • A rule call with 0.0 returns -0.0 rows in every run; equal zero floats hash alike (#750)
  • checkpoint inside a WriteTransaction returns INT-001 instead of deadlocking; prepare and PreparedQuery::execute enforce the same guard (#734)

v2.0.10 — WAL and Float-Constant Data-Integrity Patch (released 2026-10-23)

File format stays v7 and the public API does not change. Details are in the CHANGELOG.

Shipped:

  • WAL entries of more than 1,000,000 facts replay, so the transaction and every later one survive a crash or close without a checkpoint (#686)
  • A float constant in a pattern matches equal floats only, not every float within f64::EPSILON (#706)
  • Prepared queries use the database's max_derived_facts and max_results (#679)
  • Kani proofs of the value encoding, backported from v3.0.0 (#627)

v2.0.9 — Rule and Parser Data-Integrity Patch (released 2026-10-21)

File format stays v7 and the public API does not change. Details are in the CHANGELOG.

Shipped:

  • A pseudo-attribute in a rule body reads the stored fact's valid time and tx metadata (#661)
  • A fact of more than four elements is rejected with PRS-108 instead of being stored truncated (#649)
  • BrowserDb rejections carry their error code (#673)
  • Every binding package is installed and used before it is published and again after; the check fixed packaging bugs in the Node, Android, Swift, C, Java and WASM 2.0.8 packages

v2.0.8 — Query Data-Integrity Patch (released 2026-10-20)

File format stays v7 and the public API does not change. Details are in the CHANGELOG.

Shipped:

  • A :db/valid-at pattern in a not-join body (#615) or a rule definition (#617) binds the query's valid time
  • An or / or-join branch whose expression reads an outer variable matches (#620)
  • An expression reading a variable only an or binds keeps its rows (#625)
  • An or / or-join branch meets a keyword value as the entity it names (#637)
  • A rule calling a rule with not, not-join, or or or-join gets all its rows (#628), and recursion through such a rule returns all its rows (#633)

v2.0.7 — Query Patch (released 2026-10-16)

File format stays v7 and the public API does not change. Details are in the CHANGELOG.

Shipped:

  • A prepared query keeps a literal :as-of, :valid-at or :any-valid-time (#603)
  • Rule queries with a literal argument return every row (#608)
  • An or that shares no variable with the earlier clauses returns its cross product (#610)

v2.0.6 — Concurrent-Query Patch (released 2026-10-14)

File format stays v7 and the public API does not change. Details are in the CHANGELOG.

Shipped:

  • A query on another thread sees each committed transaction whole (#554)
  • All patterns of one query read the same state of the database (#555)
  • A query during a checkpoint no longer misses committed facts or sees part of a transaction (#558)

v2.0.5 — Data-Integrity Patch (released 2026-10-11)

File format stays v7. Two new error codes (STG-045, WAL-007); no other API changes. Details are in the CHANGELOG.

Shipped:

  • A file shorter than one page is refused with STG-045 unless it is a torn first write (#506)
  • A commit made after a torn WAL entry is no longer lost on recovery; a failed append makes later writes WAL-007 until reopen or checkpoint (#513)
  • Backported from v3.0.0: rule queries count only derived facts against max_results (#528), checkpoint() removes an all-checkpointed WAL (#457), usize::MAX checkpoint threshold skips the close-time save (#476)
  • Weekly 10M-fact soak test (#392) and CI checks that fail when a file falls below its coverage threshold (#396)

v2.0.4 — Browser Durability Patch (released 2026-10-08)

File format stays v7 and the public API does not change. Details are in the CHANGELOG.

Shipped:

  • BrowserDb returns an error instead of leaving an unreadable dirty page out of the IndexedDB flush (#470)
  • Golden-file compatibility corpus for format v7 (#391) and a SIGKILL crash test that checks the committed data (#384)

v2.0.3 — Data-Integrity Patch (released 2026-10-06)

First v2.x patch under the support policy. File format stays v7 and the public API does not change. Details are in the CHANGELOG.

Shipped:

  • Indexed queries return correct results with more than 65,535 uncheckpointed facts (#445)
  • The transaction counter no longer rewinds when reopening next to an already-checkpointed WAL (#447)

Further v2.x releases carry all bug fixes, including data-integrity and security fixes, but no new features, until 12 months after v3.0.0 final ships (not a prerelease).


v2.0.2 — Final Planned v2.x Release (released 2026-09-27)

The v2.x line (then main, now v2.x) ends with a patch. File format stays v7 and the public API does not change. All new feature work has moved to v3.x. Work list: v3.0.0 milestone. Details are in the CHANGELOG.

Shipped:

  • Bound-entity point queries narrowed to the queried attribute (#323 mitigation), exact attribute-scan bounds (#381), and checkpoints that copy untouched index leaves (#315 mitigation)
  • fsync the parent directory after creating the .graph/WAL file and after deleting the WAL (#389)
  • or-join returns an empty result, not INT-031, when the clauses before it match no rows (#405)
  • A clear user error for $slot queries run through execute(), not internal INT-025 (#407)
  • Recursive rules with a literal start that recurse through another rule no longer fail under magic sets (#297)
  • The INT-054 negative-cycle error names its predicates in a stable order (#410)
  • CI reports benchmark regressions by suite instead of dropping new alerts when another regression issue is open (#393)
  • CI: MSRV build, public-API semver check, dependency policy (#395)
  • Stability and support policy, including how long v2.x gets data-integrity fixes after v3.0.0 (#397)
  • Known-issues process: data-integrity issues stay open until the fix is in a published release (#399)
  • Support tiers for language bindings and platforms (#400)

Known issue on all v2.x releases: same-transaction multi-valued facts read back as one value (#371, #287). The fix needs format v8 and ships in v3.0.0. Workaround: write or retract each value of a multi-valued attribute in its own transact/retract call. All v2.x known issues are listed in the pinned issue #421.

v2.x gets all bug fixes, including data-integrity and security fixes, but no new features, until 12 months after v3.0.0 final ships; prereleases do not start that clock (support policy).


v3.0.0 — File Format v8 and Data Integrity (alpha in preparation)

The feature and correctness work below is complete for 3.0.0-alpha (developed on v3, which became main in the #937 branch move); it is not yet released. The open milestone items are release preparation: version bump (#929), branch move (#937), performance-envelope refresh or exception (#942), nightly routing (#940), release pipeline (#938, #939), and documentation (#931–#933).

  • Bounded typed incoming references (#924): core Rust transaction APIs implemented, with separate link/record limits, exact scalar Ref matching and target-local access in every storage layer. The JVM bindings and docs-site deliverables are merged. The measurement report shows no median regression above 5% on any of 65 IDs in either round; see acceptance evidence.
  • Incoming-reference binding parity (#925; done): BrowserWriteTransaction.incomingRefs implements exact JS budgets, typed complete/exhausted outcomes and callback reentry guards. The remaining native bindings, binding template, WASM package and docs-site PRs are merged. The WASI package remains a REPL without transaction handles.

v3.0.0 writes file format v8 and automatically migrates v7. The v8 keys include value bytes, fixing the same-transaction multi-value collapse in #287/#371. The v1–v6 → v7 auto-migration code has been removed; v1–v6 files are refused with STG-028 and left unchanged. Open those files with v2.x first to migrate them to v7. Read-only open reads v7 without migrating. All layout changes for this release are in v8.

This was the GitHub milestone named “2.0” before v2.0.0 used that version number for the kernel-locking and structured-error-code breaking changes; it was consequently renumbered to v3.0.0. Since the #937 branch move, done before the alpha was tagged, main is the 3.x line (formerly v3) and v2.x is the 2.x maintenance line (formerly main): pull requests for 3.x target main, and 2.x fixes land on main first and are backported to v2.x.

Completed — format and storage integrity:

  • v8 index keys with value bytes and v7→v8 migration (#371, #287; done on v3)

  • Kani proofs that the format-v8 scalar key decoders invert their encoders and reject bounded malformed inputs without panicking (#693; done on v3, with no format change)

  • v8 storage format, done on v3 in five PRs (#374, #434, #388, #433):

    • per-page CRC32, page id and generation on every page (#388);
    • two alternating meta pages; crash-atomic, copy-on-write checkpoints whose cost follows the change (#374, #434);
    • covering byte-comparable keys with a dictionary and deduplicated long values, at about 142 bytes per fact (#433).

    The format is frozen for the golden-file corpus (#391).

  • Index verify and public rebuild_indexes() (#373; done on v3)

  • Net-assert on v8 keys before resolving facts, for O(live) point queries (#379; done on v3)

  • One current valid-time window per (e, a, v): a later assertion replaces the earlier window, and two windows of one fact in one transact are API-011 (#435; done on v3)

  • Empty or inverted valid-time windows rejected with API-019 on every write path (#436; done on v3)

  • In a WriteTransaction, the last statement that writes a fact decides it, so reads inside the transaction match the commit; LogWriter keeps the same rules, with API-020 for an assertion and retraction of one fact in one transaction (#477; done on v3)

  • btree_page fuzz target that reaches node decoding (#375; done on v3 with #387: page targets rebuilt on real v8 files)

Completed — query API:

  • Ordinary aggregate value handling matches windows (#789; done on v3): sum/sum-distinct skip nonnumbers; min/max accept all non-nil types and mixed numbers. Empty-query and all-nil min/max group-drop behavior is preserved. Ordinary avg (#777) and ordered-group expansion (#781) are also implemented.

  • Selective in-memory ancestor joins avoid building a whole-attribute value map (#723; implemented for eligible three-pattern recursive bodies). Populated committed generations keep AVET probes; general in-memory value joins remain unchanged.

  • Optional :distinct result tuples, preserving bag output by default (#493; done on v3)

  • lag and lead window functions for the previous/next row within an ordered partition (#182; v3.0.0)

  • Bounded sliding row frames, :rows N preceding, for window aggregates (#183; v3.0.0, implemented on v3; builds on #182). #836 audit evidence retains the 110 wider cases as manual/deferred; it does not expand nightly coverage.

  • Cursor API: Minigraf::query and PreparedQuery::query return an owned Cursor that delivers rows in batches, with the answer fixed at open (#432; done on v3, including binding cursor objects in #462). Behind the cursor, the streaming engine (#473) runs every query and produces rows as they are pulled: patterns, expressions and pseudo-attributes (#544), joins and :db/valid-at (#545), not and or (#546), aggregates and windows (#547), rules (#548), and transaction reads (#550); the executor's query path is gone (#551; done on v3). Operators do not spill: memory follows operator state, with an opt-in per-query limit (QRY-012, #549).

  • Projected UUID lookup batches walk dense DICT ranges (#530; implemented on v3), keeping temporary memory bounded to a batch and query-cache charges in projection order.

  • Native :limit N, :order-by and :offset, with a top-k Sort whose memory follows N (#306; done on v3, with the 10M-fact acceptance tests moved from #473; spec docs/superpowers/specs/2026-10-24-limit-order-by-design.md). #641 is complete on v3: snapshot-bound order proofs and Sort omission for committed scalar ranges, one-group count/count-distinct and partition-at-a-time windows. #781 extends ordered grouping to sum/avg, fixed-scalar min/max, Integer/nil sum-distinct, and effective tuples reducible to one ordered Integer/Boolean slot plus scalar constants/repetitions, including hidden :with keys. Every :with Sort is retained. Unproved keys/arguments, callbacks, collect-set, rules and aggregate+window queries retain full-input evaluation. Compatible built-in windows with one proved nonconstant partition key hold one partition and bounded batches; unpartitioned/incompatible windows, aggregate queries, callbacks and collect-set retain full-input evaluation. See docs/superpowers/specs/2026-10-28-641-input-order-design.md and docs/superpowers/specs/2026-10-29-781-ordered-aggregate-design.md.

  • Fact-log iterator: Minigraf::fact_log(&FactFilter) streams every fact version (assertions and retractions, with tx_count, tx_id and valid-time bounds) in transaction order or storage order, filtered by attribute, attribute prefix, entity and tx range, with memory bounded by a window rather than the database (#430; done on v3, including native binding objects). An open log pins its generation: checkpoints run but do not reuse its pages (#543; API-013 deprecated). A raw log writer (#431) completes the extract-transform-load path.

  • Read-only open: OpenOptions::read_only takes a shared lock, so several readers can hold a file at once, writes nothing to the file or its WAL (a WAL is applied in memory, a v7 file is read without migrating), and refuses writes with API-014 (#429; done on v3). Native bindings expose open_with_options (#465).

  • Raw log writer: LogWriter builds a new database from FactRecords with their tx_count, tx_id, valid-time windows and assertion flags kept, gaps allowed (a purged transaction stays a hole for :as-of), at <path>.partial renamed into place by finish (#431; done on v3, including native binding objects). Completes extract (#429, #430), transform, load.

Completed — features:

  • OPFS-backed persistent mode for BrowserDb: a sync access handle in a dedicated Worker, no in-memory buffer; IndexedDB stays the main-thread backend. OPFS is Tier 2 in the 3.0.0 release, inside the Tier 1 browser binding (#441; done on v3; its benchmark is an explicit exclusion carried to v3.next by #844)

  • Set values #{...}, the set predicates in?/not-in?/any-in?/all-in?/none-in? and collect-set (#316; done on v3: core, BrowserDb set binds, and set values in Python, Java, Android, Swift, Node.js, C and the browser/WASI packages on their v3 branches)

  • Prepared queries in every binding (#181; done on v3: core, BrowserDb.prepare, and Python, Java, Android, Swift, Node.js and C on their v3 branches)

  • UDF registration in every binding: the UniFFI ones, C, Node and the browser BrowserDb (#180; done on v3 in core and every binding: fallible UDFs, QRY-014, registry snapshot and re-entry)

  • OpenOptions exposed over UniFFI through open_with_options, so embedders ca 7CB8 n suppress the close-time checkpoint (#322; done on v3 in every binding with #465)

Completed — testing and documentation:

  • Deterministic storage schedules (#760; v3.0.0): suite and findings cover batch visibility, snapshot cutoffs and checkpoint publication. Focused native/MSRV PR checks and larger nightly/manual searches retain replay artifacts; the workflow-only main companion enables the v3 nightly schedule. Whole-database simulation remains out of scope.
  • Golden-file compatibility corpus for every format version (#391; done on v3: six v7 files from 2.0.3 checked after migration, seven v8 files frozen at 23aa57c)
  • SIGKILL crash test that checks committed data through EAVT, AEVT and full scan (#384; done on v3: tests/crash_kill_test.rs, 100 rounds per OS nightly)
  • Model-based test of transact/retract/checkpoint/reopen (#385; done on v3: tests/model_based_test.rs, 30,000 cases nightly)
  • Wider property tests: file-backed, batched, retracts, temporal, joins (#386; done on v3: tests/property_test.rs)
  • Persistent fuzz corpus and an operation-sequence target (#387; done on v3: corpus caching, weekly cmin, the v8 page targets, and the ops_sequence and corrupt_file targets)
  • Fault injection across save/WAL/recovery (#390; done on v3: src/fault_matrix.rs)
  • Long-running soak test at scale (#392; done on v3: tests/soak_test.rs, 10M facts and a 5-hour churn weekly, alternating the 2.x and 3.x lines)
  • Benchmarks at 100K–10M facts and a published performance envelope (#394; on v3: examples/perf_envelope.rs, results in docs/BENCHMARKS.md; follow-ups #528–#532, with #532 superseded by #551's removal of repeated committed-fact net-assert; audit and measurements)
  • Acceptance evidence for memory/scaling (#837): named-test and Linux RSS gates, nonlinear/multistratum recursion and custom chunk bounds; validation status
  • Regression-history/reporting evidence (#840) is complete: all 453 numeric comparisons, preserved independent v3 history, scheduled routes and live notification/cleanup evidence. Separate main/v3 fixes #853/#854 are merged; raw evidence is retained beyond artifact expiry.
  • Nightly runtime expansion (#858): 14 Java/JVM and 3 WASI IDs run nightly (contract). The Swift/iOS simulator and Android emulator were qualified against physical Device Farm runs and rejected for every case (report), so no mobile lane exists; a physical-device lane is costed there but not scheduled. The platform restriction from #839 applies only to that accepted manual evidence task.
  • Manual migration evidence (#838): native v7-to-v8 through 200k facts; Chromium/Firefox/WebKit through 20k facts, with separate read-only/reopen controls and bounded post-migration cursor churn. Results, frozen fixtures and exclusions; no new nightly route or sustained-pin bound.
  • Semantic permutations (#842): correctness-target map and control limits for X07. The exclusion stands; no nightly route or acceptance gate is added.
  • Failure paths (#843): correctness-target map for X08. The benchmark exclusion stands; #865 closed the heavy WAL replay gap with the passing one_million_fact_wal_entry_replays_on_open acceptance test.
  • Release-cut feature re-audit (#844): every production change since the measured revision, with its benchmark disposition, at v3 head 33b4b165c. The alpha performance envelope was refreshed at bcd74572b on 2026-11-30 (#942; snapshot). OPFS (#441) is excluded and carried to v3.next with the profiler (#185) and rule persistence (#241); no nightly route or gate changes.
  • Manual shape evidence (#841): native shape sweeps, recursive controls and sustained-reader experiments, with explicit input, timeout and attribution limits. The small-nightly recommendation is separate from execution; this audit adds no nightly route or release-acceptance gate.
  • Expression keyword/ref equality (#774; on v3): resolve literal keywords once per operator, with memory bounded by the expression. Measurements and regression coverage; performance-only, with no v2.x backport.
  • Higher storage/WAL coverage gates and branch-coverage gates (#396; on v3: line and branch floors per file in coverage-thresholds.toml, checked on every PR)
  • Durability, recovery and operations guide (#398; done on v3: docs/DURABILITY.md, also on the docs site; found #535)

v3.next — Features

Additive features, kept out of v3.0.0 so the #371 fix is not held up by them:

  • Query profiler (#185)
  • Rule persistence — design first (#241)
  • Temporal graph-traversal research (#273; may result in documentation or a blog post rather than code)

Planned Work: Ecosystem & Tooling

Build tools and examples outside the database engine to help developers use Minigraf.

Developer Tools

Integration Examples

Tracked in: minigraf-examples.

  • 🎯 GraphRAG example that combines Minigraf with a vector store
  • 🎯 LangChain / LangChain.js integration example
  • 🎯 LlamaIndex integration example
  • 🎯 End-to-end examples with notes for agent memory, offline-first mobile apps, and audit logs

Ecosystem Libraries

  • 🎯 Graph algorithms as a separate crate
  • 🎯 Optional schema validation
  • 🎯 Import/export tools
  • 🎯 Backup utilities

Database Branching / Forking (Exploratory)

Allow a Minigraf database to be forked into an independent .graph file pre-populated with facts from the parent at a given transaction count.

Potential uses include speculative writes, snapshot distribution, test isolation, and agent sandboxing. The design must preserve the single-file, zero-configuration model; a fork should behave as an independent file copy with a fully flushed WAL.

Status: Exploratory. Pursue only with demonstrated user demand.

Magic Sets with Stratified Negation (Exploratory)

Magic-sets rewriting is not applied to mixed rules containing not/not-join; those use full semi-naive evaluation. Extending it to negation is well studied but requires care to avoid unsound propagation across stratification boundaries.

Pursue only if profiling demonstrates a real bottleneck in negation-heavy recursive workloads.


Performance Direction

Future performance work will be driven by production profiles and reproducible benchmarks. The benchmark documentation records measurements; completed performance work is recorded in the CHANGELOG.


Decision Framework

When evaluating features, ask:

  1. Does it align with the philosophy? (embedded, reliable, simple, bi-temporal)
  2. Is it needed for target use cases? (audit, event sourcing, knowledge graphs)
  3. Does it compromise reliability? (stability over features)
  4. Can it be a separate crate? (keep the core small)

Say no to:

  • Distributed consensus
  • Multi-datacenter replication
  • Built-in ML/AI
  • Features useful only at massive scale
  • Complex configuration
  • Breaking the single-file philosophy

Say yes to:

  • Crash safety
  • Data integrity
  • Temporal queries
  • Query performance
  • Developer experience
  • Cross-platform support

Current Focus

  • v2.x maintenance on v2.x: all bug fixes, including data-integrity and security fixes, but no new features, until 12 months after v3.0.0 final ships (not a prerelease)
  • v3.0.0-alpha release preparation on main: the feature and correctness work is complete; remaining release tasks are tracked in the v3.0.0 milestone
  • v3.next features after v3.0.0
  • Ecosystem work tracked in minigraf-examples
  • Developer tools tracked in minigraf-inspector and minigraf-visualizer

See GitHub Issues for specific tasks, and the CHANGELOG for completed releases.


Last updated: November 2026 — v3.0.0-alpha in preparation.

0