fix: report a single semantic version in the user agent - #132
Merged
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #132 +/- ##
==========================================
- Coverage 96.59% 96.55% -0.05%
==========================================
Files 7 6 -1
Lines 294 290 -4
==========================================
- Hits 284 280 -4
Misses 8 8
Partials 2 2 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
simonmarty
marked this pull request as ready for review
August 4, 2026 23:42
simonmarty
previously approved these changes
Aug 4, 2026
SaiTejaKundety
force-pushed
the
fix_version_info
branch
from
August 5, 2026 17:03
d31d953 to
07814d8
Compare
simonmarty
requested changes
Aug 5, 2026
The version was assembled from four separately named constants whose names did not match their contents: VersionNumber held the major and MajorRevisionNumber the minor. They produced a four-component string that matched neither the released git tag nor the version published on pkg.go.dev. Replace them with a single Version constant in MAJOR.MINOR.PATCH form. Also switch from AddUserAgentKey to AddUserAgentKeyValue. AddUserAgentKey sanitizes its entire argument and rewrote the "/" separator to "-", so requests reported "AwsSecretCache-2.2.0" rather than "AwsSecretCache/2.2.0". AddUserAgentKeyValue sanitizes the key and value separately and joins them afterwards, leaving the separator intact. Add tests covering the version format and the User-Agent as sent, the latter read from a request captured at a local endpoint so it verifies the header on the wire rather than the configuration. BREAKING CHANGE: removes the exported VersionNumber, MajorRevisionNumber, MinorRevisionNumber and BugfixRevisionNumber constants. Nothing in this repository referenced them, but they were part of the public API.
SaiTejaKundety
force-pushed
the
fix_version_info
branch
from
August 5, 2026 17:22
07814d8 to
69faf09
Compare
bob2681312
approved these changes
Aug 5, 2026
simonmarty
approved these changes
Aug 5, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Why is this change being made?
The version constant did not match what we actually publish. It was built from four separate constants that produced a four-part string like
2.0.2.0, while every release tag and the pkg.go.dev version are three parts (v2.2.0). The constant names were also misleading:VersionNumberheld the major andMajorRevisionNumberheld the minor.The user agent was sent with the wrong separator.
Newusedmiddleware.AddUserAgentKey, which sanitizes its whole argument and rewrites/to-.What is changing?
Version = "2.2.0"inMAJOR.MINOR.PATCHform.middleware.AddUserAgentKeyValue, which sanitizes the key and value separately and joins them with/, so the separator survives.releaseVersion()anduserAgent(), which existed only to assemble the version from its four parts.secretcache/versionInfo_test.gocovering the version format and the User-Agent as sent.Related Links
Evidence: the SDK's
rulesfunction replaces any character outside its allowlist with-, and/isnot allowed.
AddUserAgentKeysanitizes the whole string, so/becomes-→AwsSecretCache-2.2.0.AddUserAgentKeyValuesanitizes the key and value separately, so when it gets joined withkey + "/" + value, the/survives →AwsSecretCache/2.2.0.Testing
How was this tested?
go build ./...,go vet ./...andgofmtare clean.go test ./secretcache— 39 tests pass, coverage 97.6%. Also passes under-race.AddUserAgentKey, settingVersionto2.2.0.0, and replacing the header instead of appending to it.When testing locally, provide testing artifact(s):
The SDK's own entries are intact in both, confirming our value is appended rather than overwriting the header.
Reviewer notes
Breaking change: this removes the exported
VersionNumber,MajorRevisionNumber,MinorRevisionNumberandBugfixRevisionNumberconstants. Nothing in this repository referenced them and they were not documented in the README, but they were part of the public API. Callers should useVersion.Release note:
Versionstays at2.2.0here, matching the currently published tagv2.2.0. Whoever cuts the next release should bumpVersionto the new tag as part of that release