Add RFC 8594 API deprecation headers and sunset policy - #628
Merged
Abdulazeem-code merged 1 commit intoAug 29, 2026
Merged
Conversation
- New deprecation middleware attaches Deprecation, Sunset, Link and Warning headers to endpoints registered in the deprecation registry. - Deprecation registry in src/config/deprecations.js with sunset dates. - Server-side warnings logged (throttled per endpoint). - Unit tests covering header attachment, wildcard matching, logging. Closes Abdulazeem-code#592
|
@Vicistar-V Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
|
@Vicistar-V is attempting to deploy a commit to the Abdulazeem's projects Team on Vercel. A member of the Team first needs to authorize it. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
API consumers currently have no advance warning before endpoints are removed, so breaking changes surprise integrators. This adds an RFC 8594 compliant deprecation mechanism: a middleware that advertises upcoming removals via standard HTTP headers, backed by a config-driven registry, and surfaces usage in server logs.
Changes
src/middleware/deprecation.js(new) — Express middleware that, for any request matching a registered endpoint, sets:Deprecation— HTTP-date the endpoint became deprecated (falls back totrue)Sunset— HTTP-date the endpoint will be removedLink—rel="deprecation"pointing at migration docsWarning— 299 stale/deprecation notice for older clientssrc/config/deprecations.js(new) — central registry. Each entry supportsmethod,path(with*wildcard),deprecatedSince,sunset,replacement, anddocumentation. Three example endpoints are pre-registered (/api/v1/lookup,/api/v1/stats,/api/v1/payments/bulk); adjust dates/targets to real planned removals.server.js—deprecationMiddleware()mounted before the routers so headers apply to every versioned request.deprecation.test.js(new) — 11 unit tests covering header attachment, wildcard matching, method * matching, logging throttle, and date formatting.Acceptance criteria
Example response
HTTP/1.1 200 OK
Deprecation: Sat, 29 Aug 2026 00:00:00 GMT
Sunset: Sun, 28 Feb 2027 00:00:00 GMT
Link: https://docs.stellar-tags.example/deprecations/lookup; rel="deprecation"
Warning: 299 - "Deprecated API endpoint, scheduled for removal Sun, 28 Feb 2027 00:00:00 GMT"
Notes for reviewers
Closes #592