From 612b4113d5074c484a8a996a74bbc6e69b51dcf0 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 11 Feb 2026 20:19:32 +0000 Subject: [PATCH 1/2] Initial plan From f7d71f2ee644037a84b84782094a6c323661b1ff Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 11 Feb 2026 20:21:57 +0000 Subject: [PATCH 2/2] Apply code quality and security fixes to task_safe_n_to_1_with_covariates_and_dataframe.py Co-authored-by: bartzbeielstein <32470350+bartzbeielstein@users.noreply.github.com> --- ...fe_n_to_1_with_covariates_and_dataframe.py | 33 ++++++++++--------- 1 file changed, 17 insertions(+), 16 deletions(-) diff --git a/src/spotforecast2_safe/tasks/task_safe_n_to_1_with_covariates_and_dataframe.py b/src/spotforecast2_safe/tasks/task_safe_n_to_1_with_covariates_and_dataframe.py index 3556bfae4..c3306d0ef 100644 --- a/src/spotforecast2_safe/tasks/task_safe_n_to_1_with_covariates_and_dataframe.py +++ b/src/spotforecast2_safe/tasks/task_safe_n_to_1_with_covariates_and_dataframe.py @@ -65,20 +65,21 @@ # - They are defined as a named constant (rather than inline) to make it clear # what is being tuned and to avoid unexplained "magic numbers" in the code. DEFAULT_WEIGHTS: List[float] = [ - 1.0, - 1.0, - -1.0, - -1.0, - 1.0, - -1.0, - 1.0, - 1.0, - 1.0, - -1.0, - 1.0, + 1.0, # Index 0 – weight for forecast component 0 + 1.0, # Index 1 – weight for forecast component 1 + -1.0, # Index 2 – weight for forecast component 2 + -1.0, # Index 3 – weight for forecast component 3 + 1.0, # Index 4 – weight for forecast component 4 + -1.0, # Index 5 – weight for forecast component 5 + 1.0, # Index 6 – weight for forecast component 6 + 1.0, # Index 7 – weight for forecast component 7 + 1.0, # Index 8 – weight for forecast component 8 + -1.0, # Index 9 – weight for forecast component 9 + 1.0, # Index 10 – weight for forecast component 10 ] -warnings.simplefilter("ignore") +warnings.simplefilter("ignore", category=FutureWarning) +warnings.simplefilter("ignore", category=UserWarning) def _mask_latitude(lat: float) -> str: @@ -342,7 +343,7 @@ def n_to_1_with_covariates( >>> print(f"Model Metrics: {metrics}") >>> print(f"Feature Info: {features}") """ - logger = logging.getLogger("task_safe_n_to_1") + logger = logging.getLogger(__name__) # Security: Mask sensitive coordinates immediately (CWE-532, CWE-312) # This prevents raw latitude/longitude from being accessed in logging contexts @@ -428,8 +429,8 @@ def n_to_1_with_covariates( # SECURITY: Do not log any location data (even masked) to avoid CWE-532/CWE-312 # Include only non-sensitive context information in the error message. logger.error( - "Forecasting failed: %s. Estimator: %s", - str(e), + "Forecasting failed during N-to-1 forecasting. Exception type: %s. Estimator: %s", + type(e).__name__, masked_estimator, ) raise @@ -512,7 +513,7 @@ def main( level=logging.INFO if verbose else logging.WARNING, log_dir=log_dir ) else: - logger = logging.getLogger("task_safe_n_to_1") + logger = logging.getLogger(__name__) logger.addHandler(logging.NullHandler()) if weights is None: