Vol. 0 · Early preview (v0.1)
Built in public · Rust + SQLite · AGPLv3 | Commercial
← All dispatches in The Broadsheet
Dispatch No. 04 · Engineering

Golden Master Testing: How We Port WordPress PHP Functions to Rust with 100% Parity

WordPress's formatting and slug functions have twenty years of quirky edge cases. Guessing how they behave breaks permalinks. Here is how our Golden Master verification loop guarantees exact parity.
By Billy
26 October 2026 · 6 min read
Plate II — The Typecase
Plate II — The Typecase
Field Dispatch #19
Author's Note
Billy is the founder and lead systems engineer of Neopress. Writing from the intersection of native Rust infrastructure, legacy WordPress migration, and AI-assisted visual publishing.
More posts by Billy →Browse all dispatches →

Edge cases hide in twenty-year-old regexes

Take sanitize_title_with_dashes or wpautop in WordPress core. On the surface, turning a post title into a URL slug or wrapping paragraphs in <p> tags sounds trivial. In practice, millions of existing URLs depend on exact UTF-8 accent stripping, HTML entity handling, nested shortcode boundaries, and preserve-block rules accumulated since WordPress 1.5.

If Neopress generates a slightly different slug during a migration, an existing link from search engines or a newsletter 404s. Good enough is not good enough.

Never guess what legacy PHP does when you can execute the real PHP function, capture its exact output, and lock it in as a Rust unit test.
— Billy, Founder & Lead Engineer at Neopress

The Golden Master PHP-to-Rust loop

In our workspace (crates/neopress-transpiler and crates/generated_slugify), every transpiled WordPress function follows a strict 4-step verification loop:

  • Step 1 — Reference PHP Execution: We run generate_golden_master.php against real PHP to produce a deterministic golden_master.json fixture covering hundreds of edge-case inputs (accented UTF-8, malformed HTML, nested shortcodes, zero-width spaces).
  • Step 2 — Rust Port: We implement the pure Rust equivalent with zero unsafe byte slicing.
  • Step 3 — Automated Parity Harness: cargo test --workspace deserializes golden_master.json and asserts that the Rust output matches the PHP output on every single vector.
/n-admin/post — Editing posts with deterministic slug generation and SEO metadata
/n-admin/post — Editing posts with deterministic slug generation and SEO metadata