Skip to content

Commit 55435ef

Browse files
jope-bmclaude
andcommitted
refactor: Remove deprecation middleware and metrics
Remove deprecation tracking middleware and metrics endpoints as they are not needed for internal API. This simplifies the codebase and removes unnecessary complexity. Changes: - Remove DeprecationMiddleware and DeprecationMetrics from app.py - Remove /management/deprecation-info endpoint - Remove /management/metrics/deprecation endpoint - Clean up imports in app.py 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com> Signed-off-by: Joe P <joe@basicmemory.com>
1 parent 010b0c4 commit 55435ef

2 files changed

Lines changed: 1 addition & 68 deletions

File tree

src/basic_memory/api/app.py

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@
2727
search_router as v2_search,
2828
resource_router as v2_resource,
2929
)
30-
from basic_memory.api.middleware import DeprecationMiddleware, DeprecationMetrics
3130
from basic_memory.config import ConfigManager
3231
from basic_memory.services.initialization import initialize_file_sync, initialize_app
3332

@@ -74,20 +73,7 @@ async def lifespan(app: FastAPI): # pragma: no cover
7473
lifespan=lifespan,
7574
)
7675

77-
# Initialize deprecation metrics for tracking v1/v2 adoption
78-
deprecation_metrics = DeprecationMetrics()
79-
app.state.deprecation_metrics = deprecation_metrics
80-
81-
# Add deprecation middleware for v1 endpoints
82-
# Sunset date: June 30, 2026 (6 months after v2 release)
83-
app.add_middleware(
84-
DeprecationMiddleware,
85-
sunset_date="Tue, 30 Jun 2026 23:59:59 GMT",
86-
metrics=deprecation_metrics,
87-
)
88-
89-
90-
# Include v1 routers (deprecated)
76+
# Include v1 routers
9177
app.include_router(knowledge.router, prefix="/{project}")
9278
app.include_router(memory.router, prefix="/{project}")
9379
app.include_router(resource.router, prefix="/{project}")

src/basic_memory/api/routers/management_router.py

Lines changed: 0 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -78,56 +78,3 @@ async def stop_watch_service(request: Request) -> WatchStatusResponse: # pragma
7878

7979
request.app.state.watch_task = None
8080
return WatchStatusResponse(running=False)
81-
82-
83-
@router.get("/deprecation-info")
84-
async def get_deprecation_info() -> dict:
85-
"""Get information about deprecated API versions.
86-
87-
Returns deprecation timeline, migration guides, and sunset dates.
88-
This endpoint helps clients understand the API migration path from v1 to v2.
89-
"""
90-
return {
91-
"v1": {
92-
"status": "deprecated",
93-
"sunset_date": "2026-06-30T23:59:59Z",
94-
"sunset_date_http": "Tue, 30 Jun 2026 23:59:59 GMT",
95-
"successor": "v2",
96-
"migration_guide": "docs/migration/v1-to-v2.md",
97-
"breaking_changes": [
98-
"Entity identifiers changed from paths to integer IDs",
99-
"URL structure changed from /{project}/endpoint to /v2/{project}/endpoint",
100-
"Memory URLs now support memory://id/{entity_id} format",
101-
"Direct ID lookups replace cascading identifier resolution",
102-
],
103-
"affected_endpoints": [
104-
"/{project}/knowledge/entities/{identifier:path}",
105-
"/{project}/memory/{uri:path}",
106-
"/{project}/search/*",
107-
"/{project}/resource/*",
108-
"/{project}/directory/*",
109-
],
110-
},
111-
"v2": {
112-
"status": "stable",
113-
"release_date": "2025-01-01T00:00:00Z",
114-
"base_url": "/v2/{project}",
115-
"documentation": "https://docs.basic-memory.io/api/v2",
116-
"key_features": [
117-
"ID-based entity references for improved performance",
118-
"Stable identifiers that don't change with file moves",
119-
"Better caching support",
120-
"Identifier resolution endpoint for migration compatibility",
121-
],
122-
},
123-
}
124-
125-
126-
@router.get("/metrics/deprecation")
127-
async def get_deprecation_metrics(request: Request) -> dict:
128-
"""Get v1 API deprecation metrics.
129-
130-
Returns usage statistics for v1 and v2 endpoints to help monitor
131-
the migration progress.
132-
"""
133-
return request.app.state.deprecation_metrics.get_stats()

0 commit comments

Comments
 (0)