oficina / equipo Public

Clone
git clone https://amadan.net/oficina/equipo

Plain git — no account needed to clone.

Download

Download this file

1package equipo
2
3import (
4 "strings"
5 "testing"
6
7 "amadan.net/oficina/equipo/internal/wire"
8)
9
10// §16.2: the Usage page's source line names the tier table beside the
11// price table, so the tiers read as Equipo's own judgement.
12func TestUsageTierSource(t *testing.T) {
13 if got := joinSources(priceSource(wire.ProviderTensorX, "tensorx-2026-11-12"), tierSource("tiers-2026-11-12")); got != "TensorX prices taken from the public page on 12 Nov 2026. Model tiers reflect Equipo’s judgement as of 12 Nov 2026." {
14 t.Fatalf("source %q", got)
15 }
16 for _, bad := range []string{"", "tensorx-2026-11-12", "tiers-soon"} {
17 if got := tierSource(bad); got != "" {
18 t.Fatalf("%q: %q", bad, got)
19 }
20 }
21 if got := joinSources(priceSource(wire.ProviderTensorX, "tensorx-2026-11-12"), ""); strings.HasSuffix(got, " ") {
22 t.Fatalf("a trailing space: %q", got)
23 }
24}
25
26// §16.7: a metered step's line names the model it ran on; §16.3: a
27// question that failed model_unavailable says whether its model was
28// unticked or is not answering, never that it moved.
29func TestModelsOnStepsAndQuestions(t *testing.T) {
30 k := wire.Task{ID: "tk", Steps: []wire.Step{{ID: "rv", Specialist: wire.SpecialistReview, Attempt: 1, State: wire.StepDone, Account: "tensorx-1", Model: "moonshotai/kimi-k3"}}, Questions: []wire.Question{{ID: "q", StepID: "rv", Specialist: wire.SpecialistReview, State: wire.QuestionFailed, Reason: wire.ReasonModelUnavailable}}}
31 if line := taskLineOf(k, "p").Steps[0].Line; !strings.Contains(line, "on moonshotai/kimi-k3") {
32 t.Fatalf("step line %q", line)
33 }
34 removed := func(account, model string) (string, bool) { return wire.ProviderTensorX, false }
35 if got := threadOf(k, "p", 0, removed).Items[0].Ended; got != "That model is no longer allowed on this TensorX connection." {
36 t.Fatalf("unticked: %q", got)
37 }
38 allowed := func(account, model string) (string, bool) { return wire.ProviderTensorX, true }
39 if got := threadOf(k, "p", 0, allowed).Items[0].Ended; got != "That model is not answering." {
40 t.Fatalf("not answering: %q", got)
41 }
42 if got := threadOf(k, "p", 0).Items[0].Ended; got != "That model is not answering." {
43 t.Fatalf("no lookup: %q", got)
44 }
45}
46
47// §16.1: a metered row's "Models allowed: 1 of 2" counts the allowed models of
48// those that can be allowed; a model that cannot be is greyed with No
49// price yet; an allowed model the runner marked unhealthy says so; an
50// older runner's row keeps its one model and says why it cannot change.
51func TestModelsRow(t *testing.T) {
52 c := wire.Connection{ID: "cn", Model: "z-ai/glm-5.3", ModelsRevision: 3, ModelsPending: true, Models: []wire.ConnectionModel{
53 {ID: "moonshotai/kimi-k3", Eligible: true, Tier: "strong"},
54 {ID: "vendor/unpriced"},
55 {ID: "z-ai/glm-5.3", Eligible: true, Allowed: true, Applied: true, State: wire.ModelUnhealthy, Tier: "strong"},
56 }}
57 var row connRow
58 modelFacts(&row, c, "Studio")
59 if row.ModelsLine != "Models allowed: 1 of 2" || row.ModelsRevision != 3 || row.Model != "" || !strings.Contains(row.ModelsPending, "Studio") {
60 t.Fatalf("row %+v", row)
61 }
62 if row.Models[1].Eligible || row.Models[1].Note != "Price or tier unavailable" || row.Models[2].Note != "Not answering" || row.Models[0].Tier != "Strong" {
63 t.Fatalf("models %+v", row.Models)
64 }
65 c.ModelsTooOld = true
66 row = connRow{Model: c.Model}
67 modelFacts(&row, c, "Studio")
68 if row.ModelsTooOld == "" || row.ModelsLine != "" || row.Model != "z-ai/glm-5.3" {
69 t.Fatalf("older runner %+v", row)
70 }
71}
72