package main import ( "go/ast" "go/parser" "go/token" "testing" ) // v0.283.0 (decision 50, R-720): the deploy-done hook's SUCCESS branch — the one place a fresh install ends — // calls sett.DefaultOffboxOnForNewApp. The rule itself is pinned in internal/settings/offbox_default_test.go; // this pins that it is reached. // COMPANION RED-PROOF: delete the call from the hook → this test fails. func TestDecision50_DefaultIsWiredIntoTheDeployDoneHook(t *testing.T) { f, err := parser.ParseFile(token.NewFileSet(), "main.go", nil, 0) if err != nil { t.Fatal(err) } found := false ast.Inspect(f, func(n ast.Node) bool { c, ok := n.(*ast.CallExpr) if !ok { return true } if s, ok := c.Fun.(*ast.SelectorExpr); ok && s.Sel.Name == "SetDeployDoneHook" && len(c.Args) == 1 { ast.Inspect(c.Args[0], func(m ast.Node) bool { if cc, ok := m.(*ast.CallExpr); ok { if ss, ok := cc.Fun.(*ast.SelectorExpr); ok && ss.Sel.Name == "DefaultOffboxOnForNewApp" { found = true } } return true }) } return true }) if !found { t.Fatal("the deploy-done hook does not call DefaultOffboxOnForNewApp — a new app would start with off-site OFF (R-720)") } }