Automating data removal
Meta's SCARF framework includes a subsystem that finds and deletes unused classes of data, such as tables, storage use cases and TAO object types, across 21 data systems. It combines static code references from Glean with runtime read counters instrumented into production data systems. When a type has no references and no traffic, SCARF files a ticket, blocks reads and writes as a dry run, and then deletes the data, with backups as a last safeguard. It models cross-system asset dependencies so deletions happen in the right order, and it will not break code references, relying on its dead-code subsystem to prune those first; in a year it removed petabytes across 12.8M data types.
Related posts
- Automating product deprecation
Meta Engineering mediumAdeptSCARF (Systematic Code and Asset Removal Framework) is Meta's tooling for deprecating products by removing dead code and unused data, credited with deleting over 100M lines of code in five years and petabytes of data across 12.8M data types in 21 systems in one year. Engineers scope a deprecation by making only boundary decisions ("Flag Dependency" or "Add to Project"), and SCARF computes a daily-refreshed deletion roadmap that orders removals safely: mobile clients before GraphQL definitions, then business logic, schemas, and finally data. Static and dynamic usage signals block automated deletion of anything still in use. Engineers can triage or override those signals, for example deleting an endpoint that still gets trickle traffic, and generate targeted dependency-breaking code changes.
- Automating dead code cleanup
Meta Engineering mediumAdeptMeta's SCARF framework finds dead code by building a cross-language, symbol-level dependency graph from Glean and augmenting it with runtime usage data such as API endpoint logs, URI dispatch tables and async job invocations, then garbage-collects unreachable nodes, subgraphs and cycles. Switching from per-symbol classifiers to whole-graph analysis raised dead code removal in one large codebase by nearly 50%, at the cost of a longer indexing and data-pipeline cycle that makes prototyping harder. Over five years SCARF has deleted more than 100 million lines in over 370,000 change requests generated through CodemodService, with some languages auto-merged without review. BigGrep textual-reference checks act as a conservative fallback, accepting false negatives to avoid unsafe deletions.
- Migrating Data Ingestion Systems at Meta Scale
Meta Engineering mediumAdeptMeta migrated tens of thousands of MySQL-to-warehouse change data capture (CDC) ingestion jobs, together moving several petabytes daily, from customer-owned pipelines to a self-managed warehouse service, and fully retired the legacy system. Each job went through shadow, reverse-shadow and cleanup phases, with promotion gated on matching row counts and checksums plus no regression in landing latency or resource use. Because CDC carries bad data forward into new partitions, bad partitions were flagged in metadata to halt delta landing or fall back to older target partitions, and backfills gave early rollback signals. Automated promotion/demotion tooling, batch selection that excluded jobs with known issues, and reuse of legacy snapshots cut expensive full dumps under limited capacity.
- Protecting user data through source code analysis at scale
Meta Engineering mediumAdeptMeta's Anti-Scraping team encodes known scraping attack vectors as taint-analysis rules in its in-house static analyzers, Zoncolan for Hack and Pysa for Python, so potential vectors are flagged before code ships. Rules define sources (user-controlled parameters such as a result count or target ID) and sinks (data returned to the user), and a possible flow between them is raised as an issue for triage. In a mock followers endpoint, an uncapped count lets scrapers pull entire follower lists in one request and slip past rate limiting. The fix clamps count to a maximum, forcing scrapers into many more requests that rate limits then catch. Static analysis cannot catch scrapers that mimic legitimate usage, so it is one part of a broader defense.
- Schematizing Deletion at Scale
Shopify Engineering mediumAdeptShopify handles PII deletion in a warehouse ingesting tens of billions of events per day by requiring privacy-annotated schemas for every analytical event (4,500+ active schemas) and pseudonymising PII before it lands. A Scrubber on the Kafka pipeline applies irreversible obfuscation, such as masking IPs with geo enrichment or reducing user agents to device and OS families. For data that must stay recoverable, it applies tokenization: a vault issues consistent per-controller, per-subject tokens, so a deletion request only removes the token-to-PII mapping in the vault and never touches the petabyte-scale warehouse. Adoption came from making schematized events the default easy path, proving correctness through reconciliation and stress tests, and adding value like dataset discoverability.