Skip to content

feat: report client version on every PKG and Cryptify request#33

Merged
rubenhensen merged 1 commit into
mainfrom
feat/client-version-header
Jun 19, 2026
Merged

feat: report client version on every PKG and Cryptify request#33
rubenhensen merged 1 commit into
mainfrom
feat/client-version-header

Conversation

@rubenhensen

Copy link
Copy Markdown
Contributor

What

The SDK now sends an X-POSTGUARD-CLIENT-VERSION header (dotnet,<framework>,pg-dotnet,<version>, reused from pg-pkg) on every PKG and Cryptify request, so servers can attribute traffic by SDK + version.

  • New ClientVersion helper: reads the version from AssemblyInformationalVersion (strips any +<gitHash> suffix; release-please bumps <Version> which feeds it), and the runtime from RuntimeInformation.FrameworkDescription.
  • Injected once on the SDK-owned HttpClient's default headers (covering both PkgClient and CryptifyClient, which share it). A caller-supplied header (any casing) wins.
  • A bring-your-own HttpClient is 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 test on 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.

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).

@dobby-coder dobby-coder Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

✅ 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, +gitHash strip, 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. 🧦

@dobby-coder

dobby-coder Bot commented Jun 15, 2026

Copy link
Copy Markdown
Contributor

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. 🟢

@rubenhensen rubenhensen merged commit 23eeb00 into main Jun 19, 2026
2 checks passed
@rubenhensen rubenhensen deleted the feat/client-version-header branch June 19, 2026 11:52
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