Stripe's engineering team describes how they built a Selective Test Execution (STE) system for their 50-million-line Ruby monorepo with ~1.2 million test units. Rather than static analysis (which fails with Ruby's dynamic nature), STE uses a C++ shared library loaded via LD_PRELOAD to intercept open syscalls and record which files each test actually accesses at runtime. This file-level dependency graph is stored as roaring bitmaps in a compact selection index. When a new build starts, changed files are detected via hashdeep (including generated artifacts), mapped to bitmap indexes, and unioned to find impacted tests. The result: only ~5% of tests run on average (median 0.5%), using less than 10% of the compute of a full run. The system includes guardrails for edge cases like directory-globbing tests, previously failing tests, and linters. Build baseline metadata is stored in MongoDB with Monotonic Revision IDs for fast, reproducible selection.

12m read timeFrom stripe.dev
Post cover image
Table of contents
Building a dependency graph by intercepting file opensGoing from raw logs to a compact selection indexMaking it reliable at scaleWrapping up
381 Impressions