Skip to content

In development. Expect rough edges and changes. The source code is not public yet.

Meta Engineering 10 min read Case study mediumAdept

Automating product deprecation

SCARF (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.

Assumes: dependency graphslarge monorepo codebases

Related posts

  • Automating dead code cleanup

    Meta Engineering mediumAdept

    Meta'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.

  • Automating data removal

    Meta Engineering mediumAdept

    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.

  • Protecting user data through source code analysis at scale

    Meta Engineering mediumAdept

    Meta'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.

  • Tale of 'metadpata': the revenge of the supertools

    Zalando Engineering mediumAdept

    A one-character typo turning the "metadata" key into "metadpata" in a YAML config caused Zalando's AWS account-management tool to treat the configuration as "no accounts" and then decommission all accounts. It deleted Route 53 hosted zones and took the shop offline for hours during Cyber Week preparation. The postmortem names such large-scale automation "supertools" and describes the fixes. These include a one-week "scream test" before account deletion using Network ACLs and DNS delegation removal, and manual deletion of low-savings resources. Changes now go through jsonschema and cfn-lint validation in pre-commit hooks and CI, a GitHub bot that requires owner approvals, CloudFormation ChangeSet previews in PRs, and phased rollout through release channels of account categories.

  • Fixit 2: Meta’s next-generation auto-fixing linter

    Meta Engineering mediumAdept

    Fixit 2 is a partial rewrite of Meta's open-source Python auto-fixing linter, built on LibCST so rules can safely suggest and apply code replacements without regex or broken syntax. Compared with Flake8, which only reports line/column, cannot suggest fixes and relies on the stdlib ast module, Fixit 2 adds local in-repo lint rules, hierarchical TOML configuration for monorepos, and an improved CLI and API. A rule takes under a dozen lines with inline VALID/INVALID test cases, and passing a replacement CST node to report() supplies an autofix. Applied broadly, `fixit fix` can also drive codemods across a large codebase while the rule stays in place to catch new occurrences.

The quest for software engineering knowledge.

Look:
Layout: