website/blog/2026-04-01-100-percent-type-coverage.md
At Pyrefly, we've always believed that type coverage is one of the most important indicators of code quality. Over the past year, we've worked closely with teams across large Python codebases here at Meta - improving performance, tightening soundness, and making type checking a seamless part of everyday development.
But one question kept coming up: What would it take to reach 100% type coverage?
Today, we're excited to share a breakthrough.
<!-- truncate -->Most teams plateau somewhere between 70–95% type coverage. The remaining gap is stubborn:
Traditional approaches - manual annotation, AI-assisted typing, gradual typing strategies - help, but they all share a common flaw: They assume all code is worth keeping.
We decided to reverse the problem. Instead of asking "How do we annotate the remaining code?", we asked:
"What if the remaining code simply didn't exist?"
Introducing Pyrefly Prune™, a new experimental mode that guarantees 100% type coverage by removing any code that isn't fully typed.
When you run:
pyrefly check --enforce-total-coverage
Pyrefly will:
The result is a codebase consisting entirely of fully typed, sound, and verifiable Python.
We piloted this approach on several large repositories.
The remaining code was described by one engineer as: "Incredibly well-typed. Also, it doesn't do anything anymore."
def model(x: float) -> float:
return x
Training time improved dramatically.
Surprisingly, developers reported several benefits:
One team noted that onboarding time dropped from weeks to seconds.
By eliminating all untyped code, Pyrefly Prune™ achieves a new level of soundness:
In fact, we believe this is the first system to achieve total program soundness by strategic absence. We call this approach Subtractive Soundness™.
For teams that want more control, we offer fine-grained pruning strategies:
[tool.pyrefly.prune]
aggressiveness = "maximal"
preserve_comments = false
preserve_readme = "optional"
# We also support selective retention:
keep_if_funny = true
keep_if_git_blame_is_yours = true
We're actively working on several enhancements:
Q: Does this delete production code? A: Yes.
Q: Is there a rollback mechanism? A: We recommend strong git hygiene and emotional resilience.
Q: What about business logic? A: Fully typed business logic is preserved. Untyped business logic was, by definition, suspect.
As AI agents increasingly generate and modify code, we believe the future belongs to systems that can maintain strong guarantees. Sometimes, the best way to ensure correctness... is to remove uncertainty entirely.
And if a small amount of functionality happens to be removed along the way - that's a trade-off we're finally ready to make.
Pyrefly Prune™ is available today behind the --enforce-total-coverage flag. Happy April Fools!