Skip to content

fix: Resolve client version at runtime from pom.xml - #200

Open
i-am-SR wants to merge 2 commits into
v2from
userAgent
Open

fix: Resolve client version at runtime from pom.xml#200
i-am-SR wants to merge 2 commits into
v2from
userAgent

Conversation

@i-am-SR

@i-am-SR i-am-SR commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

Description

Why is this change being made?

  1. The library version was maintained in two places: pom.xml (2.2.0) and a hardcoded constant in VersionInfo (2.1.0). They had already drifted, so the SDK UserAgent header reported a stale version (AwsSecretCache/2.1.0), causing version misreporting in Secrets Manager service logs.
  2. When adding its UserAgent suffix, the client overwrote any caller-provided USER_AGENT_SUFFIX on the SecretsManagerClientBuilder, discarding the upstream caller's UserAgent instead of preserving it.

What is changing?

  1. pom.xml is now the single source of truth for the version. A Maven-filtered version.properties resource (version=${project.version}) is read at runtime by VersionInfo, with a safe unknown fallback that never throws.
  2. The builder-based constructor now appends the caching identifier while preserving the caller's suffix: <caller-suffix> AwsSecretCache/<version>.
  3. README.md install snippet no longer hardcodes a version, it points to Maven Central.

Related Links

  • Issue #, if available: N/A

Testing

How was this tested?

  1. unit testing withmvn clean test : BUILD SUCCESS, 46 tests, 0 failures;
  2. New unit tests cover version resolution and all fallback paths

When testing locally, provide testing artifact(s):

  1. Tests run: 46, Failures: 0, Errors: 0, Skipped: 0

Reviewee Checklist

Update the checklist after submitting the PR

  • I have reviewed, tested and understand all changes
    If not, why:
  • I have filled out the Description and Testing sections above
    If not, why:
  • Build and Unit tests are passing
    If not, why:
  • Unit test coverage check is passing
    If not, why:
  • I have ensured no sensitive information is leaking (i.e., no logging of sensitive fields, or otherwise)
    If not, why:
  • I have added explanatory comments for complex logic, new classes/methods and new tests
    If not, why:
  • I have updated README/documentation (if needed)
    If not, why:
  • I have clearly called out breaking changes (if any)
    If not, why:

Reviewer Checklist

All reviewers please ensure the following are true before reviewing:

  • Reviewee checklist has been accurately filled out
  • Code changes align with stated purpose in description
  • Test coverage adequately validates the changes

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@i-am-SR
i-am-SR requested a review from a team as a code owner August 3, 2026 21:24
@codecov

codecov Bot commented Aug 3, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 96.87500% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 94.42%. Comparing base (dc47d68) to head (d62d4c1).

Files with missing lines Patch % Lines
...etsmanager/caching/cache/internal/VersionInfo.java 95.00% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##                 v2     #200      +/-   ##
============================================
+ Coverage     91.83%   94.42%   +2.58%     
- Complexity       97      108      +11     
============================================
  Files             6        7       +1     
  Lines           245      269      +24     
  Branches         26       29       +3     
============================================
+ Hits            225      254      +29     
+ Misses           18       12       -6     
- Partials          2        3       +1     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant