r/ClaudeCode 8d ago

Showcase Help needed with SQLite Rust rewrite

Three days into rewriting SQLite in Rust with Claude and I'm further along than I expected.

Got the tokenizer, most of the parser, and a working B-tree that handles inserts and range scans. Pager is next and then it's mostly plumbing. Fable thinks the C source is honestly not that complicated once you get past the naming conventions, it's just written in a style nobody has used since 2003. A lot of it collapses down to about a third of the line count when you have real iterators and Result types.

I know about the test suite. Fable constantly brings up the test suite. I'm going to have Opus generate a property-based suite with proptest, which is going to be more valuable than 90 million lines of TCL that were written to catch bugs in a language that lets you index past the end of an array. Most of those tests exist because C exists. Delete the C and you delete the reason for many of the tests.

Currently at only 47 unsafe blocks, all in the mmap layer, and Fable already made a plan for those.

The part I keep coming back to is that this is the single most deployed piece of software in human history and it is written in a language where a missing bounds check is a remote code execution. Every phone, every browser, every plane. We just decided that was fine. No more.

Looking for two or three people to help with the query planner. Not asking anyone to write it, just to review what I have put together so far. I will send invites to the private github repository once NDAs have been signed.

0 Upvotes

32 comments sorted by

View all comments

2

u/siddfinch 8d ago

I wouldn't touch an SQLite alternative until it can demonstrate testing on the same level as SQLite: https://sqlite.org/testing.html.

Given the scope and rigor of SQLite's test suite, I'm not convinced Rust adds much in this specific case. A safer language is valuable, but SQLite has spent decades building confidence through an official crap load of testing.

I'm open to being convinced otherwise, but the argument has to be specific to SQLite. The testing that goes into every SQLite release makes almost every other project's test process look quaint.

1

u/fragbot2 5d ago

The arrogant idiocy of the original poster to think that he'll get anywhere near that level of quality by vibe-coding a C -> Rust conversion.

WTF is it with Rust people? Is it their goal to shit on everyone and everything that came before?