Map a vendor deprecation to the services it hits
Your task
Vendors deprecate API endpoints in changelog posts nobody reads, and you find out when calls start failing. An agent maps each deprecation notice to the services that call the endpoint, and files one ticket per service.
Write map_deprecation_impact(deprecated_endpoint, days_to_sunset, call_sites): the rule your agent follows for each notice.
deprecated_endpoint(str): the endpoint being retired, such as"/v1/payments".days_to_sunset(int): days until it stops working. It may be negative.call_sites(list of str): code search results, each writtenservice|path|endpoint.- Return one ticket line per affected service, written
"<service>|<count>|<severity>", sorted by service name in ascending order.
Rules:
- If
deprecated_endpointis empty: return[]. - Skip a call site that does not split on
|into exactly 3 fields, or that has an empty field. - A call site is affected if its endpoint equals
deprecated_endpointor starts withdeprecated_endpoint + "/". A plain substring does not count:/v1/payments-legacyand/internal/v1/paymentsare not affected by/v1/payments. - Identical call-site lines count once.
- A service's count is how many distinct affected call-site lines it has.
- The severity is
notifyifdays_to_sunsetis 90 or less, otherwisebacklog, the same for every ticket.
Examples
map_deprecation_impact(deprecated_endpoint: str, days_to_sunset: int, call_sites: list[str]) -> list[str]Example 1
Input
map_deprecation_impact("/v1/payments", 30, ["checkout|src/pay.py|/v1/payments", "checkout|src/refund.py|/v1/payments/refund", "billing|jobs/invoice.py|/v1/payments", "search|src/query.py|/v1/search"])Output
["billing|1|notify", "checkout|2|notify"]Example 2
Input
map_deprecation_impact("/v1/payments", 120, ["ledger|src/legacy.py|/v1/payments-legacy/charge", "ledger|src/post.py|/v1/payments/charge"])Output
["ledger|1|backlog"]Example 3
Input
map_deprecation_impact("/v1/search", 45, ["checkout|src/pay.py|/v1/payments"])Output
[]