Deprecation Window Math: Who Pays for a Longer Notice Period?
Every deprecation has a window: the time between the first warning and the release that removes the old API. A short window is cheap for you and expensive for users who miss it. A long window spreads their upgrade work out but means you keep two code paths alive. This page turns that trade-off into rough arithmetic you can do with your own estimates.
The two sides of the ledger
Maintainer cost of keeping the old path is roughly:
keep_cost = months_open × (hours_per_month_on_shim + hours_per_month_on_related_issues)
The shim hours cover tests for both paths, the adapter code itself and the extra care when refactoring nearby. Issue hours cover questions from users who hit the warning and do not understand it.
User cost avoided by the longer window is harder to see but usually larger:
avoided_cost = users_who_would_miss_short_window × hours_of_unplanned_upgrade_each
Users who notice a warning in time upgrade during normal work. Users who discover the removal when a build breaks upgrade under pressure, often on a deadline, and some of them open issues or pin your old version indefinitely. The longer window does not remove their work; it moves it to a better moment.
A worked comparison (illustrative)
Every number below is an assumption for a hypothetical Package C, not a measurement. Replace them with your own.
| Assumption | 3-month window | 12-month window |
|---|---|---|
| Maintainer hours per month on shim and issues | 2 | 2 |
| Maintainer cost (hours) | 6 | 24 |
| Dependent projects likely to miss the warning | 40 | 10 |
| Unplanned upgrade hours per missed project | 3 | 3 |
| User cost of unplanned upgrades (hours) | 120 | 30 |
| Total hours across the ecosystem | 126 | 54 |
Under these assumptions the longer window costs the maintainer 18 extra hours and saves users about 90. Whether that is worth it depends on whether you count user time at all, which is a values question rather than a math question. Many maintainers of widely used packages decide that they do, because the alternative shows up as their own issue tracker filling up.
Levers that change the numbers
- Better warnings shrink "users who miss it". A warning that names the replacement and the removal version, printed once per process rather than on every call, gets acted on. See writing deprecation warnings.
- A codemod shrinks upgrade hours per user. If the migration is mechanical, a script can turn three hours into minutes, which can justify a shorter window.
- A cheap shim shrinks maintainer cost. If the old API can be a one-line wrapper over the new one, keeping it is nearly free.
- Usage data, where you have it, replaces the guess about how many dependents use the old API. Public code search can give a rough sense for open-source dependents.
Limits
This is a framing tool, not a forecast. It ignores security fixes, which may justify removing an unsafe API quickly regardless of cost, and it treats every user hour as equal. Use it to make the trade-off explicit in a design discussion. The deprecation policy options paper and the comparison of removing versus deprecating cover the policy side.