Skip to content

feat!: Send product metadata in custom header#62

Merged
liamhughes merged 5 commits into
mainfrom
liamhughes/devex-43-send-product-metadata-from-provider-libraries
May 27, 2026
Merged

feat!: Send product metadata in custom header#62
liamhughes merged 5 commits into
mainfrom
liamhughes/devex-43-send-product-metadata-from-provider-libraries

Conversation

@liamhughes
Copy link
Copy Markdown
Contributor

Background

We want to be able to observe the usage of the OctoToggle service and its different API endpoints over time. For example, if we wish to deprecate an endpoint or know which customers are using a particular version of a provider library.

This PR is the TypeScript (web) equivalent of OctopusDeploy/openfeature-provider-dotnet#52 and OctopusDeploy/openfeature-provider-java#13.

Changes

  • Added ProductMetadata class to clean, validate and contain the consumer provided product name and version values.
    • These values must contain at least one valid character (per RFC 9110). Any invalid characters are silently stripped out.
  • Added ProductMetadata required field to OctopusFeatureConfiguration interface (breaking change).
  • Added version.ts with constant value for the provider version.
    • This will be updated by Release Please at the same time as package.json.
    • Release Please configuration updated to accommodate.
  • Added X-Octopus-Client header to axios config.
    • The value of this header contains:
      • Consumer provided product name.
      • Optionally: consumer provided product version.
      • Hard coded provider library repo name.
      • The provider library's version number.
    • e.g. MyProduct/2024.1.0 openfeature-provider-ts-web/3.0.2

Testing

In addition to automated tests, I have tested against an OctoToggle ephemeral environment.

With product version

Screenshot 2026-05-26 at 15 12 40

Without product version

Screenshot 2026-05-26 at 15 13 02

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds consumer product identification to outbound OctoToggle requests so Octopus can observe client/library usage over time (including endpoint and provider-version adoption), aligning this provider with the .NET and Java implementations referenced in the PR description.

Changes:

  • Introduces ProductMetadata (cleaning + validation) and makes it a required field on OctopusFeatureConfiguration (breaking change).
  • Sends an X-Octopus-Client header on requests, combining consumer product name/version with this library name/version.
  • Adds Release Please manifest/config and a src/version.ts constant to keep provider version in sync with releases.

Reviewed changes

Copilot reviewed 13 out of 13 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
src/version.ts Adds a Release Please-managed provider version constant used in request telemetry.
src/specificationTests/fixtureEvaluationTests.test.ts Updates spec tests to supply required productMetadata.
src/productMetadata.ts Implements cleaning/validation for product name/version per RFC 9110 token chars.
src/productMetadata.test.ts Adds unit tests for cleaning + validation behavior.
src/octopusFeatureProvider.ts Makes productMetadata required in configuration and adjusts provider metadata.
src/octopusFeatureProvider.test.ts Updates tests to pass the new required productMetadata.
src/octopusFeatureClient.ts Adds X-Octopus-Client header construction and sends it via axios.
src/octopusFeatureClient.test.ts Adds tests asserting correct X-Octopus-Client header formatting and sanitization.
src/index.ts Exports ProductMetadata from the public package entrypoint.
release-please-config.json Configures Release Please to also update src/version.ts.
README.md Updates usage example to include ProductMetadata construction.
.release-please-manifest.json Adds Release Please manifest with current version.
.github/workflows/build-test-release.yml Switches Release Please action to use the new config/manifest files.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 32 to 34
metadata = {
name: OctopusFeatureProvider.name,
name: "octopus-ts-web-provider",
};
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

As an aside, I am aligning these between the three libraries.

https://openfeature.dev/specification/sections/providers/#requirement-211

@liamhughes liamhughes marked this pull request as ready for review May 26, 2026 05:47
@liamhughes liamhughes requested a review from a team as a code owner May 26, 2026 05:47
@liamhughes liamhughes merged commit 51822cb into main May 27, 2026
7 checks passed
@liamhughes liamhughes deleted the liamhughes/devex-43-send-product-metadata-from-provider-libraries branch May 27, 2026 22:19
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.

3 participants