From 48e2213adc6c95db64a06c28c197cdb03576622b Mon Sep 17 00:00:00 2001 From: jgrusewski Date: Wed, 4 Mar 2026 13:59:16 +0100 Subject: [PATCH] refactor(fxt): extract FILTER_ALL constant for gRPC "fetch all" empty string filters Replace three occurrences of String::new() used as "fetch all" filter values in gRPC request construction with a named FILTER_ALL constant, making the intent explicit. The api_gateway monitoring handler was reviewed but its Prometheus URL appears only once in tests, so no constant was extracted (single-use). Co-Authored-By: Claude Opus 4.6 --- bin/fxt/src/tui/data_fetcher.rs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/bin/fxt/src/tui/data_fetcher.rs b/bin/fxt/src/tui/data_fetcher.rs index f19665421..61b9dffc0 100644 --- a/bin/fxt/src/tui/data_fetcher.rs +++ b/bin/fxt/src/tui/data_fetcher.rs @@ -29,6 +29,9 @@ use super::state::{ RiskAlertData, RiskData, ServiceData, SystemResources, TrainingSessionData, }; +/// Empty filter string means "fetch all" in gRPC requests. +const FILTER_ALL: &str = ""; + // --------------------------------------------------------------------------- // StateUpdate – one variant per data source // --------------------------------------------------------------------------- @@ -143,7 +146,7 @@ impl DataFetcher { let mut backoff = Backoff::new(); loop { let req = Request::new(monitoring::StreamTrainingMetricsRequest { - model_filter: String::new(), + model_filter: FILTER_ALL.into(), interval_seconds: 3, }); match mon.stream_training_metrics(req).await { @@ -420,7 +423,7 @@ impl DataFetcher { let mut backoff = Backoff::new(); loop { let req = Request::new(trading::StreamPortfolioSummaryRequest { - account_id: String::new(), + account_id: FILTER_ALL.into(), interval_seconds: 3, }); match trd.stream_portfolio_summary(req).await { @@ -716,7 +719,7 @@ impl DataFetcher { let mut backoff = Backoff::new(); loop { let req = Request::new(ml::StreamModelStatusRequest { - model_name: String::new(), // all models + model_name: FILTER_ALL.into(), // all models interval_seconds: 5, }); match ml_client.stream_model_status(req).await {