Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 41 additions & 0 deletions pkg/commands/lab_xatu_cbt_generate_transformation.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"fmt"
"os"
"path/filepath"
"strconv"
"strings"
"sync"

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
}
}
}
}
Loading