package main import ( "go/ast" "go/parser" "go/token" "testing" ) // v0.317.0 (`16` ยง4): the agent's same-disk verdict reaches the backup side. A seam built and never wired // has shipped in this repo seven times; this walks main.go for the call AND for the agent call inside it. // COMPANION RED-PROOF: delete the SetDiskJudge block โ†’ "not wired"; replace ac.SameDisk with a constant โ†’ // "never asks the agent". func TestDiskJudge_IsWiredAtStartup(t *testing.T) { f, err := parser.ParseFile(token.NewFileSet(), "main.go", nil, 0) if err != nil { t.Fatal(err) } var judge *ast.CallExpr ast.Inspect(f, func(n ast.Node) bool { if c, ok := n.(*ast.CallExpr); ok { if s, ok := c.Fun.(*ast.SelectorExpr); ok && s.Sel.Name == "SetDiskJudge" { judge = c } } return true }) if judge == nil { t.Fatal("backupMgr.SetDiskJudge is not wired in main.go โ€” Tier-2 would keep the st_dev rule for ever") } asks := false ast.Inspect(judge, func(n ast.Node) bool { if s, ok := n.(*ast.SelectorExpr); ok && s.Sel.Name == "SameDisk" { asks = true } return true }) if !asks { t.Fatal("SetDiskJudge is wired but never asks the agent (no SameDisk call inside it)") } }