Skip to content

feat(flagd): populate flag metadata - #391

Open
maisonsmart28-lang wants to merge 4 commits into
open-feature:mainfrom
maisonsmart28-lang:patch-1
Open

maisonsmart28-lang wants to merge 4 commits into
open-feature:mainfrom
maisonsmart28-lang:patch-1

Conversation

@maisonsmart28-lang

Copy link
Copy Markdown

Summary of Changes

flagd returns flag metadata in every evaluation response, but the provider always set flag_metadata to nil.

  • process_request now converts the response's metadata Struct to a Hash and returns it as flag_metadata. When flagd sends no metadata, it returns an empty Hash.
  • error_response returns an empty Hash instead of nil, so callers and hooks always get a Hash.
  • The cucumber run now includes the testbed's metadata.feature, with steps for "the resolved metadata should contain" and "the resolved metadata is empty". The two @metadata-provider scenarios use a selector, so they stay excluded until selector support (feat(flagd): add selector support #365) lands.

Numbers in a protobuf Struct are doubles, so an integer value such as 1 comes back as 1.0. This matches what Struct#to_h already does for object flag values. The metadata step compares with include, where 1 == 1.0.

Fixes #361

Type of Change

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update

Testing

Added three specs to client_spec.rb that call process_request with a ResolveBooleanResponse: metadata present, metadata absent, and a GRPC::NotFound error.

What I checked: I could not install the gems or run Docker in my environment, so I have not run rspec, rubocop or the e2e suite. I checked the changed Ruby files with ruby -c. I also ran process_request against small stand-ins for the gRPC and protobuf classes, which gave the expected Hash, {} and {} for the three cases. CI will be the first real run of the specs and of metadata.feature.

Checklist

  • Tests pass (bundle exec rspec) (not run locally, see above)
  • Linter passes (bundle exec rubocop) (not run locally)
  • PR title follows Conventional Commits
  • Commits are signed off (DCO: git commit -s)

🤖 Generated with Claude Code

https://claude.ai/code/session_01Ng8L4fkcy7Uzkq3wYPTmMs

Convert the metadata Struct in flagd responses to a Hash and return it as flag_metadata; use an empty Hash when there is none and for errors.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Ng8L4fkcy7Uzkq3wYPTmMs

Signed-off-by: maisonsmart28-lang <maison.smart28@gmail.com>
Add the steps for metadata.feature and include it in the cucumber run. The @metadata-provider scenarios need selector support and stay excluded.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Ng8L4fkcy7Uzkq3wYPTmMs

Signed-off-by: maisonsmart28-lang <maison.smart28@gmail.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Ng8L4fkcy7Uzkq3wYPTmMs

Signed-off-by: maisonsmart28-lang <maison.smart28@gmail.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Ng8L4fkcy7Uzkq3wYPTmMs

Signed-off-by: maisonsmart28-lang <maison.smart28@gmail.com>
@maisonsmart28-lang
maisonsmart28-lang requested a review from a team as a code owner December 4, 2026 10:53
@coderabbitai

coderabbitai Bot commented Dec 4, 2026

Copy link
Copy Markdown

Important

  • Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 7776c9f8-0e56-4943-ab87-3bcb25383c17
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

This branch has not been deployed

No deployments
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.

feat(flagd): populate flag metadata

1 participant