From 1ca5fcf2218a0461911412a5eac756e8e78555bb Mon Sep 17 00:00:00 2001 From: Shefeek Jinnah Date: Mon, 2 Mar 2026 10:58:30 +0530 Subject: [PATCH 1/3] fix(http): remove /v1 prefix from newer API routes --- src/http/app_server.rs | 14 +++++++------- tests/http_server_tests.rs | 20 ++++++++++---------- 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/src/http/app_server.rs b/src/http/app_server.rs index 7b0813a..90c3ba0 100644 --- a/src/http/app_server.rs +++ b/src/http/app_server.rs @@ -91,13 +91,13 @@ pub const PATH_SECRET: &str = "/secrets/{name}"; pub const PATH_QUERY_RUNS: &str = "/query-runs"; pub const PATH_RESULTS: &str = "/results"; pub const PATH_RESULT: &str = "/results/{id}"; -pub const PATH_FILES: &str = "/v1/files"; -pub const PATH_DATASETS: &str = "/v1/datasets"; -pub const PATH_DATASET: &str = "/v1/datasets/{id}"; -pub const PATH_SAVED_QUERIES: &str = "/v1/queries"; -pub const PATH_SAVED_QUERY: &str = "/v1/queries/{id}"; -pub const PATH_SAVED_QUERY_VERSIONS: &str = "/v1/queries/{id}/versions"; -pub const PATH_SAVED_QUERY_EXECUTE: &str = "/v1/queries/{id}/execute"; +pub const PATH_FILES: &str = "/files"; +pub const PATH_DATASETS: &str = "/datasets"; +pub const PATH_DATASET: &str = "/datasets/{id}"; +pub const PATH_SAVED_QUERIES: &str = "/queries"; +pub const PATH_SAVED_QUERY: &str = "/queries/{id}"; +pub const PATH_SAVED_QUERY_VERSIONS: &str = "/queries/{id}/versions"; +pub const PATH_SAVED_QUERY_EXECUTE: &str = "/queries/{id}/execute"; impl AppServer { pub fn new(engine: RuntimeEngine) -> Self { diff --git a/tests/http_server_tests.rs b/tests/http_server_tests.rs index 23e6b45..c2b6d00 100644 --- a/tests/http_server_tests.rs +++ b/tests/http_server_tests.rs @@ -1499,7 +1499,7 @@ async fn test_upload_file_endpoint() -> Result<()> { .oneshot( Request::builder() .method("POST") - .uri("/v1/files") + .uri("/files") .header("content-type", "text/csv") .body(Body::from("id,name\n1,test\n2,other"))?, ) @@ -1523,7 +1523,7 @@ async fn test_list_uploads_empty() -> Result<()> { .oneshot( Request::builder() .method("GET") - .uri("/v1/files") + .uri("/files") .body(Body::empty())?, ) .await?; @@ -1553,7 +1553,7 @@ async fn test_list_uploads_after_upload() -> Result<()> { .oneshot( Request::builder() .method("POST") - .uri("/v1/files") + .uri("/files") .header("content-type", "text/csv") .body(Body::from("a,b\n1,2"))?, ) @@ -1565,7 +1565,7 @@ async fn test_list_uploads_after_upload() -> Result<()> { .oneshot( Request::builder() .method("GET") - .uri("/v1/files") + .uri("/files") .body(Body::empty())?, ) .await?; @@ -1588,7 +1588,7 @@ async fn test_upload_file_empty_rejected() -> Result<()> { .oneshot( Request::builder() .method("POST") - .uri("/v1/files") + .uri("/files") .header("content-type", "text/csv") .body(Body::empty())?, ) @@ -1625,7 +1625,7 @@ async fn test_upload_file_too_large() -> Result<()> { .oneshot( Request::builder() .method("POST") - .uri("/v1/files") + .uri("/files") .header("content-type", "text/csv") .body(Body::from("id,name\n1,test"))?, ) @@ -1638,10 +1638,10 @@ async fn test_upload_file_too_large() -> Result<()> { // === Dataset Endpoint Tests === -const PATH_DATASETS: &str = "/v1/datasets"; +const PATH_DATASETS: &str = "/datasets"; fn path_dataset(id: &str) -> String { - format!("/v1/datasets/{}", id) + format!("/datasets/{}", id) } #[tokio::test(flavor = "multi_thread")] @@ -1662,7 +1662,7 @@ async fn test_create_dataset_from_upload() -> Result<()> { .oneshot( Request::builder() .method("POST") - .uri("/v1/files") + .uri("/files") .header("content-type", "text/csv") .body(Body::from(csv_data))?, ) @@ -2077,7 +2077,7 @@ async fn test_upload_consumed_only_once() -> Result<()> { .oneshot( Request::builder() .method("POST") - .uri("/v1/files") + .uri("/files") .header("content-type", "text/csv") .body(Body::from("a,b\n1,2"))?, ) From f775d4b8e63cf8c905f7e035a31fecd48ccf33a9 Mon Sep 17 00:00:00 2001 From: Shefeek Jinnah Date: Mon, 2 Mar 2026 11:25:35 +0530 Subject: [PATCH 2/3] feat(http): add /v1 prefix to all API routes --- src/http/app_server.rs | 42 +++++++++++++++---------------- tests/http_server_tests.rs | 34 ++++++++++++------------- tests/integration_tests.rs | 8 +++--- tests/result_persistence_tests.rs | 10 ++++---- tests/saved_query_tests.rs | 4 +-- 5 files changed, 49 insertions(+), 49 deletions(-) diff --git a/src/http/app_server.rs b/src/http/app_server.rs index 90c3ba0..c26f698 100644 --- a/src/http/app_server.rs +++ b/src/http/app_server.rs @@ -77,27 +77,27 @@ pub struct AppServer { pub engine: Arc, } -pub const PATH_QUERY: &str = "/query"; -pub const PATH_INFORMATION_SCHEMA: &str = "/information_schema"; -pub const PATH_HEALTH: &str = "/health"; -pub const PATH_REFRESH: &str = "/refresh"; -pub const PATH_CONNECTIONS: &str = "/connections"; -pub const PATH_CONNECTION: &str = "/connections/{connection_id}"; -pub const PATH_CONNECTION_HEALTH: &str = "/connections/{connection_id}/health"; -pub const PATH_CONNECTION_CACHE: &str = "/connections/{connection_id}/cache"; -pub const PATH_TABLE_CACHE: &str = "/connections/{connection_id}/tables/{schema}/{table}/cache"; -pub const PATH_SECRETS: &str = "/secrets"; -pub const PATH_SECRET: &str = "/secrets/{name}"; -pub const PATH_QUERY_RUNS: &str = "/query-runs"; -pub const PATH_RESULTS: &str = "/results"; -pub const PATH_RESULT: &str = "/results/{id}"; -pub const PATH_FILES: &str = "/files"; -pub const PATH_DATASETS: &str = "/datasets"; -pub const PATH_DATASET: &str = "/datasets/{id}"; -pub const PATH_SAVED_QUERIES: &str = "/queries"; -pub const PATH_SAVED_QUERY: &str = "/queries/{id}"; -pub const PATH_SAVED_QUERY_VERSIONS: &str = "/queries/{id}/versions"; -pub const PATH_SAVED_QUERY_EXECUTE: &str = "/queries/{id}/execute"; +pub const PATH_QUERY: &str = "/v1/query"; +pub const PATH_INFORMATION_SCHEMA: &str = "/v1/information_schema"; +pub const PATH_HEALTH: &str = "/v1/health"; +pub const PATH_REFRESH: &str = "/v1/refresh"; +pub const PATH_CONNECTIONS: &str = "/v1/connections"; +pub const PATH_CONNECTION: &str = "/v1/connections/{connection_id}"; +pub const PATH_CONNECTION_HEALTH: &str = "/v1/connections/{connection_id}/health"; +pub const PATH_CONNECTION_CACHE: &str = "/v1/connections/{connection_id}/cache"; +pub const PATH_TABLE_CACHE: &str = "/v1/connections/{connection_id}/tables/{schema}/{table}/cache"; +pub const PATH_SECRETS: &str = "/v1/secrets"; +pub const PATH_SECRET: &str = "/v1/secrets/{name}"; +pub const PATH_QUERY_RUNS: &str = "/v1/query-runs"; +pub const PATH_RESULTS: &str = "/v1/results"; +pub const PATH_RESULT: &str = "/v1/results/{id}"; +pub const PATH_FILES: &str = "/v1/files"; +pub const PATH_DATASETS: &str = "/v1/datasets"; +pub const PATH_DATASET: &str = "/v1/datasets/{id}"; +pub const PATH_SAVED_QUERIES: &str = "/v1/queries"; +pub const PATH_SAVED_QUERY: &str = "/v1/queries/{id}"; +pub const PATH_SAVED_QUERY_VERSIONS: &str = "/v1/queries/{id}/versions"; +pub const PATH_SAVED_QUERY_EXECUTE: &str = "/v1/queries/{id}/execute"; impl AppServer { pub fn new(engine: RuntimeEngine) -> Self { diff --git a/tests/http_server_tests.rs b/tests/http_server_tests.rs index c2b6d00..d056a6f 100644 --- a/tests/http_server_tests.rs +++ b/tests/http_server_tests.rs @@ -1499,7 +1499,7 @@ async fn test_upload_file_endpoint() -> Result<()> { .oneshot( Request::builder() .method("POST") - .uri("/files") + .uri("/v1/files") .header("content-type", "text/csv") .body(Body::from("id,name\n1,test\n2,other"))?, ) @@ -1523,7 +1523,7 @@ async fn test_list_uploads_empty() -> Result<()> { .oneshot( Request::builder() .method("GET") - .uri("/files") + .uri("/v1/files") .body(Body::empty())?, ) .await?; @@ -1553,7 +1553,7 @@ async fn test_list_uploads_after_upload() -> Result<()> { .oneshot( Request::builder() .method("POST") - .uri("/files") + .uri("/v1/files") .header("content-type", "text/csv") .body(Body::from("a,b\n1,2"))?, ) @@ -1565,7 +1565,7 @@ async fn test_list_uploads_after_upload() -> Result<()> { .oneshot( Request::builder() .method("GET") - .uri("/files") + .uri("/v1/files") .body(Body::empty())?, ) .await?; @@ -1588,7 +1588,7 @@ async fn test_upload_file_empty_rejected() -> Result<()> { .oneshot( Request::builder() .method("POST") - .uri("/files") + .uri("/v1/files") .header("content-type", "text/csv") .body(Body::empty())?, ) @@ -1625,7 +1625,7 @@ async fn test_upload_file_too_large() -> Result<()> { .oneshot( Request::builder() .method("POST") - .uri("/files") + .uri("/v1/files") .header("content-type", "text/csv") .body(Body::from("id,name\n1,test"))?, ) @@ -1638,10 +1638,10 @@ async fn test_upload_file_too_large() -> Result<()> { // === Dataset Endpoint Tests === -const PATH_DATASETS: &str = "/datasets"; +const PATH_DATASETS: &str = "/v1/datasets"; fn path_dataset(id: &str) -> String { - format!("/datasets/{}", id) + format!("/v1/datasets/{}", id) } #[tokio::test(flavor = "multi_thread")] @@ -1662,7 +1662,7 @@ async fn test_create_dataset_from_upload() -> Result<()> { .oneshot( Request::builder() .method("POST") - .uri("/files") + .uri("/v1/files") .header("content-type", "text/csv") .body(Body::from(csv_data))?, ) @@ -2077,7 +2077,7 @@ async fn test_upload_consumed_only_once() -> Result<()> { .oneshot( Request::builder() .method("POST") - .uri("/files") + .uri("/v1/files") .header("content-type", "text/csv") .body(Body::from("a,b\n1,2"))?, ) @@ -2674,7 +2674,7 @@ async fn test_list_query_runs_empty() -> Result<()> { .oneshot( Request::builder() .method("GET") - .uri("/query-runs") + .uri("/v1/query-runs") .body(Body::empty())?, ) .await?; @@ -2720,7 +2720,7 @@ async fn test_query_run_lifecycle_and_list() -> Result<()> { .oneshot( Request::builder() .method("GET") - .uri("/query-runs?limit=10") + .uri("/v1/query-runs?limit=10") .body(Body::empty())?, ) .await?; @@ -2767,7 +2767,7 @@ async fn test_query_run_failed_query() -> Result<()> { .oneshot( Request::builder() .method("GET") - .uri("/query-runs") + .uri("/v1/query-runs") .body(Body::empty())?, ) .await?; @@ -2810,7 +2810,7 @@ async fn test_query_run_pagination() -> Result<()> { .oneshot( Request::builder() .method("GET") - .uri("/query-runs?limit=2") + .uri("/v1/query-runs?limit=2") .body(Body::empty())?, ) .await?; @@ -2827,7 +2827,7 @@ async fn test_query_run_pagination() -> Result<()> { .oneshot( Request::builder() .method("GET") - .uri(format!("/query-runs?limit=2&cursor={}", next_cursor)) + .uri(format!("/v1/query-runs?limit=2&cursor={}", next_cursor)) .body(Body::empty())?, ) .await?; @@ -2868,7 +2868,7 @@ async fn test_list_query_runs_limit_zero_clamps_to_one() -> Result<()> { .oneshot( Request::builder() .method("GET") - .uri("/query-runs?limit=0") + .uri("/v1/query-runs?limit=0") .body(Body::empty())?, ) .await?; @@ -2893,7 +2893,7 @@ async fn test_list_query_runs_invalid_cursor_returns_400() -> Result<()> { .oneshot( Request::builder() .method("GET") - .uri("/query-runs?cursor=not-valid-base64!!!") + .uri("/v1/query-runs?cursor=not-valid-base64!!!") .body(Body::empty())?, ) .await?; diff --git a/tests/integration_tests.rs b/tests/integration_tests.rs index ebe18b3..6be3201 100644 --- a/tests/integration_tests.rs +++ b/tests/integration_tests.rs @@ -572,7 +572,7 @@ impl TestExecutor for ApiExecutor { async fn get_connection(&self, identifier: &str) -> Option { // For API, identifier is connection_id - let uri = format!("/connections/{}", identifier); + let uri = format!("/v1/connections/{}", identifier); let response = self .router .clone() @@ -600,7 +600,7 @@ impl TestExecutor for ApiExecutor { async fn delete_connection(&self, identifier: &str) -> bool { // For API, identifier is connection_id - let uri = format!("/connections/{}", identifier); + let uri = format!("/v1/connections/{}", identifier); let response = self .router .clone() @@ -618,7 +618,7 @@ impl TestExecutor for ApiExecutor { async fn purge_connection_cache(&self, identifier: &str) -> bool { // For API, identifier is connection_id - let uri = format!("/connections/{}/cache", identifier); + let uri = format!("/v1/connections/{}/cache", identifier); let response = self .router .clone() @@ -637,7 +637,7 @@ impl TestExecutor for ApiExecutor { async fn purge_table_cache(&self, identifier: &str, schema: &str, table: &str) -> bool { // For API, identifier is connection_id let uri = format!( - "/connections/{}/tables/{}/{}/cache", + "/v1/connections/{}/tables/{}/{}/cache", identifier, schema, table ); let response = self diff --git a/tests/result_persistence_tests.rs b/tests/result_persistence_tests.rs index 69f2146..e4d489f 100644 --- a/tests/result_persistence_tests.rs +++ b/tests/result_persistence_tests.rs @@ -466,7 +466,7 @@ async fn wait_for_result_ready( .oneshot( Request::builder() .method("GET") - .uri(format!("/results/{}", result_id)) + .uri(format!("/v1/results/{}", result_id)) .body(Body::empty())?, ) .await?; @@ -843,7 +843,7 @@ async fn test_empty_result_returns_id() -> Result<()> { .oneshot( Request::builder() .method("GET") - .uri(format!("/results/{}", result_id)) + .uri(format!("/v1/results/{}", result_id)) .body(Body::empty())?, ) .await?; @@ -1001,7 +1001,7 @@ async fn test_storage_recovery_after_failure() -> Result<()> { .oneshot( Request::builder() .method("GET") - .uri(format!("/results/{}", result_id2)) + .uri(format!("/v1/results/{}", result_id2)) .body(Body::empty())?, ) .await?; @@ -1258,7 +1258,7 @@ async fn test_different_failure_stages_produce_consistent_status() -> Result<()> .oneshot( Request::builder() .method("GET") - .uri(format!("/results/{}", result_id3)) + .uri(format!("/v1/results/{}", result_id3)) .body(Body::empty())?, ) .await?; @@ -1811,7 +1811,7 @@ async fn test_catalog_finalize_result_failure_marks_result_failed() -> Result<() .oneshot( Request::builder() .method("GET") - .uri(format!("/results/{}", result_id)) + .uri(format!("/v1/results/{}", result_id)) .body(Body::empty())?, ) .await?; diff --git a/tests/saved_query_tests.rs b/tests/saved_query_tests.rs index a001130..0b3e76d 100644 --- a/tests/saved_query_tests.rs +++ b/tests/saved_query_tests.rs @@ -516,7 +516,7 @@ async fn test_query_run_linkage_on_saved_query_execution() -> Result<()> { &router, Request::builder() .method("GET") - .uri("/query-runs?limit=10") + .uri("/v1/query-runs?limit=10") .body(Body::empty())?, ) .await?; @@ -559,7 +559,7 @@ async fn test_ad_hoc_query_run_has_null_linkage() -> Result<()> { &router, Request::builder() .method("GET") - .uri("/query-runs?limit=10") + .uri("/v1/query-runs?limit=10") .body(Body::empty())?, ) .await?; From 5792a51304bf19f1a3d14f704c5d85cb6ea674b8 Mon Sep 17 00:00:00 2001 From: Shefeek Jinnah Date: Mon, 2 Mar 2026 12:42:21 +0530 Subject: [PATCH 3/3] Avoiding v1 from health api --- src/http/app_server.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/http/app_server.rs b/src/http/app_server.rs index c26f698..015d5d0 100644 --- a/src/http/app_server.rs +++ b/src/http/app_server.rs @@ -79,7 +79,7 @@ pub struct AppServer { pub const PATH_QUERY: &str = "/v1/query"; pub const PATH_INFORMATION_SCHEMA: &str = "/v1/information_schema"; -pub const PATH_HEALTH: &str = "/v1/health"; +pub const PATH_HEALTH: &str = "/health"; pub const PATH_REFRESH: &str = "/v1/refresh"; pub const PATH_CONNECTIONS: &str = "/v1/connections"; pub const PATH_CONNECTION: &str = "/v1/connections/{connection_id}";