Skip to content

fix: derive User-Agent version from pom at build time#72

Open
Gabrielpanga wants to merge 1 commit into
masterfrom
fix/dynamic-user-agent-version
Open

fix: derive User-Agent version from pom at build time#72
Gabrielpanga wants to merge 1 commit into
masterfrom
fix/dynamic-user-agent-version

Conversation

@Gabrielpanga
Copy link
Copy Markdown
Member

Summary

  • The User-Agent header was hardcoded to PluggyJava/0.16.2 in both PluggyClient.authenticate and ApiKeyAuthInterceptor.requestWithAuth, stale against the actual pom version (1.9.0). API-side logs and analytics have been seeing the wrong SDK version.
  • Maven resource filtering now injects ${project.version} into a new pluggy-version.properties at build time. A ai.pluggy.utils.Version utility loads it once and exposes Version.USER_AGENT.
  • User-Agent now resolves to PluggyJava/<version> (Java <java.version>), giving the API visibility into both SDK and consumer JVM.
  • Removed the // TOOD: add dynamic version (sic) note in ApiKeyAuthInterceptor that flagged this exact debt.

Test plan

  • mvn -B test — 6/6 unit tests pass (4 existing + 2 new in VersionTest)
  • mvn -B verify — 39 integration tests pass, 0 failures
  • Verified target/classes/pluggy-version.properties contains version=1.9.0 after build (Maven filtering works as expected)
  • VersionTest.sdkVersion_isResolvedFromPom_notTheLiteralPlaceholder guards against future filtering regressions

The User-Agent header was hardcoded to "PluggyJava/0.16.2" in two places
(PluggyClient.authenticate, ApiKeyAuthInterceptor.requestWithAuth) and
had drifted from the actual pom version (1.9.0). The API logs were seeing
the wrong client version since 0.16.2.

Maven resource filtering now injects ${project.version} into
pluggy-version.properties at build time. A new ai.pluggy.utils.Version
class loads it once and composes the User-Agent as
"PluggyJava/<version> (Java <java.version>)", which also exposes the
consumer's JVM version for support visibility.

The TOOD (sic) comment flagging this exact debt has been removed.
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