| 1 | package schedule |
| 2 | |
| 3 | import "testing" |
| 4 | |
| 5 | func TestCopyHardTierCeiling(t *testing.T) { |
| 6 | s := Step{Role: "copy", Priority: Urgent, Release: "owner"} |
| 7 | strong := metered("strong", 0, glm53) |
| 8 | if d := Decide(in(s, strong)); d.Run { |
| 9 | t.Fatalf("Copy ran strong model: %+v", d) |
| 10 | } |
| 11 | sub := sub("subscription", "claude") |
| 12 | if d := Decide(in(s, sub)); d.Run { |
| 13 | t.Fatalf("Copy ran unclassified subscription: %+v", d) |
| 14 | } |
| 15 | c := metered("standard", 0, glm53, glm52) |
| 16 | if d := Decide(in(s, c)); !d.Run || d.Model != glm52.ID { |
| 17 | t.Fatalf("standard unavailable: %+v", d) |
| 18 | } |
| 19 | c = metered("full", 900000, glm52) |
| 20 | if d := Decide(in(s, c)); d.Run { |
| 21 | t.Fatalf("Copy exceeded spend-derived cheap cap: %+v", d) |
| 22 | } |
| 23 | } |
| 24 | |
| 25 | func TestReviewAvoidsCopyFamily(t *testing.T) { |
| 26 | s := Step{Role: RoleReview, Engineer: &Engineer{ID: "eng", Family: "claude", Families: []string{"codex"}}} |
| 27 | d := Decide(in(s, sub("copy", "codex"), sub("other", "other"))) |
| 28 | if !d.Run || d.Connection != "other" { |
| 29 | t.Fatalf("Copy family labelled independent: %+v", d) |
| 30 | } |
| 31 | } |
| 32 | |
| 33 | func TestCopyKnownSubscriptionTier(t *testing.T) { |
| 34 | m, ok := CopySubscriptionModel("claude", "claude-haiku-5-5") |
| 35 | if !ok || m.Tier != TierCheap { |
| 36 | t.Fatal("known cheap subscription unclassified") |
| 37 | } |
| 38 | c := sub("haiku", "claude") |
| 39 | c.Models = []Model{m} |
| 40 | if d := Decide(in(Step{Role: "copy"}, c)); !d.Run { |
| 41 | t.Fatalf("cheap subscription held: %+v", d) |
| 42 | } |
| 43 | if _, ok := CopySubscriptionModel("claude", "unclassified-next-model"); ok { |
| 44 | t.Fatal("unknown subscription classified") |
| 45 | } |
| 46 | } |
| 47 | |