From 9a12801500c857edd478898e0b89b1b012607081 Mon Sep 17 00:00:00 2001 From: Chris Baron Date: Thu, 9 Apr 2026 17:28:06 +0000 Subject: [PATCH] refactor: upgrade campfire SDK from v0.14.1 to v0.17.0 (dontguess-a9a) Fix protocol.Init() call sites to handle new 3-value return signature (*Client, *InitResult, error); no behavioral changes. Co-Authored-By: Claude Sonnet 4.6 --- cmd/dontguess/convention_supersede.go | 2 +- cmd/dontguess/convention_supersede_test.go | 2 +- cmd/dontguess/serve.go | 4 ++-- cmd/seller/main.go | 2 +- go.mod | 4 +++- go.sum | 12 ++++++++---- pkg/exchange/init.go | 2 +- pkg/exchange/init_test.go | 6 +++--- pkg/exchange/views_test.go | 4 ++-- 9 files changed, 22 insertions(+), 16 deletions(-) diff --git a/cmd/dontguess/convention_supersede.go b/cmd/dontguess/convention_supersede.go index cadf4bb..55daadf 100644 --- a/cmd/dontguess/convention_supersede.go +++ b/cmd/dontguess/convention_supersede.go @@ -276,7 +276,7 @@ func sendSupersede(payload []byte, campfireID string, client *protocol.Client) ( // Uses CF_HOME env var or ~/.campfire as the campfire home directory. func requireClient() (*protocol.Client, error) { home := cfHome() - client, err := protocol.Init(home) + client, _, err := protocol.Init(home) if err != nil { return nil, fmt.Errorf("initializing campfire client from %s: %w", home, err) } diff --git a/cmd/dontguess/convention_supersede_test.go b/cmd/dontguess/convention_supersede_test.go index b26c029..5772a30 100644 --- a/cmd/dontguess/convention_supersede_test.go +++ b/cmd/dontguess/convention_supersede_test.go @@ -131,7 +131,7 @@ type testAgentResult struct { func testAgent(t *testing.T) *testAgentResult { t.Helper() cfHome := t.TempDir() - client, err := protocol.Init(cfHome) + client, _, err := protocol.Init(cfHome) if err != nil { t.Fatalf("protocol.Init for test agent: %v", err) } diff --git a/cmd/dontguess/serve.go b/cmd/dontguess/serve.go index 0423303..814499c 100644 --- a/cmd/dontguess/serve.go +++ b/cmd/dontguess/serve.go @@ -62,13 +62,13 @@ func runServe(_ *cobra.Command, _ []string) error { // Build two clients via protocol.Init — both share the same identity and store file. // ReadClient subscribes to the campfire; WriteClient sends operator messages. // SDK sync-before-query handles filesystem transport sync automatically. - readClient, err := protocol.Init(cfHome) + readClient, _, err := protocol.Init(cfHome) if err != nil { return fmt.Errorf("protocol.Init (read client): %w", err) } defer readClient.Close() //nolint:errcheck - writeClient, err := protocol.Init(cfHome) + writeClient, _, err := protocol.Init(cfHome) if err != nil { return fmt.Errorf("protocol.Init (write client): %w", err) } diff --git a/cmd/seller/main.go b/cmd/seller/main.go index 9705006..30b73b3 100644 --- a/cmd/seller/main.go +++ b/cmd/seller/main.go @@ -77,7 +77,7 @@ func main() { } // Load or generate seller identity and open store via SDK. - client, err := protocol.Init(cfHome) + client, _, err := protocol.Init(cfHome) if err != nil { log.Fatalf("protocol.Init: %v", err) } diff --git a/go.mod b/go.mod index 3d1be5f..40c1d73 100644 --- a/go.mod +++ b/go.mod @@ -3,12 +3,13 @@ module github.com/campfire-net/dontguess go 1.25.0 require ( - github.com/campfire-net/campfire v0.14.1 + github.com/campfire-net/campfire v0.17.0 github.com/spf13/cobra v1.8.1 ) require ( filippo.io/edwards25519 v1.0.0-rc.1 // indirect + github.com/BurntSushi/toml v1.6.0 // indirect github.com/dustin/go-humanize v1.0.1 // indirect github.com/fxamacker/cbor/v2 v2.9.0 // indirect github.com/google/uuid v1.6.0 // indirect @@ -19,6 +20,7 @@ require ( github.com/spf13/pflag v1.0.5 // indirect github.com/taurusgroup/frost-ed25519 v0.0.0-20210707140332-5abc84a4dba7 // indirect github.com/x448/float16 v0.8.4 // indirect + golang.org/x/crypto v0.41.0 // indirect golang.org/x/exp v0.0.0-20251023183803-a4bb9ffd2546 // indirect golang.org/x/sys v0.37.0 // indirect modernc.org/libc v1.67.6 // indirect diff --git a/go.sum b/go.sum index 5db8d23..5f36286 100644 --- a/go.sum +++ b/go.sum @@ -1,7 +1,9 @@ filippo.io/edwards25519 v1.0.0-rc.1 h1:m0VOOB23frXZvAOK44usCgLWvtsxIoMCTBGJZlpmGfU= filippo.io/edwards25519 v1.0.0-rc.1/go.mod h1:N1IkdkCkiLB6tki+MYJoSx2JTY9NUlxZE7eHn5EwJns= -github.com/campfire-net/campfire v0.14.1 h1:WrhEbnnaHGgaDKr/UXPqJYOveemv5IFkjH3om+GQgAc= -github.com/campfire-net/campfire v0.14.1/go.mod h1:0zytAvc0ukNHXHzuR3iwNyMscd7w+ir4s05lBr61Hlo= +github.com/BurntSushi/toml v1.6.0 h1:dRaEfpa2VI55EwlIW72hMRHdWouJeRF7TPYhI+AUQjk= +github.com/BurntSushi/toml v1.6.0/go.mod h1:ukJfTF/6rtPPRCnwkur4qwRxa8vTRFBF0uk2lLoLwho= +github.com/campfire-net/campfire v0.17.0 h1:8itf6yw3/8S5JklsC3/YcL4XPFAu5hEOEPDdU3bzNvc= +github.com/campfire-net/campfire v0.17.0/go.mod h1:7yy08WJj1VQnA8tcxOnO9QDwmh5K032BtUW8GO9EFeA= github.com/cpuguy83/go-md2man/v2 v2.0.4/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= @@ -37,12 +39,14 @@ github.com/taurusgroup/frost-ed25519 v0.0.0-20210707140332-5abc84a4dba7 h1:hUvSA github.com/taurusgroup/frost-ed25519 v0.0.0-20210707140332-5abc84a4dba7/go.mod h1:HvWEpeV7Nptyy1OAzxcb/DvYOhrFfzMUx0CFrzUgQbg= github.com/x448/float16 v0.8.4 h1:qLwI1I70+NjRFUR3zs1JPUCgaCXSh3SW62uAKT1mSBM= github.com/x448/float16 v0.8.4/go.mod h1:14CWIYCyZA/cWjXOioeEpHeN/83MdbZDRQHoFcYsOfg= +golang.org/x/crypto v0.41.0 h1:WKYxWedPGCTVVl5+WHSSrOBT0O8lx32+zxmHxijgXp4= +golang.org/x/crypto v0.41.0/go.mod h1:pO5AFd7FA68rFak7rOAGVuygIISepHftHnr8dr6+sUc= golang.org/x/exp v0.0.0-20251023183803-a4bb9ffd2546 h1:mgKeJMpvi0yx/sU5GsxQ7p6s2wtOnGAHZWCHUM4KGzY= golang.org/x/exp v0.0.0-20251023183803-a4bb9ffd2546/go.mod h1:j/pmGrbnkbPtQfxEe5D0VQhZC6qKbfKifgD0oM7sR70= golang.org/x/mod v0.29.0 h1:HV8lRxZC4l2cr3Zq1LvtOsi/ThTgWnUk/y64QSs8GwA= golang.org/x/mod v0.29.0/go.mod h1:NyhrlYXJ2H4eJiRy/WDBO6HMqZQ6q9nk4JzS3NuCK+w= -golang.org/x/sync v0.17.0 h1:l60nONMj9l5drqw6jlhIELNv9I0A4OFgRsG9k2oT9Ug= -golang.org/x/sync v0.17.0/go.mod h1:9KTHXmSnoGruLpwFjVSX0lNNA75CykiMECbovNTZqGI= +golang.org/x/sync v0.20.0 h1:e0PTpb7pjO8GAtTs2dQ6jYa5BWYlMuX047Dco/pItO4= +golang.org/x/sync v0.20.0/go.mod h1:9xrNwdLfx4jkKbNva9FpL6vEN7evnE43NNNJQ2LF3+0= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.37.0 h1:fdNQudmxPjkdUTPnLn5mdQv7Zwvbvpaxqs831goi9kQ= golang.org/x/sys v0.37.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks= diff --git a/pkg/exchange/init.go b/pkg/exchange/init.go index 4b663cf..687722d 100644 --- a/pkg/exchange/init.go +++ b/pkg/exchange/init.go @@ -142,7 +142,7 @@ func Init(opts InitOptions) (*Config, *protocol.Client, error) { } // Open or create identity and store via SDK. - client, err := protocol.Init(configDir) + client, _, err := protocol.Init(configDir) if err != nil { return nil, nil, fmt.Errorf("protocol.Init: %w", err) } diff --git a/pkg/exchange/init_test.go b/pkg/exchange/init_test.go index e625f93..3f5f03e 100644 --- a/pkg/exchange/init_test.go +++ b/pkg/exchange/init_test.go @@ -143,7 +143,7 @@ func TestInit_ConventionDeclarationsPromoted(t *testing.T) { }) // Use protocol.Init to open a second client and read messages via SDK. - verifyClient, err := protocol.Init(configDir) + verifyClient, _, err := protocol.Init(configDir) if err != nil { t.Fatalf("protocol.Init for verify: %v", err) } @@ -205,7 +205,7 @@ func TestInit_PutNotDoublePromoted(t *testing.T) { ConventionDir: convDir, }) - verifyClient, err := protocol.Init(configDir) + verifyClient, _, err := protocol.Init(configDir) if err != nil { t.Fatalf("protocol.Init for verify: %v", err) } @@ -323,7 +323,7 @@ func TestInit_MembershipRecorded(t *testing.T) { }) // Use protocol.Init to verify membership via the SDK. - verifyClient, err := protocol.Init(configDir) + verifyClient, _, err := protocol.Init(configDir) if err != nil { t.Fatalf("protocol.Init for verify: %v", err) } diff --git a/pkg/exchange/views_test.go b/pkg/exchange/views_test.go index 09e5603..941cb91 100644 --- a/pkg/exchange/views_test.go +++ b/pkg/exchange/views_test.go @@ -25,7 +25,7 @@ func TestInit_CreatesNamedViews(t *testing.T) { }) // Use protocol.Init to read messages via SDK. - verifyClient, err := protocol.Init(cfHome) + verifyClient, _, err := protocol.Init(cfHome) if err != nil { t.Fatalf("protocol.Init for verify: %v", err) } @@ -78,7 +78,7 @@ func TestEnsureViews_Idempotent(t *testing.T) { }) // Use protocol.Init to get a client; EnsureViews reads via client.Read. - client, err := protocol.Init(cfHome) + client, _, err := protocol.Init(cfHome) if err != nil { t.Fatalf("protocol.Init: %v", err) }