From 6319f7108a5d1b6db9326aa5914e10e9349b1688 Mon Sep 17 00:00:00 2001 From: Aaron Chong Date: Fri, 20 Feb 2026 11:00:04 +0800 Subject: [PATCH 01/10] use generated pydantic model, fix function calls Signed-off-by: Aaron Chong --- packages/api-server/api_server/models/beacons.py | 10 +++------- packages/api-server/api_server/repositories/rmf.py | 2 +- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/packages/api-server/api_server/models/beacons.py b/packages/api-server/api_server/models/beacons.py index d3ad0bc39..9f4f786bc 100644 --- a/packages/api-server/api_server/models/beacons.py +++ b/packages/api-server/api_server/models/beacons.py @@ -1,9 +1,5 @@ -from pydantic import BaseModel +from pydantic import BaseModel, Field +from .ros_pydantic import rmf_fleet_msgs -class BeaconState(BaseModel): - id: str - online: bool - category: str - activated: bool - level: str +BeaconState = rmf_fleet_msgs.msg.BeaconState diff --git a/packages/api-server/api_server/repositories/rmf.py b/packages/api-server/api_server/repositories/rmf.py index c8256e10f..db55ca0cd 100644 --- a/packages/api-server/api_server/repositories/rmf.py +++ b/packages/api-server/api_server/repositories/rmf.py @@ -116,7 +116,7 @@ async def get_ingestor_state(self, guid: str) -> IngestorState | None: async def save_beacon_state(self, beacon_state: BeaconState) -> None: d = beacon_state.model_dump() del d["id"] - await ttm.BeaconState.update_or_create(d, id_=beacon_state.id) + await ttm.BeaconState.update_or_create(d, id=beacon_state.id) async def query_users( self, From 5f0051b47d03f87d55873dbe39e21ce541ab50ac Mon Sep 17 00:00:00 2001 From: Aaron Chong Date: Fri, 20 Feb 2026 11:56:14 +0800 Subject: [PATCH 02/10] test lines Signed-off-by: Aaron Chong --- packages/api-server/api_server/repositories/rmf.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/packages/api-server/api_server/repositories/rmf.py b/packages/api-server/api_server/repositories/rmf.py index db55ca0cd..9fe227ae1 100644 --- a/packages/api-server/api_server/repositories/rmf.py +++ b/packages/api-server/api_server/repositories/rmf.py @@ -117,6 +117,16 @@ async def save_beacon_state(self, beacon_state: BeaconState) -> None: d = beacon_state.model_dump() del d["id"] await ttm.BeaconState.update_or_create(d, id=beacon_state.id) + print("saved!") + saved_state = await ttm.BeaconState.get_or_none(id=beacon_state.id) + print(saved_state) + beacon_state_pydantic = BeaconState.model_validate(beacon_state) + print(beacon_state_pydantic) + all_states = await ttm.BeaconState.all() + print(all_states) + for state in all_states: + validated = BeaconState.model_validate(state) + print(validated) async def query_users( self, From fee590356c9f6f0d8c16900f436ea15e61d24a50 Mon Sep 17 00:00:00 2001 From: Aaron Chong Date: Fri, 20 Feb 2026 11:56:51 +0800 Subject: [PATCH 03/10] revert test lines Signed-off-by: Aaron Chong --- packages/api-server/api_server/repositories/rmf.py | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/packages/api-server/api_server/repositories/rmf.py b/packages/api-server/api_server/repositories/rmf.py index 9fe227ae1..db55ca0cd 100644 --- a/packages/api-server/api_server/repositories/rmf.py +++ b/packages/api-server/api_server/repositories/rmf.py @@ -117,16 +117,6 @@ async def save_beacon_state(self, beacon_state: BeaconState) -> None: d = beacon_state.model_dump() del d["id"] await ttm.BeaconState.update_or_create(d, id=beacon_state.id) - print("saved!") - saved_state = await ttm.BeaconState.get_or_none(id=beacon_state.id) - print(saved_state) - beacon_state_pydantic = BeaconState.model_validate(beacon_state) - print(beacon_state_pydantic) - all_states = await ttm.BeaconState.all() - print(all_states) - for state in all_states: - validated = BeaconState.model_validate(state) - print(validated) async def query_users( self, From 6699e6cc02feee0acc76a688f8a1fde0d15be136 Mon Sep 17 00:00:00 2001 From: Aaron Chong Date: Fri, 20 Feb 2026 12:03:36 +0800 Subject: [PATCH 04/10] update workflow for build Signed-off-by: Aaron Chong --- .github/actions/bootstrap/action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/actions/bootstrap/action.yml b/.github/actions/bootstrap/action.yml index 7e045a3c1..a853f85d8 100644 --- a/.github/actions/bootstrap/action.yml +++ b/.github/actions/bootstrap/action.yml @@ -16,5 +16,5 @@ runs: shell: bash - name: Build if: '!${{ inputs.skip-build }}' - run: pnpm run --filter ${{ inputs.package }}... build + run: pnpm run --if-present --filter ${{ inputs.package }}... build shell: bash From a6fd69afad15f1a4bf24345b2b7e1708f57705e8 Mon Sep 17 00:00:00 2001 From: Aaron Chong Date: Fri, 20 Feb 2026 12:06:46 +0800 Subject: [PATCH 05/10] use skip-build instead Signed-off-by: Aaron Chong --- .github/actions/bootstrap/action.yml | 2 +- .github/workflows/api-server.yml | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/actions/bootstrap/action.yml b/.github/actions/bootstrap/action.yml index a853f85d8..7e045a3c1 100644 --- a/.github/actions/bootstrap/action.yml +++ b/.github/actions/bootstrap/action.yml @@ -16,5 +16,5 @@ runs: shell: bash - name: Build if: '!${{ inputs.skip-build }}' - run: pnpm run --if-present --filter ${{ inputs.package }}... build + run: pnpm run --filter ${{ inputs.package }}... build shell: bash diff --git a/.github/workflows/api-server.yml b/.github/workflows/api-server.yml index f847cdc62..e939a5e4c 100644 --- a/.github/workflows/api-server.yml +++ b/.github/workflows/api-server.yml @@ -46,6 +46,7 @@ jobs: uses: ./.github/actions/bootstrap with: package: api-server + skip-build: true - name: tests run: | . /opt/ros/${{ matrix.ros_distribution }}/setup.bash From 8d67735193be3f92113fe515db6d3ee23c9bc5f5 Mon Sep 17 00:00:00 2001 From: Aaron Chong Date: Fri, 20 Feb 2026 12:09:00 +0800 Subject: [PATCH 06/10] revert workflow fix Signed-off-by: Aaron Chong --- .github/workflows/api-server.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/api-server.yml b/.github/workflows/api-server.yml index e939a5e4c..f847cdc62 100644 --- a/.github/workflows/api-server.yml +++ b/.github/workflows/api-server.yml @@ -46,7 +46,6 @@ jobs: uses: ./.github/actions/bootstrap with: package: api-server - skip-build: true - name: tests run: | . /opt/ros/${{ matrix.ros_distribution }}/setup.bash From 1962d53a896088200594f4b3294c45c267c62f6e Mon Sep 17 00:00:00 2001 From: Aaron Chong Date: Fri, 20 Feb 2026 12:21:02 +0800 Subject: [PATCH 07/10] fix usage of build flag Signed-off-by: Aaron Chong --- .github/actions/bootstrap/action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/actions/bootstrap/action.yml b/.github/actions/bootstrap/action.yml index 7e045a3c1..cc669619f 100644 --- a/.github/actions/bootstrap/action.yml +++ b/.github/actions/bootstrap/action.yml @@ -15,6 +15,6 @@ runs: run: pnpm install -w --filter ${{ inputs.package }}... shell: bash - name: Build - if: '!${{ inputs.skip-build }}' + if: inputs.skip-build != 'true' run: pnpm run --filter ${{ inputs.package }}... build shell: bash From db41290f30e8647c6f9db2aebcb46555f2646e3b Mon Sep 17 00:00:00 2001 From: Aaron Chong Date: Fri, 20 Feb 2026 12:30:32 +0800 Subject: [PATCH 08/10] properly evaluate boolean Signed-off-by: Aaron Chong --- .github/actions/bootstrap/action.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/actions/bootstrap/action.yml b/.github/actions/bootstrap/action.yml index cc669619f..cc03595fb 100644 --- a/.github/actions/bootstrap/action.yml +++ b/.github/actions/bootstrap/action.yml @@ -7,7 +7,7 @@ inputs: skip-build: description: boolean, if true, skip the build step required: false - default: "false" + default: 'false' runs: using: composite steps: @@ -15,6 +15,6 @@ runs: run: pnpm install -w --filter ${{ inputs.package }}... shell: bash - name: Build - if: inputs.skip-build != 'true' + if: ${{ inputs.skip-build == 'false' }} run: pnpm run --filter ${{ inputs.package }}... build shell: bash From edea8afffa65214c42998a29189e8e3d05099f37 Mon Sep 17 00:00:00 2001 From: Aaron Chong Date: Fri, 20 Feb 2026 12:48:35 +0800 Subject: [PATCH 09/10] use string for input Signed-off-by: Aaron Chong --- .github/workflows/api-server.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/api-server.yml b/.github/workflows/api-server.yml index e939a5e4c..3791fd390 100644 --- a/.github/workflows/api-server.yml +++ b/.github/workflows/api-server.yml @@ -46,7 +46,7 @@ jobs: uses: ./.github/actions/bootstrap with: package: api-server - skip-build: true + skip-build: 'true' - name: tests run: | . /opt/ros/${{ matrix.ros_distribution }}/setup.bash From dde46d3fad161159044e7a0b75ba775129380ea5 Mon Sep 17 00:00:00 2001 From: Aaron Chong Date: Mon, 23 Feb 2026 10:03:23 +0800 Subject: [PATCH 10/10] lint Signed-off-by: Aaron Chong --- packages/api-server/api_server/models/beacons.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/packages/api-server/api_server/models/beacons.py b/packages/api-server/api_server/models/beacons.py index 9f4f786bc..c9c77cd4c 100644 --- a/packages/api-server/api_server/models/beacons.py +++ b/packages/api-server/api_server/models/beacons.py @@ -1,5 +1,3 @@ -from pydantic import BaseModel, Field - from .ros_pydantic import rmf_fleet_msgs BeaconState = rmf_fleet_msgs.msg.BeaconState