From 7390cdc426768252842e528c22dfcf20f11f7be1 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=B4me=20Benoit?= Date: Mon, 22 Jun 2026 02:07:11 +0200 Subject: [PATCH] fix(quickadapter): address PR #78-#81 review-comment findings (#90) Consolidates P1/P2 findings from `chatgpt-codex-connector` review comments on PRs #78, #79, #80, #81, and PR #90. Utils.py + label generation: - `_generate_extrema_label` accepts `logger: Logger | None`; the `LabelGenerator` type signature, `generate_label_data` dispatcher, and `QuickAdapterV3.set_freqai_targets` caller propagate the logger. `_generate_extrema_label` has no `F821 logger` undefined-name path. - `register_label_generator` routes the input through `_adapt_label_generator`. The adapter detects the canonical `(dataframe, params, logger)` shape by a positional parameter named `logger` at index 2 (with or without a default); other generators with 2 required positional parameters are wrapped via `functools.wraps` (preserves `__name__`/`__doc__`/`__wrapped__`) to drop the logger argument at dispatch, with defaulted positionals after index 1 left at their defaults. `ValueError` is raised at registration for `*args`, `**kwargs`, keyword-only `logger`, fewer than 2 required positionals, more than 3 required positionals, and 3 required positionals whose third name is not `logger`. - `safe_divide` denominator zero-check uses exact-zero (`denominator_arr != 0.0`); subnormal and satoshi-scale denominators pass the gate, and non-finite division outputs coerce to `fallback` via the post-division finite-mask. Causal label split lookahead: - `QuickAdapterV3.get_label_horizon_candles` recomputes the horizon from the current `label_period_candles` (via `get_label_period_candles`); init omits `label_horizon_candles`, so HPO period updates propagate to the horizon. The regressor's `_optuna_label_params` init likewise omits `label_horizon_candles`. - `QuickAdapterV3.set_freqai_targets` advances `