From c3997120c51fd153b99bd17ed329309cab98679c Mon Sep 17 00:00:00 2001 From: Sam Calder-Mason Date: Tue, 23 Jun 2026 10:12:16 +1000 Subject: [PATCH] feat(generate-transformation-test): honor explicit --from/--to range The --from/--to flags were documented and parsed but never consumed; range discovery always anchored a duration-sized window at the head of available data. That makes it impossible to seed tests for sparse historical events (e.g. Rocket Pool minipool/megapool creations) which never fall in a recent window. Apply the explicit window over the discovered range when supplied: numeric bounds map to block/slot/epoch strategies, others to time strategies, so mixed-axis models keep their heuristic value on the non-overridden axis. --- .../lab_xatu_cbt_generate_transformation.go | 41 +++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/pkg/commands/lab_xatu_cbt_generate_transformation.go b/pkg/commands/lab_xatu_cbt_generate_transformation.go index 564e36d..92ad682 100644 --- a/pkg/commands/lab_xatu_cbt_generate_transformation.go +++ b/pkg/commands/lab_xatu_cbt_generate_transformation.go @@ -5,6 +5,7 @@ import ( "fmt" "os" "path/filepath" + "strconv" "strings" "sync" @@ -152,6 +153,8 @@ func runGenerateTransformationTest( // Extract options for easier access model := opts.model network := opts.network + from := opts.from + to := opts.to duration := opts.duration upload := opts.upload aiAssertions := opts.aiAssertions @@ -411,6 +414,14 @@ func runGenerateTransformationTest( } } + // Apply an explicit --from/--to window over the discovered range, if the + // user supplied one. Discovery anchors a duration-sized window at the head + // of available data, which cannot capture sparse historical events. + if from != "" && to != "" { + applyExplicitRange(discoveryResult, from, to) + ui.Info(fmt.Sprintf("Applied explicit range override: %s → %s", from, to)) + } + // Validate that Claude's strategies cover all expected models // This catches cases where Claude named a model differently var missingModels []string @@ -1415,3 +1426,33 @@ func runSingleModelGeneration( return nil } + +// applyExplicitRange overrides the discovered range with an explicit +// user-supplied window. Numeric bounds are applied to block/slot/epoch +// strategies; non-numeric bounds are applied to time strategies. Only +// strategies whose column type matches the bound kind are overridden, so +// mixed-axis models keep their heuristic value on the non-overridden axis. +func applyExplicitRange(result *seeddata.DiscoveryResult, from, to string) { + _, parseErr := strconv.ParseInt(from, 10, 64) + isNumeric := parseErr == nil + + result.FromValue = from + result.ToValue = to + + for i := range result.Strategies { + strategy := &result.Strategies[i] + + switch strategy.ColumnType { + case seeddata.RangeColumnTypeBlock, seeddata.RangeColumnTypeSlot, seeddata.RangeColumnTypeEpoch: + if isNumeric { + strategy.FromValue = from + strategy.ToValue = to + } + case seeddata.RangeColumnTypeTime: + if !isNumeric { + strategy.FromValue = from + strategy.ToValue = to + } + } + } +}