Add deprecation, sunset, and successor headers to FastAPI routes
Add runtime Deprecation, Sunset, and Link headers plus OpenAPI metadata and tracking middleware for deprecated routes.
Run history
Flash-Next IQ3_SDeepSWE · primary · 2026-10-12
- Agent time
- 11m 34s
- Feature checks
- 136 / 137
- Regression checks
- 3,134 / 3,134
Run settings & provenance
- Run ID
- tonight-20261012/fastapi-deprecation-response-hea__qUmcQMZ
- Model
- qwen3.8-flash-next-iq3_s
- Reasoning effort
- medium
- Requested output allowance
- 196,608
- Temperature
- 1.0
- Top p
- 0.95
- Top k
- 20
- Min p
- 0.0
- Presence penalty
- 0.0
- Repetition penalty
- 1.0
- Agent
- OpenCode/Pier
- Runtime
- Strata 0.1.42
- Agent timeout seconds
- 2,700
Timing, delivery & token accounting
- Timing seconds · Agent execution (seconds)
- 693.513478
- Timing seconds · Environment setup (seconds)
- 26.03664
- Timing seconds · Verifier
- 60.93147
- Usage · Input tokens
- 2,222,044
- Usage · Cached tokens
- 2,191,113
- Usage · Output tokens
- 32,615
- Usage · Peak context tokens
- 63,202
- Usage · Steps
- 50
- Usage · Requests
- 51
- Patch · Bytes
- 62,900
- Patch · SHA256
- 54f984444192b80135bf13a922da7c6a23aa482b1f1bd997fcb0b443ab74c10d
- Verification · Status
- official-scored
- Verification · Verifier
- DeepSWE v1.1 official verifier
- Verification · Evidence
- verified campaign state and official verifier result
Published comparisons
Published comparison sources
Published successful attempts using mini-swe-agent on the same task, not matched local runs.
gpt-6-astra · xhigh4/4 passed
Published attempt details
- run attempt
- 1
- outcome
- pass
- passed
- True
- run attempt
- 2
- outcome
- pass
- passed
- True
- run attempt
- 3
- outcome
- pass
- passed
- True
- run attempt
- 4
- outcome
- pass
- passed
- True
claude-opus-5 · max4/4 passed
Published attempt details
- run attempt
- None
- outcome
- pass
- passed
- True
- run attempt
- None
- outcome
- pass
- passed
- True
- run attempt
- None
- outcome
- pass
- passed
- True
- run attempt
- None
- outcome
- pass
- passed
- True
Official assignment
Recorded assignment context
Add runtime Deprecation, Sunset, and Link headers plus OpenAPI metadata and tracking middleware for deprecated routes.
Read the complete brief
FastAPI currently treats deprecated=True as schema metadata only ("deprecated": true) and does not add runtime response signals. Extend routing so clients can reliably detect deprecations from HTTP responses.
Use standards-based headers:
- RFC 8898 Deprecation
- RFC 8594 Sunset
- RFC 8288 Link
Required Features
Feature 1: Basic Deprecation and Sunset
- Any route with
deprecated=Truemust emitDeprecation: true. - Add
sunset: datetime | None. - If
sunsetis set, emitSunsetin RFC 7231 date format. - Emit
x-sunset(ISO 8601) in OpenAPI when present.
Feature 2: Date-Based Deprecation
- Add
deprecation_date: datetime | None. - If set, emit
Deprecation: <RFC 7231 date>(nottrue). deprecation_datetakes precedence overdeprecated=True.- Emit
x-deprecation-date(ISO 8601) in OpenAPI when present.
Feature 3: Successor URL
- Add
successor_url: str | None. - If set, emit
Link: <url>; rel="successor-version". - Support relative or absolute URLs.
- Emit
x-successor-urlin OpenAPI when present.
Feature 4: Tracking Middleware
- Create
DeprecationTrackingMiddlewareinfastapi/middleware/deprecation.py. - Track per-path stats as
{"deprecated_hits": int, "sunset_hits": int}. - Deprecated hits: route has
deprecated=Trueordeprecation_date. - Sunset hits: route has
sunset. - Only track
"http"scopes; skip others (for example, websocket). - Expose
get_stats()(copy semantics) andreset_stats().
Feature 5: Header Preservation and Link Merging
- If response already sets
DeprecationorSunset, preserve it (case-insensitive check). - If response already sets
Link, merge successor link by appending, <new_link>(RFC 8288 style list behavior).
Implementation Constraints
- Add all three parameters (
sunset,deprecation_date,successor_url) everywhere these routing and application APIs are exposed. - The existing
deprecatedparameter must also follow the same propagation and inheritance rules described below (it already exists on routes, routers, andinclude_routercalls; ensure it propagates consistently with the new parameters). - Precedence and inheritance rules (apply independently to
deprecated,sunset,deprecation_date, andsuccessor_url):- Route-level value has highest precedence.
- If a route omits a value, it inherits from the nearest ancestor configuration.
- For included routers,
include_router(...)parameters apply to omitted route values and override the included router's own defaults. - In nested routers, nearest-wins precedence applies (inner router over outer router when both specify a value and the route omits it).
add_api_routeroutes inherit router defaults when route-level values are omitted.FastAPI(...)constructor parameters serve as the outermost defaults and are inherited by all routes and included routers when no closer ancestor provides a value.
IMPORTANT: Please work on this in a new branch from main and commit everything when you are done.