fix(server): use axum 0.7 path syntax for :id route params (recording/model delete 404s) - #1510
Open
fallen-pc wants to merge 1 commit into
Open
fix(server): use axum 0.7 path syntax for :id route params (recording/model delete 404s)#1510fallen-pc wants to merge 1 commit into
fallen-pc wants to merge 1 commit into
Conversation
DELETE /api/v1/recording/{id} and DELETE /api/v1/models/{id} returned 404
for every id. The routes were declared with `{id}`, which is the axum 0.8 /
matchit 0.8 capture syntax, but the workspace pins axum 0.7 (0.7.9
resolved), where `{id}` is matched as a literal path segment. No real id
ever matched, so requests fell through to the 404 fallback and never
reached their handlers - visible in the dashboard as recording deletion
failing.
Neither handler can return 404 (both return Json, i.e. HTTP 200), which
confirms the request was never routed.
Changed to `:id` in main.rs (2 live routes) plus model_manager.rs and
recording.rs (3 routes in routers not currently merged, corrected for
consistency).
Verified against a running server:
DELETE /api/v1/recording/does-not-exist-test
before: 404 (empty)
after: 200 {"error":"recording not found","success":false}
GET /api/v1/models/<id>
before: 404
after: 405 (path matches, method not registered)
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
DELETE /api/v1/recording/{id}andDELETE /api/v1/models/{id}return 404 for every id. In the dashboard this shows up as recording deletion in the Training tab silently failing.The routes are declared with
{id}:{param}is the axum 0.8 / matchit 0.8 capture syntax. The workspace pinsaxum = "0.7"(0.7.9inCargo.lock), where captures are:paramand{id}is matched as a literal path segment. So no real id ever matches, the request falls through to the 404 fallback, and the handlers are never reached.Corroborating detail: neither handler is capable of returning 404 - both return
Json<serde_json::Value>, i.e. HTTP 200 with an error body:so a bare 404 can only mean the route did not match.
Fix
{id}->:idin five route declarations:main.rs-/api/v1/models/{id},/api/v1/recording/{id}(both live)model_manager.rs-/api/v1/models/{id}recording.rs-/api/v1/recording/download/{id},/api/v1/recording/{id}The latter three are in routers not currently merged into the app, corrected for consistency so they don't reintroduce the bug if they're mounted later.
The
format!("/api/v1/sites/{site_id}/...")strings invendor_mist_netgear.rsare deliberately untouched - those are Rust format interpolation building outbound URLs, not axum routes.Verification
Built and run locally,
--source esp32:DELETE /api/v1/recording/does-not-exist-test404(empty)200 {"error":"recording not found","success":false}GET /api/v1/models/<id>404405(path matches, method not registered on the live router)cargo build -p wifi-densepose-sensing-serverclean.Note
If the project intends to move to axum 0.8, the inverse change would be needed across the whole crate - this PR aligns the routes with the version currently pinned, which is the smaller and safer of the two.