Top stories
PostHog rewrites its SQL parser in Rust with a coding agent
- Category: Engineering post
- Status: discussion
- Sources: PostHog blog, discussion
- Summary: PostHog replaced its ANTLR-generated SQL parser with a hand-written recursive-descent parser with a Pratt expression core, written in Rust, reporting 454x faster parsing on production queries (70x on the author's laptop). The author says Claude Opus 4.7 generated the 16,000+ lines across parallel sessions while they "barely looked at the code," and that correctness came from property-based testing with Hypothesis, coverage-guided test generation, and differential testing against the original ANTLR parser rather than manual review.
- Comments: HN discussion focused on whether agent-written code is trustworthy without human reading, with the author arguing the differential and property-based test harness, not the model, is what guarantees the rewrite matches the old parser.
- Why it matters: It is a concrete data point that a heavy test harness, not line-by-line review, can be the control that makes large agent-generated rewrites shippable.
- Follow-up: Watch for the parser's production rollout results and any correctness regressions the harness missed.