Description
This PR removes duplicate router registrations in api/main.py for the actions.router and context.router modules to prevent duplicate OpenAPI documentation loading and identical route handling.
Why this is necessary
Currently, actions and context routes are safely wrapped within a try...except block, but are then mistakenly registered a second time directly below the exception handling block.
Registering identical routers multiple times on a single FastAPI instance can cause:
- Duplicate and cluttered endpoint generation in Swagger/Redoc.
- Silent route masking where FastAPI routing resolves against the final registered instance unnecessarily.
- Issues in integration tests that validate API schema definitions.
Changes Made
- Removed duplicate app.include_router(actions.router, prefix="/api/v1")
- Removed duplicate app.include_router(context.router, prefix="/api/v1")
- Preserved router bootstrapping through the existing try...except mechanism
Type of Change
Testing
- Verified Swagger UI displays endpoints without duplication
- Confirmed API boots successfully without crashes
- Ensured route registration behaves correctly after removal of duplicate inclusions
Affected File
Description
This PR removes duplicate router registrations in api/main.py for the actions.router and context.router modules to prevent duplicate OpenAPI documentation loading and identical route handling.
Why this is necessary
Currently, actions and context routes are safely wrapped within a try...except block, but are then mistakenly registered a second time directly below the exception handling block.
Registering identical routers multiple times on a single FastAPI instance can cause:
Changes Made
Type of Change
Testing
Affected File