feat: report client version on every PKG and Cryptify request#33
Conversation
Add a ClientVersion helper that reports dotnet,<framework>,pg-dotnet,<version> and inject it on the SDK-owned HttpClient's default headers (covering both PKG and Cryptify). A caller-supplied header (any casing) wins; a bring-your-own HttpClient is never mutated. Version read from AssemblyInformationalVersion (git-hash suffix stripped).
There was a problem hiding this comment.
✅ Review passed — approving.
Code review (Review Dobby): no correctness or style findings. Builds clean on net8.0 + net10.0; 32/32 net10.0 tests pass (7 new). net8.0 test execution skipped — net8.0 runtime not installed in the review workspace (known limitation; CI exercises both TFMs).
Rule compliance: checked against the binding rule set — all clear:
- Conventional-commit PR title (
feat: …) ✓ - Promised-vs-delivered: every claim in the description is backed by the diff (header on SDK-owned client,
+gitHashstrip, case-insensitive caller override, BYO-client non-mutation, 7 new tests) ✓ - No over-justification, no AI-slop tells, README/docs standards untouched ✓
Verified end-to-end that the header lands on the SDK-owned client and a caller override (any casing) wins with no duplicate. Nothing blocking. 🧦
|
Reviewed and approved! All rule checks came back clean — conventional commit title, no over-justification, no AI-slop tells, and the code itself looks solid. Build passed on net8.0+net10.0, and all 32 net10.0 tests are green. You're good to merge. 🟢 |
What
The SDK now sends an
X-POSTGUARD-CLIENT-VERSIONheader (dotnet,<framework>,pg-dotnet,<version>, reused from pg-pkg) on every PKG and Cryptify request, so servers can attribute traffic by SDK + version.ClientVersionhelper: reads the version fromAssemblyInformationalVersion(strips any+<gitHash>suffix; release-please bumps<Version>which feeds it), and the runtime fromRuntimeInformation.FrameworkDescription.HttpClient's default headers (covering bothPkgClientandCryptifyClient, which share it). A caller-supplied header (any casing) wins.HttpClientis not mutated — it may be shared, so the caller owns its headers (documented).Why
We're moving to production and need to know which old SDK versions are in the wild so we don't break them. PKG already parses this header; the SDK just never sent it.
Notes
dotnet teston net10.0: 32 passing (7 new — value format, override precedence incl. case-insensitive, BYO-client non-mutation). net8.0 builds clean; its test host needs the .NET 8 runtime installed to execute.