From f3013c8509169247e4ce2a44b5f1124487183568 Mon Sep 17 00:00:00 2001 From: Accusys Date: Sun, 18 Oct 2026 09:23:49 +0800 Subject: [PATCH] feat: add /api/v1/trace-profile-file endpoint - Added endpoint to serve trace_profile.json files - Fixes Studio proxy bug (missing file_uuid in path) - Studio proxy at proxy.rs:809 constructs path without file_uuid - Core endpoint now provides correct implementation - Studio can proxy to this endpoint instead of local file reading --- src/api/trace_agent_api.rs | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/src/api/trace_agent_api.rs b/src/api/trace_agent_api.rs index 1225d2af..c1d40564 100644 --- a/src/api/trace_agent_api.rs +++ b/src/api/trace_agent_api.rs @@ -70,6 +70,10 @@ pub fn trace_agent_routes() -> Router { "/api/v1/file/:file_uuid/trace/:trace_id/regenerate-thumbnail", post(regenerate_trace_thumbnail), ) + .route( + "/api/v1/trace-profile-file", + get(get_trace_profile_file), + ) } #[derive(Debug, Deserialize)] @@ -2729,3 +2733,23 @@ fn read_trace_profile(file_uuid: &str, trace_id: i32) -> Option>, +) -> impl IntoResponse { + let file_uuid = match params.get("file_uuid") { + Some(v) => v.clone(), + None => return (StatusCode::BAD_REQUEST, Json(serde_json::json!({"error": "Missing file_uuid"}))), + }; + let trace_id: i32 = match params.get("trace_id").and_then(|v| v.parse().ok()) { + Some(v) => v, + None => return (StatusCode::BAD_REQUEST, Json(serde_json::json!({"error": "Missing or invalid trace_id"}))), + }; + + match read_trace_profile(&file_uuid, trace_id) { + Some(profile) => (StatusCode::OK, Json(profile)), + None => (StatusCode::NOT_FOUND, Json(serde_json::json!({"error": "Trace profile file not found", "file_uuid": file_uuid, "trace_id": trace_id}))), + } +}