Agent Mesh
Go a2aa2a-protocolagent-meshagentic-aiinferencemcpmeshmesh-networknetwork-securitynetworking-aip2p-network
node: review follow-ups for the router auth dedupe
Antonio Ojea80fb2a6cd19b
diff --git a/cmd/sam-one/main.go b/cmd/sam-one/main.goindex 4e2fae3b..8a859f78 100644--- a/cmd/sam-one/main.go+++ b/cmd/sam-one/main.go@@ -71,16 +71,18 @@ func main() {if os.Getenv("LOG_FORMAT") == "json" {_ = os.Setenv("GOLOG_LOG_FMT", "json")}- golog.SetAllLoggers(golog.LevelInfo)+ lvl := golog.LevelInfoif logLevel != "" {- if lvl, err := golog.LevelFromString(logLevel); err == nil {- golog.SetAllLoggers(lvl)+ if parsed, err := golog.LevelFromString(logLevel); err == nil {+ lvl = parsed}}+ golog.SetAllLoggers(lvl)// Same as sam-node: go-libp2p-kad-dht logs routine small-mesh// conditions (empty routing table, no closer peers) at INFO/ERROR,// the latter through a malformed zap call inside the library.- if logLevel == "" || logLevel == "info" || logLevel == "warn" || logLevel == "error" {+ // Only an explicit debug level keeps them.+ if lvl > golog.LevelDebug {_ = golog.SetLogLevel("dht", "fatal")_ = golog.SetLogLevel("dht/RtRefreshManager", "fatal")}diff --git a/internal/node/router_auth_dedupe_test.go b/internal/node/router_auth_dedupe_test.goindex 69f99ab1..b57bc1c6 100644--- a/internal/node/router_auth_dedupe_test.go+++ b/internal/node/router_auth_dedupe_test.go@@ -131,7 +131,7 @@ func TestStartAuthenticatesEachRouterOnce(t *testing.T) {if err := node.Start(ctx); err != nil {t.Fatalf("Start: %v", err)}- t.Cleanup(func() { _ = node.Host.Close() })+ t.Cleanup(func() { _ = node.Teardown() })if got := handshakes.Load(); got != 1 {t.Fatalf("router saw %d handshakes for %d advertised addresses, want 1", got, len(routerAddrs))diff --git a/internal/storage/sql_store.go b/internal/storage/sql_store.goindex 1dfa850b..d13051c2 100644--- a/internal/storage/sql_store.go+++ b/internal/storage/sql_store.go@@ -464,13 +464,14 @@ func (s *SQLStore) initSchema() error {// logSchemaMigrated reports a migration run in one line; an up-to-date// database says nothing.func logSchemaMigrated(from, to int) {- switch {- case from == to:- case from == 0:+ if from == to {+ return+ }+ if from == 0 {logger.Infof("Initialized database schema at version %d", to)- default:- logger.Infof("Migrated database schema from version %d to %d", from, to)+ return}+ logger.Infof("Migrated database schema from version %d to %d", from, to)}func (s *SQLStore) initSchemaDefault() error {