From 49f0cdc2906e9247257c8c1b1350da37de9d84f6 Mon Sep 17 00:00:00 2001 From: Ian Gulliver Date: Mon, 23 Feb 2026 22:32:46 -0800 Subject: [PATCH] Remove block sort algorithm and per-seed tests --- cmd/qrunproxy/show.go | 2 -- cmd/qrunproxy/timeline.go | 35 +--------------------------------- cmd/qrunproxy/timeline_test.go | 11 ----------- 3 files changed, 1 insertion(+), 47 deletions(-) diff --git a/cmd/qrunproxy/show.go b/cmd/qrunproxy/show.go index 16ebf36..6811750 100644 --- a/cmd/qrunproxy/show.go +++ b/cmd/qrunproxy/show.go @@ -19,8 +19,6 @@ type Block struct { Track string `json:"track,omitempty"` Name string `json:"name"` Loop bool `json:"loop,omitempty"` - - weight uint64 } type Trigger struct { diff --git a/cmd/qrunproxy/timeline.go b/cmd/qrunproxy/timeline.go index 440ebd5..3a7829c 100644 --- a/cmd/qrunproxy/timeline.go +++ b/cmd/qrunproxy/timeline.go @@ -1,7 +1,6 @@ package main import ( - "cmp" "fmt" "io" "slices" @@ -201,7 +200,7 @@ func BuildTimelineDebug(show *Show, debugW io.Writer) (Timeline, error) { tl.Blocks[block.ID] = block } - sortedBlocks := tl.sortBlocks() + sortedBlocks := tl.show.Blocks endChains := map[string]bool{} for _, trigger := range show.Triggers { @@ -225,38 +224,6 @@ func BuildTimelineDebug(show *Show, debugW io.Writer) (Timeline, error) { return tl, nil } -func (tl *Timeline) sortBlocks() []*Block { - cueIdx := 0 - for _, b := range tl.show.Blocks { - if b.Type == "cue" { - b.weight = uint64(cueIdx+1) << 32 - cueIdx++ - } else { - b.weight = 0 - } - } - - changed := true - for changed { - changed = false - for _, t := range tl.show.Triggers { - src := tl.Blocks[t.Source.Block] - for _, target := range t.Targets { - dst := tl.Blocks[target.Block] - if dst.weight <= src.weight { - dst.weight = src.weight + 1 - changed = true - } - } - } - } - - sorted := slices.Clone(tl.show.Blocks) - slices.SortFunc(sorted, func(a, b *Block) int { - return cmp.Compare(a.weight, b.weight) - }) - return sorted -} func (tl *Timeline) addConstraint(kind constraintKind, a, b *TimelineCell) { tl.constraints = append(tl.constraints, constraint{kind: kind, a: a, b: b}) diff --git a/cmd/qrunproxy/timeline_test.go b/cmd/qrunproxy/timeline_test.go index 803f44a..cece91f 100644 --- a/cmd/qrunproxy/timeline_test.go +++ b/cmd/qrunproxy/timeline_test.go @@ -26,17 +26,6 @@ func TestBuildTimelineFromMockShow(t *testing.T) { t.Logf("tracks=%d blocks=%d", len(tl.Tracks), len(tl.Blocks)) } -func TestBuildTimelineSeed11(t *testing.T) { - show := GenerateMockShow(11, 5, 20, 4, 5) - if err := show.Validate(); err != nil { - t.Fatalf("validate: %v", err) - } - _, err := BuildTimeline(show) - if err != nil { - t.Fatalf("BuildTimeline failed: %v", err) - } -} - func BenchmarkBuildTimeline(b *testing.B) { show := GenerateMockShow(42, 5, 20, 4, 5) if err := show.Validate(); err != nil {