Skip to content

Send combined CLI and SDK versions in API user agent#400

Merged
jeremy merged 1 commit intomainfrom
patch-cli-user-agent
Mar 30, 2026
Merged

Send combined CLI and SDK versions in API user agent#400
jeremy merged 1 commit intomainfrom
patch-cli-user-agent

Conversation

@robzolkos
Copy link
Copy Markdown
Collaborator

@robzolkos robzolkos commented Mar 30, 2026

Summary

This updates the Basecamp CLI to send a combined User-Agent so BC3 can identify and log the CLI version alongside the Go SDK and API revision. Today CLI requests inherit the SDK default user agent, which means BC3 logs show the SDK version but not that the traffic came from the CLI itself.

Before, the API saw:

basecamp-sdk-go/0.7.2 (api:2026-01-26)

After, it sees:

basecamp-cli/<cli-version> (https://github.com/basecamp/basecamp-cli) basecamp-sdk-go/0.7.2 (api:2026-01-26)

This change:

  • makes the CLI the primary client identity in BC3 logs
  • preserves the SDK version and API revision for debugging
  • adds coverage to ensure NewApp configures the combined user agent consistently

Summary by cubic

Send a combined CLI+SDK User-Agent on all API requests so BC3 can identify CLI traffic and version while preserving the Go SDK version and API revision. Example: basecamp-cli/ (...) basecamp-sdk-go/0.7.2 (api:2026-01-26).

  • New Features
    • Set User-Agent in NewApp via basecamp.WithUserAgent(version.UserAgent()+" "+basecamp.DefaultUserAgent).
    • Added TestNewAppSetsCombinedUserAgent to verify the combined header and token against a test server.

Written for commit 609671f. Summary will update on new commits.

Copilot AI review requested due to automatic review settings March 30, 2026 13:17
@github-actions github-actions bot added tests Tests (unit and e2e) enhancement New feature or request labels Mar 30, 2026
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the Basecamp CLI’s SDK client initialization so API requests send a combined User-Agent that identifies the CLI first while still including the Go SDK version and API revision for server-side logging and debugging.

Changes:

  • Configure the Basecamp SDK client in NewApp to use version.UserAgent() + " " + basecamp.DefaultUserAgent.
  • Add an HTTP integration-style test to verify the User-Agent (and auth header) applied to outbound SDK requests.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
internal/appctx/context.go Sets a combined CLI+SDK User-Agent when constructing the shared SDK client in NewApp.
internal/appctx/context_test.go Adds coverage asserting NewApp results in requests carrying the combined User-Agent (and expected Authorization).

Tip

If you aren't ready for review, convert to a draft PR.
Click "Convert to draft" or run gh pr ready --undo.
Click "Ready for review" or run gh pr ready to reengage.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 2 files

@jeremy jeremy merged commit 2462678 into main Mar 30, 2026
30 checks passed
@jeremy jeremy deleted the patch-cli-user-agent branch March 30, 2026 19:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request tests Tests (unit and e2e)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants