Repository navigation
Expand file tree
/
Copy pathattribution_wiring_test.go
More file actions
54 lines (50 loc) · 1.99 KB
/
Copy pathattribution_wiring_test.go
File metadata and controls
54 lines (50 loc) · 1.99 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
package main
import (
"os"
"strings"
"testing"
"github.com/Agent-Field/codeaf/internal/manual"
)
// Both entry points build their own executor, and a setting honoured at one of
// them is a setting the user cannot trust. The construction sites sit deep
// inside the resident dispatch and the headless run, past a live provider and a
// real store, so this reads the wiring instead: every place that builds a leaf
// loop has to pass the model-name row into its signature.
//
// The resident's site is the constructor table now rather than chat.go — a
// worker is chosen per node, so the choice and the construction moved together —
// and chat.go builds no loop of its own at all. That last part is the invariant
// worth keeping: a second construction site growing back inside the dispatch
// path is exactly how one of these settings gets honoured in one place and not
// the other.
func TestBothExecutorConstructionSitesCarryAttribution(t *testing.T) {
for _, name := range []string{"subharness.go", "run.go"} {
raw, err := os.ReadFile(name)
if err != nil {
t.Fatal(err)
}
source := string(raw)
if strings.Count(source, "exec.NewLinear(") != 1 {
t.Fatalf("%s no longer builds exactly one leaf loop", name)
}
if !strings.Contains(source, "WithAssistedBy(config.AssistedByModelAt(") {
t.Fatalf("%s builds an executor without wiring the model-name row into its signature", name)
}
}
raw, err := os.ReadFile("chat.go")
if err != nil {
t.Fatal(err)
}
if strings.Contains(string(raw), "exec.NewLinear(") {
t.Fatal("chat.go builds a leaf loop of its own again instead of asking the table for one")
}
}
// A capability codeaf has and cannot explain is one the user meets first as a
// surprise in their own git history.
func TestManualExplainsAttribution(t *testing.T) {
for _, term := range []string{"attribution", "attribution.model", "CODEAF_ATTRIBUTION_MODEL", "Assisted-by", "sharing", "CONTRIBUTING"} {
if !manual.Mentions(term) {
t.Fatalf("no manual page mentions %q", term)
}
}
}