From ab2e6352205b9b40c03ad7289239280f4c38b1d7 Mon Sep 17 00:00:00 2001 From: Keegan Carruthers-Smith Date: Mon, 2 Mar 2026 12:48:38 +0200 Subject: [PATCH 1/2] fix/users: remove query for usageStatistics This field was deprecated in March last year and was removed November last year [1]. Before this change any user subcommand just failed. Will be adding some integration smoke tests to catch these sort of issues. Additionally found one place we didn't set Content-Type which Sourcegraph also recently started enforcing. [1]: https://sourcegraph.sourcegraph.com/deepsearch/3e8160f0-e54a-4b0b-b65a-7bd0b78120ae --- cmd/src/users.go | 10 ---------- internal/users/admin.go | 1 + 2 files changed, 1 insertion(+), 10 deletions(-) diff --git a/cmd/src/users.go b/cmd/src/users.go index d02304e005..80d395e2ff 100644 --- a/cmd/src/users.go +++ b/cmd/src/users.go @@ -60,10 +60,6 @@ fragment UserFields on User { email verified } - usageStatistics { - lastActiveTime - lastActiveCodeHostIntegrationTime - } url } ` @@ -77,7 +73,6 @@ type User struct { Nodes []Org } Emails []UserEmail - UsageStatistics UserUsageStatistics URL string } @@ -86,11 +81,6 @@ type UserEmail struct { Verified bool } -type UserUsageStatistics struct { - LastActiveTime string - LastActiveCodeHostIntegrationTime string -} - type SiteUser struct { ID string Username string diff --git a/internal/users/admin.go b/internal/users/admin.go index dad8584989..03a8696bc5 100644 --- a/internal/users/admin.go +++ b/internal/users/admin.go @@ -252,6 +252,7 @@ func (c *Client) GraphQL(token, query string, variables map[string]any, target a if err != nil { return err } + req.Header.Set("Content-Type", "application/json") if token != "" { req.Header.Set("Authorization", fmt.Sprintf("token %s", token)) } else { From 8335573f92947712435c2138ef5a7bc7a54b8428 Mon Sep 17 00:00:00 2001 From: Keegan Carruthers-Smith Date: Mon, 2 Mar 2026 13:38:18 +0200 Subject: [PATCH 2/2] go fmt --- cmd/src/users.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cmd/src/users.go b/cmd/src/users.go index 80d395e2ff..3b915d75e1 100644 --- a/cmd/src/users.go +++ b/cmd/src/users.go @@ -72,8 +72,8 @@ type User struct { Organizations struct { Nodes []Org } - Emails []UserEmail - URL string + Emails []UserEmail + URL string } type UserEmail struct {