Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
a020653
Implemented GQL property graph PoC with REPL and in-memory storage.
adityamukho Jan 11, 2026
41ac8af
Fix REPL infinite loop on EOF and remove unused schema file.
adityamukho Jan 11, 2026
a3d1d9b
Update CLAUDE.md to reflect current implementation.
adityamukho Jan 11, 2026
ea40815
Demo commands for PoC.
adityamukho Jan 11, 2026
aea2ae3
Add GQL spec compliance tracking section.
adityamukho Jan 11, 2026
451dee4
Add project philosophy and design principles documentation.
adityamukho Jan 11, 2026
bf01f07
Phase 2: Implement fully embeddable persistent graph database
adityamukho Jan 11, 2026
dcb9835
Add comprehensive ROADMAP.md and clarify development phases
adityamukho Jan 11, 2026
de1b735
Fix documentation consistency: Use 'Milestone' for GQL spec features
adityamukho Jan 11, 2026
3ba73fc
Fix documentation consistency: Use 'Milestone' for GQL spec features
adityamukho Jan 11, 2026
0d7744d
Merge branch 'main' into devel
adityamukho Jan 11, 2026
de77802
Fix failing CI tests: improve file handling robustness
adityamukho Jan 11, 2026
7ed1928
Add debug output to persistence test to diagnose CI failure
adityamukho Jan 11, 2026
e12b9e6
Clean up test: remove debug output, keep assertions
adityamukho Jan 11, 2026
d0f1e84
Add explicit delay in persistence test to fix CI timing issue
adityamukho Jan 11, 2026
2b3f351
Add more debug output to diagnose persistence test failure in CI
adityamukho Jan 11, 2026
dc79f08
Add debug output to PersistentGraphStorage save/load
adityamukho Jan 11, 2026
0969f78
Add debug output to FileBackend header read/write
adityamukho Jan 11, 2026
4031397
Fix TOCTOU bug in FileBackend::open() causing data loss
adityamukho Jan 11, 2026
a90fcea
Fix critical bug: write_page(0) was overwriting header with stale data
adityamukho Jan 11, 2026
d2790b4
Fix persistence test: use file handle metadata instead of path check
adityamukho Jan 11, 2026
be306a5
Merge branch 'main' into devel
adityamukho Jan 11, 2026
b4f6270
Address GitHub Advanced Security code scanning alerts
adityamukho Jan 11, 2026
05ec1a7
Merge remote-tracking branch 'origin/devel' into devel
adityamukho Jan 11, 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
50 changes: 41 additions & 9 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,17 @@ This file provides guidance to Claude Code (claude.ai/code) when working with co

## Project Overview

Minigraf is a tiny, portable GQL (Graph Query Language) engine written in Rust. It's a work-in-progress learning project designed to run as a standalone binary, library, or WebAssembly module. The project currently implements a working PoC with:
Minigraf is a tiny, portable GQL (Graph Query Language) engine written in Rust. It's a work-in-progress learning project designed to run as a standalone binary, library, or WebAssembly module.

**Current Status: Phase 2 Complete** - Fully embeddable graph database with persistent storage:
- Property graph data model (nodes, edges, properties)
- In-memory storage engine
- **Persistent storage engine** (`.graph` file format) - NEW!
- **Embedded database API** (`Minigraf::open()`) - NEW!
- Storage backend abstraction (File, Memory, future IndexedDB)
- Custom GQL query parser
- Query executor
- Query executor with persistence integration
- Interactive REPL console
- 35+ tests, all passing

**Important**: This is a GQL-inspired implementation (~2-5% of ISO/IEC 39075:2024 spec). It is NOT fully spec-compliant and prioritizes learning over conformance. See README.md's "GQL Spec Compliance" section for detailed feature coverage and roadmap.

Expand Down Expand Up @@ -100,7 +105,20 @@ The codebase is organized into the following modules:
- CRUD operations for nodes and edges
- Query helpers: filter by labels, properties, get edges from/to nodes

2. **Query Module (`src/query/`)**:
2. **Storage Module (`src/storage/`)**: Backend abstraction layer (Phase 2)
- `mod.rs`: StorageBackend trait and file format definitions
- `StorageBackend` trait: Platform-agnostic storage interface
- `FileHeader`: Metadata structure for .graph files
- Page size: 4KB, Magic number: "MGRF"
- `backend/file.rs`: File-based backend for native platforms
- Single `.graph` file with page-based storage
- Supports Linux, macOS, Windows, iOS, Android
- Cross-platform format (endian-safe)
- `backend/memory.rs`: In-memory backend
- Fast, non-persistent storage for testing/embedded
- `backend/indexeddb.rs`: Future WASM browser backend

