Before proceeding, is there an existing issue or discussion for this?
OS and version
macOS (local dev), running Kubernetes on Colima + kind
Open-RMF installation type
Docker
Other Open-RMF installation methods
rmf-web/api-server running in container on kind (local test stack)
Open-RMF version or commit hash
rmf-web commit: f33e755 Suspected regression introduced around: 88ab5b5 (routes/beacons.py migration from from_tortoise_orm to model_validate on ORM objects)
ROS distribution
Rolling
ROS installation type
Others
Other ROS installation methods
Containerized runtime inside api-server image
Package or library, if applicable
api-server (routes/beacons.py)
Description of the bug
/beacons endpoints return 500 Internal Server Error when the beaconstate table contains rows.
This appears to be a regression in packages/api-server/api_server/routes/beacons.py, where beacon ORM objects are passed directly to BeaconState.model_validate(...). With real DB rows, this raises a Pydantic validation error.
Affected endpoints:
GET /beacons
GET /beacons/{beacon_id}
Steps to reproduce the bug
- Run
rmf-web api-server with DB backend (Docker deployment is fine).
- Insert at least one row into
beaconstate, for example:
id='beacon_1'
online=true
category='elevator'
activated=true
level='L1'
- Call:
GET /beacons
GET /beacons/beacon_1
Observed result:
- both endpoints return
500.
Relevant runtime error:
ValidationError: Input should be a valid dictionary or instance of BeaconState [input_value=<BeaconState: beacon_1>]
Expected behavior
GET /beacons should return 200 with a list of beacons.
GET /beacons/{beacon_id} should return 200 with the beacon payload.
- No server-side validation exception should occur for valid rows in
beaconstate.
Actual behavior
When the beaconstate table has at least one row:
GET /beacons returns 500 Internal Server Error
GET /beacons/{beacon_id} returns 500 Internal Server Error
Observed traceback (api-server logs):
pydantic_core._pydantic_core.ValidationError: Input should be a valid dictionary or instance of BeaconState [input_value=<BeaconState: beacon_1>, input_type=BeaconState]
This happens in:
packages/api-server/api_server/routes/beacons.py
when calling:
BeaconState.model_validate(db_beacon_row)
Additional information or screenshots
- Affected file:
https://github.com/open-rmf/rmf-web/blob/main/packages/api-server/api_server/routes/beacons.py
- Likely regression introduced around:
88ab5b59e7d93661c7625d4b0ccec08ea36d182e
- Tested affected state on:
f33e755b4d7c111f3b31ecf53e24ba876b9fb595
- Historical note:
older implementation (fd92cb32...) used Tortoise-to-Pydantic conversion (from_tortoise_orm) and did not have this failure mode.
Before proceeding, is there an existing issue or discussion for this?
OS and version
macOS (local dev), running Kubernetes on Colima + kind
Open-RMF installation type
Docker
Other Open-RMF installation methods
rmf-web/api-server running in container on kind (local test stack)
Open-RMF version or commit hash
rmf-web commit: f33e755 Suspected regression introduced around: 88ab5b5 (routes/beacons.py migration from from_tortoise_orm to model_validate on ORM objects)
ROS distribution
Rolling
ROS installation type
Others
Other ROS installation methods
Containerized runtime inside api-server image
Package or library, if applicable
api-server (routes/beacons.py)
Description of the bug
/beaconsendpoints return500 Internal Server Errorwhen thebeaconstatetable contains rows.This appears to be a regression in
packages/api-server/api_server/routes/beacons.py, where beacon ORM objects are passed directly toBeaconState.model_validate(...). With real DB rows, this raises a Pydantic validation error.Affected endpoints:
GET /beaconsGET /beacons/{beacon_id}Steps to reproduce the bug
rmf-webapi-serverwith DB backend (Docker deployment is fine).beaconstate, for example:id='beacon_1'online=truecategory='elevator'activated=truelevel='L1'GET /beaconsGET /beacons/beacon_1Observed result:
500.Relevant runtime error:
ValidationError: Input should be a valid dictionary or instance of BeaconState [input_value=<BeaconState: beacon_1>]Expected behavior
GET /beaconsshould return200with a list of beacons.GET /beacons/{beacon_id}should return200with the beacon payload.beaconstate.Actual behavior
When the
beaconstatetable has at least one row:GET /beaconsreturns500 Internal Server ErrorGET /beacons/{beacon_id}returns500 Internal Server ErrorObserved traceback (api-server logs):
pydantic_core._pydantic_core.ValidationError: Input should be a valid dictionary or instance of BeaconState [input_value=<BeaconState: beacon_1>, input_type=BeaconState]This happens in:
packages/api-server/api_server/routes/beacons.pywhen calling:
BeaconState.model_validate(db_beacon_row)Additional information or screenshots
https://github.com/open-rmf/rmf-web/blob/main/packages/api-server/api_server/routes/beacons.py88ab5b59e7d93661c7625d4b0ccec08ea36d182ef33e755b4d7c111f3b31ecf53e24ba876b9fb595older implementation (
fd92cb32...) used Tortoise-to-Pydantic conversion (from_tortoise_orm) and did not have this failure mode.