fix: supertrend Subscribe panics on disabled linearRegression config#2554
Open
rs-assistant wants to merge 1 commit into
Open
fix: supertrend Subscribe panics on disabled linearRegression config#2554rs-assistant wants to merge 1 commit into
rs-assistant wants to merge 1 commit into
Conversation
setupIndicators() nils LinearRegression when window == 0 or the interval is
empty, but Subscribe() dereferenced s.LinearRegression.Interval
unconditionally: a config with
linearRegression:
window: 0
panics with a nil pointer (and an interval-less block panics inside
session.Subscribe on the empty kline interval). Guard both panic paths;
degenerate configs that set an interval with window == 0 keep their
historical (unused) subscription so existing backtest replay inputs are
unchanged.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018hiceFQWejhHyHnLayt1dE
c9s
approved these changes
Jul 17, 2026
Owner
|
build failed |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
setupIndicators()nilsLinearRegressionwhenwindow == 0or the interval is empty, butSubscribe()dereferencess.LinearRegression.Intervalunconditionally.A config like:
panics with a nil-interval subscribe (and a block without an interval panics inside
session.Subscribeon the empty kline interval).Fix
Guard both panic paths in
Subscribe(), consistent with thesetupIndicators()disable semantics. Degenerate configs that set an interval withwindow: 0keep their historical (unused) subscription, so existing backtest replay inputs are unchanged.Tests
Added
TestStrategySubscribe_LinearRegressionNilSafecovering nil block / window-zero block / valid block (separate interval) — the first two panicked before this fix.🤖 Generated with Claude Code
https://claude.ai/code/session_018hiceFQWejhHyHnLayt1dE