Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 9 additions & 5 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -121,11 +121,15 @@ because both were mis-stated here before:
`Topics().GetEntries` throws that header away, which is what `GetEntriesPage` exists
for.

The SDK's generated parsers read a response with `io.ReadAll`, so until it bounds its
own reads (#248) `internal/cmd/sdk_transport.go` hands it a transport that caps JSON and
text bodies at 16 MiB, success and error alike, decompressed, and leaves blobs — which
the SDK streams or caps itself — alone. It sits inside the SDK's own http.Client, so the
SDK's timeout, redirect credential stripping, logging and hooks still apply.
The SDK bounds its own reads: its transport caps JSON and HTML response bodies —
success and error alike, decompressed — at `hey.DefaultMaxResponseBodyBytes` (16 MiB;
`hey.WithMaxResponseBodyBytes` to change it, and there is no opt-out — a zero or
negative value means the default), leaving blobs to the SDK's own streaming and caps.
An oversized *error* response keeps its status: the refusal arrives as the `*hey.Error`
for the status wrapping `hey.ErrResponseTooLarge`, which is why
`internal/threadload/sdk.go` classifies a failed message read by status before size —
an oversized 500 is still systemic and an oversized 404 is still just a missing
message; only an oversized success is `over_limit`.
- **A reply's recipients come from the entry it answers.** `Messages().Get` carries that
entry's `Addressed` (`directly`/`copied`/`blindcopied`), and `recipientsForReplyTo` —
in `internal/cmd/thread_reply.go` for `hey reply`, and in `internal/tui/compose.go` for
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ require (
charm.land/glamour/v2 v2.0.1
charm.land/lipgloss/v2 v2.0.6
github.com/basecamp/actioncable-go v0.0.0-20260821132720-3f7811951537
github.com/basecamp/hey-sdk/go v0.12.0
github.com/basecamp/hey-sdk/go v0.13.0
github.com/charmbracelet/x/ansi v0.11.8
github.com/fsnotify/fsnotify v1.10.1
github.com/gofrs/flock v0.13.0
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,8 @@ github.com/aymerick/douceur v0.2.0 h1:Mv+mAeH1Q+n9Fr+oyamOlAkUNPWPlA8PPGR0QAaYuP
github.com/aymerick/douceur v0.2.0/go.mod h1:wlT5vV2O3h55X9m7iVYN0TBM0NH/MmbLnd30/FjWUq4=
github.com/basecamp/actioncable-go v0.0.0-20260821132720-3f7811951537 h1:OE1VMvKkpI+Vo7aP5IDRG6PNXW2IVMlLUWLgBcybGNc=
github.com/basecamp/actioncable-go v0.0.0-20260821132720-3f7811951537/go.mod h1:9+DEydJMniIKraEsd4fDJpFEnqlLUJ6XhAswxRBaITk=
github.com/basecamp/hey-sdk/go v0.12.0 h1:ZOe3hQmuCeJcUGC0qptyRHXiy0fJ4Cyh5tk/buO8SY4=
github.com/basecamp/hey-sdk/go v0.12.0/go.mod h1:k6sO2XhMkU3UY8lD2ozp0735Ic3q8xoMQt7YUT3TlYk=
github.com/basecamp/hey-sdk/go v0.13.0 h1:aQbU/TJp1AeYTLZhAjXQv1VVHrzmrYAE7lVS9TD5D8o=
github.com/basecamp/hey-sdk/go v0.13.0/go.mod h1:k6sO2XhMkU3UY8lD2ozp0735Ic3q8xoMQt7YUT3TlYk=
github.com/blang/semver v3.5.1+incompatible h1:cQNTCjp13qL8KC3Nbxr/y2Bqb63oX6wdnnjpJbkM4JQ=
github.com/blang/semver v3.5.1+incompatible/go.mod h1:kRBLl5iJ+tD4TcOOxsy/0fnwebNt5EWlYSAyrTnjyyk=
github.com/bmatcuk/doublestar v1.1.1/go.mod h1:UD6OnuiIn0yFxxA2le/rnRU1G4RaI4UvFv1sNto9p6w=
Expand Down
1 change: 0 additions & 1 deletion internal/cmd/sdk.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,6 @@ func initSDK(authMgr *auth.Manager, baseURL string) {
var opts []hey.ClientOption
opts = append(opts, hey.WithAuthStrategy(&cliAuthStrategy{mgr: authMgr}))
opts = append(opts, hey.WithUserAgent(version.UserAgent()+" "+hey.DefaultUserAgent))
opts = append(opts, hey.WithTransport(newCappedTransport(maxTextResponseBytes)))

if verboseFlag > 0 {
opts = append(opts, hey.WithLogger(slog.New(slog.NewTextHandler(os.Stderr, &slog.HandlerOptions{Level: slog.LevelDebug}))))
Expand Down
142 changes: 0 additions & 142 deletions internal/cmd/sdk_transport.go

This file was deleted.

181 changes: 0 additions & 181 deletions internal/cmd/sdk_transport_test.go

This file was deleted.

4 changes: 3 additions & 1 deletion internal/cmd/thread_partial_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ import (
"sync"
"testing"

hey "github.com/basecamp/hey-sdk/go/pkg/hey"

"github.com/basecamp/hey-cli/internal/apierr"
"github.com/basecamp/hey-cli/internal/threadload"
)
Expand Down Expand Up @@ -386,7 +388,7 @@ func TestThreadsMarkAnOversizedMessageOverLimit(t *testing.T) {
reads.mu.Lock()
reads.messages++
reads.mu.Unlock()
w.Header().Set("Content-Length", strconv.FormatInt(maxTextResponseBytes+1, 10))
w.Header().Set("Content-Length", strconv.FormatInt(hey.DefaultMaxResponseBodyBytes+1, 10))
w.WriteHeader(http.StatusOK)
_, _ = io.WriteString(w, `{"id":12,"content":"`)
default:
Expand Down
Loading
Loading