BLUF
internal/api.Client methods take no context.Context, so an in-flight HTTP request cannot be cancelled or deadlined by the caller. cmdutil.Poll gained an optional PollConfig.Context in the 10DLC foundation work, which makes --wait loops cancellable between attempts — but the request itself still runs to completion.
Why it was deferred
api.Requester has ~110 call sites across cmd/. Changing its method signatures in the 10DLC foundation PR would have made that PR unreviewable, which is exactly what the PR stack exists to prevent. The additive PollConfig.Context covers what PR 4's --wait operations actually need today.
Current state
cmdutil.Poll accepts an optional Context (nil means context.Background()), and the loop selects on ctx.Done() between attempts:
timer := time.NewTimer(cfg.Interval)
select {
case <-ctx.Done():
timer.Stop()
return nil, ctx.Err()
case <-timer.C:
}
So Ctrl-C during a --wait is honored at the next interval boundary, but a request already in flight is not interrupted.
Scope
- Add context-aware methods to
Client, or thread context.Context through the existing ones.
- Migrate the ~110 call sites.
- Extend or replace the
Requester interface.
- Update the mock implementations in
internal/testutil/golden.go and internal/cmdutil/client_seam.go in step.
Worth deciding up front
Whether to change Requester's existing signatures (one large mechanical diff, no lingering dual API) or add parallel …Ctx methods (incremental, but leaves two ways to do the same thing until migration finishes). The first is probably better given this is pre-1.0 and the call sites are mechanical — but it wants a decision before someone starts.
Related
Found while implementing docs/specs/2026-08-12-tendlc-direct-registration-center-design.md. Eight async 10DLC operations in a later PR will use --wait, so this matters more once those land.
BLUF
internal/api.Clientmethods take nocontext.Context, so an in-flight HTTP request cannot be cancelled or deadlined by the caller.cmdutil.Pollgained an optionalPollConfig.Contextin the 10DLC foundation work, which makes--waitloops cancellable between attempts — but the request itself still runs to completion.Why it was deferred
api.Requesterhas ~110 call sites acrosscmd/. Changing its method signatures in the 10DLC foundation PR would have made that PR unreviewable, which is exactly what the PR stack exists to prevent. The additivePollConfig.Contextcovers what PR 4's--waitoperations actually need today.Current state
cmdutil.Pollaccepts an optionalContext(nil meanscontext.Background()), and the loop selects onctx.Done()between attempts:So Ctrl-C during a
--waitis honored at the next interval boundary, but a request already in flight is not interrupted.Scope
Client, or threadcontext.Contextthrough the existing ones.Requesterinterface.internal/testutil/golden.goandinternal/cmdutil/client_seam.goin step.Worth deciding up front
Whether to change
Requester's existing signatures (one large mechanical diff, no lingering dual API) or add parallel…Ctxmethods (incremental, but leaves two ways to do the same thing until migration finishes). The first is probably better given this is pre-1.0 and the call sites are mechanical — but it wants a decision before someone starts.Related
Found while implementing
docs/specs/2026-08-12-tendlc-direct-registration-center-design.md. Eight async 10DLC operations in a later PR will use--wait, so this matters more once those land.