3. **Query Module (`src/query/`)**:
- `parser.rs`: Text-based query parser supporting:
- `CREATE NODE (:Label1:Label2) {prop: value}` - Create nodes
- `CREATE EDGE (id1)-[LABEL]->(id2) {prop: value}` - Create edges
Expand All @@ -113,30 +131,44 @@ The codebase is organized into the following modules:
- Validates edge creation (source/target existence)
- Returns formatted results

3. **REPL Module (`src/repl.rs`)**: Interactive console
4. **REPL Module (`src/repl.rs`)**: Interactive console
- Prompt-based interface (`minigraf>`)
- Reads user input, parses queries, executes, and displays results
- Handles EOF gracefully (src/repl.rs:27-30) for piped input
- Error handling for parse/execution errors

4. **Library (`src/lib.rs`)**: Public API
5. **Library (`src/lib.rs`)**: Public API
- Exports all core types: `Node`, `Edge`, `PropertyValue`, `GraphStorage`
- Exports query functions: `parse_query`, `QueryExecutor`, `QueryResult`
- Exports storage: `StorageBackend`, `FileHeader`, `PAGE_SIZE`
- Exports REPL: `Repl`

5. **Binary (`src/main.rs`)**: Standalone executable
6. **Binary (`src/main.rs`)**: Standalone executable
- Creates in-memory storage
- Launches interactive REPL

### Storage Implementation

The current implementation uses **in-memory storage** with:
Minigraf uses a **layered storage architecture**:

**High-level** (`src/graph/storage.rs`):
- `GraphStorage`: In-memory graph operations (Phase 1 PoC)
- `Arc<RwLock<HashMap<NodeId, Node>>>` for nodes
- `Arc<RwLock<HashMap<EdgeId, Edge>>>` for edges
- Thread-safe concurrent access via read/write locks
- UUIDs for automatic ID generation

Note: RocksDB was initially considered but switched to in-memory storage for the PoC due to compilation issues.
**Low-level** (`src/storage/`): Backend abstraction (Phase 2)
- `StorageBackend` trait: Platform-agnostic storage interface
- `FileBackend`: Single `.graph` file with page-based storage
- 4KB pages, cross-platform format
- Magic number "MGRF", versioned header
- `MemoryBackend`: In-memory page storage for testing
- Future: `IndexedDbBackend` for WASM

**Philosophy**: Following SQLite's VFS model, enabling cross-platform support (native, mobile, WASM) with the same API.

Note: RocksDB was considered but rejected in favor of a custom implementation that aligns with the "SQLite for graphs" philosophy (single-file, self-contained, cross-platform).

### Query Language Syntax

Expand Down
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ description = "A tiny, portable GQL (Graph Query Language) engine"
[dependencies]
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
bincode = "1.3"
anyhow = "1.0"
uuid = { version = "1.0", features = ["v4", "serde"] }

[profile.release]
panic = "abort"

17 changes: 9 additions & 8 deletions PHILOSOPHY.md
Original file line number Diff line number Diff line change
Expand Up @@ -354,24 +354,25 @@ The `.graph` file format must be:

## Evolution Strategy

**Phase 1 (Current)**: Prove the concept
**Phase 1**: βœ… Prove the concept (COMPLETE)
- Basic graph model, simple queries, in-memory storage

**Phase 2**: Establish reliability
- Single-file storage, ACID transactions, WAL, crash recovery
**Phase 2**: βœ… Embeddability (COMPLETE)
- Single-file storage, persistent graph database, embedded API

**Phase 3**: Build performance
- Indexes, query optimization, efficient I/O
**Phase 3**: ⏳ Establish reliability (NEXT)
- WAL, ACID transactions, crash recovery, indexes, query optimization

**Phase 4**: Expand reach
**Phase 4**: ⏳ Expand reach
- WASM support, mobile bindings, multiple backends

**Phase 5**: Mature the ecosystem
**Phase 5**: ⏳ Mature the ecosystem
- Full documentation, tooling, ecosystem libraries

**Phase 6+**: Long-term maintenance
**Phase 6+**: ⏳ Long-term maintenance
- Bug fixes, security patches, conservative improvements

See ROADMAP.md for detailed feature breakdown.
## When to Say "No"

It's important to say "no" to preserve the project's focus:
Expand Down
102 changes: 0 additions & 102 deletions POC_SUMMARY.md

This file was deleted.

Loading
Loading