feat(api): emit Deprecation/Sunset headers on legacy endpoints#40
Merged
Conversation
Adds RFC 8594 deprecation headers, structured per-request warn logs, and
an admin dashboard banner listing API keys that still hit the legacy
surface. No legacy behaviour changed beyond the additive headers.
Backend:
- middleware.Deprecated(successor, sunset) attaches Deprecation: true,
Sunset, Link rel=successor-version, and Cache-Control: no-store to
every legacy /api/* and legacy WS route.
- Per-request slog.Warn("legacy endpoint hit", method, path,
apiKeyIdent) — apiKeyIdent is the truncated identifier (set by
APIKeyAuth alongside apiKeyID), never the raw key.
- New /api/v1/admin/legacy-usage endpoint returning a 24h aggregate
({method, path, apiKeyIdent, count, lastSeen}) backed by an in-memory
ring buffer; no schema change.
Frontend:
- LegacyUsageBanner reads /api/v1/admin/legacy-usage on the admin
dashboard, polls every 60s, dismissable per session via
sessionStorage. Expandable details table with method, path, API key,
count, last-seen relative time.
Tests: middleware/deprecation_test.go covers header emission and the
ring buffer; legacyusage/handler_test.go covers the aggregate endpoint;
LegacyUsageBanner.test.tsx covers loading, empty, populated, and
dismissed states.
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.
Adds RFC 8594 deprecation headers, structured per-request warn logs, and an admin dashboard banner listing API keys that still hit the legacy surface. Purely additive — no legacy behaviour changes.
Backend
Frontend
Tests
Compatibility
No legacy route behaviour changed. Existing clients see the new response headers and ignore them; functional responses are byte-identical.