package geduldh import ( "go/parser" "go/token" "path/filepath" "reflect" "strconv" "strings" "testing" ) func TestComponentBoundary(t *testing.T) { if Component != "geduldh" { t.Fatal("component identity changed") } files, err := filepath.Glob("*.go") if err != nil { t.Fatal(err) } for _, file := range files { if strings.HasSuffix(file, "_test.go") { continue } ast, err := parser.ParseFile(token.NewFileSet(), file, nil, parser.ImportsOnly) if err != nil { t.Fatal(err) } for _, spec := range ast.Imports { path, err := strconv.Unquote(spec.Path.Value) if err != nil { t.Fatal(err) } for _, forbidden := range []string{"pageswiki/internal", "database", "net/http"} { if path == forbidden || strings.HasPrefix(path, forbidden+"/") { t.Errorf("%s imports %s: payload storage must not own metadata, HTTP, authorization or the compatibility facade", file, path) } } } } // Ordinary payload access cannot delete objects or make retention decisions. contract := reflect.TypeFor[Store]() var methods []string for i := 0; i < contract.NumMethod(); i++ { methods = append(methods, contract.Method(i).Name) } if want := []string{"Open", "PutIfAbsent", "Stat", "Verify"}; !reflect.DeepEqual(methods, want) { t.Fatalf("Document Store contract changed: %v", methods) } }