Skip to content

docs: add adr for targeting metadata - #2013

Open
suthar26 wants to merge 1 commit into
open-feature:mainfrom
suthar26:docs-adr-targeting-metadata
Open

docs: add adr for targeting metadata#2013
suthar26 wants to merge 1 commit into
open-feature:mainfrom
suthar26:docs-adr-targeting-metadata

Conversation

@suthar26

@suthar26 suthar26 commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

This PR

  • adds a new ADR for targeting metadata in flagd schema

Related Issues

Notes

Follow-up Tasks

How to test

@suthar26
suthar26 requested review from a team as code owners August 5, 2026 18:25
@dosubot dosubot Bot added the size:M This PR changes 30-99 lines, ignoring generated files. label Aug 5, 2026
@netlify

netlify Bot commented Aug 5, 2026

Copy link
Copy Markdown

Deploy Preview for polite-licorice-3db33c canceled.

Name Link
🔨 Latest commit 79f3a25
🔍 Latest deploy log https://app.netlify.com/projects/polite-licorice-3db33c/deploys/6a7380c8a1d43600081b4d24

@suthar26
suthar26 force-pushed the docs-adr-targeting-metadata branch from f6c88cc to 986a12c Compare August 5, 2026 18:25
@coderabbitai

coderabbitai Bot commented Aug 5, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 15e35ea0-e577-490b-94c6-fd0befb3e466

📥 Commits

Reviewing files that changed from the base of the PR and between bbb05d4 and 79f3a25.

📒 Files selected for processing (1)
  • docs/architecture-decisions/targeting-variant-metadata.md
🚧 Files skipped from review as they are similar to previous changes (1)
  • docs/architecture-decisions/targeting-variant-metadata.md

📝 Walkthrough

Walkthrough

Adds an architecture decision for targeting results that support existing variant strings or objects with a variant and optional metadata. It documents validation, decoding, merge precedence, parse errors, telemetry, compatibility, implementation impacts, and open questions.

Changes

Targeting variant metadata

Layer / File(s) Summary
Targeting metadata architecture decision
docs/architecture-decisions/targeting-variant-metadata.md
Documents the tagged-object result shape, schema constraints, typed evaluation behavior, metadata precedence, parse-error handling, telemetry, compatibility expectations, implementation coverage, and open design questions.

Estimated code review effort: 1 (Trivial) | ~5 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly identifies the addition of an architecture decision record for targeting metadata.
Description check ✅ Passed The description states that the pull request adds an ADR for targeting metadata in the flagd schema.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@suthar26
suthar26 force-pushed the docs-adr-targeting-metadata branch from 986a12c to df15c70 Compare August 5, 2026 18:27
Signed-off-by: Parth Suthar <parth.suthar@dynatrace.com>
@suthar26
suthar26 force-pushed the docs-adr-targeting-metadata branch from df15c70 to 79f3a25 Compare August 5, 2026 18:28
@sonarqubecloud

sonarqubecloud Bot commented Aug 5, 2026

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@docs/architecture-decisions/targeting-variant-metadata.md`:
- Around line 23-24: Revise the metadata plumbing statement to distinguish the
currently supported paths: confirm metadata for OFREP single/bulk and single
gRPC responses, note that this proto layer’s ResolveAll path does not yet expose
it, and remove the claim that RecordEvaluation telemetry already carries
metadata attributes. Limit the ADR’s end-to-end contract to these verified paths
and identify metrics/telemetry support as a separate change.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: e45a8980-8e18-4872-8ea0-f2e078b09b03

📥 Commits

Reviewing files that changed from the base of the PR and between bbb05d4 and 986a12c.

📒 Files selected for processing (1)
  • docs/architecture-decisions/targeting-variant-metadata.md

Comment on lines +23 to +24
The plumbing to carry metadata already exists end to end: `AnyValue.Metadata` (`core/pkg/evaluator/ievaluator.go`) is `map[string]interface{}`, threaded through every resolver path and out through gRPC and OFREP as evaluation metadata that OpenFeature SDKs surface as `flagMetadata`.
The only thing missing is a way for a *rule branch* to contribute to it.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🗄️ Data Integrity & Integration | 🟡 Minor | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/usr/bin/env bash
set -euo pipefail

rg -n -C 8 \
  'value\.Metadata|Metadata:|RecordEvaluation|AnyFlag|flagMetadata|OFREP' \
  --glob '*.go' --glob '*.proto' --glob '*.json' . || true

Repository: open-feature/flagd

Length of output: 50375


🏁 Script executed:

#!/usr/bin/env bash
set -euo pipefail

echo "== candidate files =="
git ls-files | rg 'flag_evaluator.*\.go$|ofrep|ievaluator|metrics|resol' | sed -n '1,200p'

echo
echo "== relevant source slices =="
sed -n '60,145p' flagd/pkg/service/flag-evaluation/flag_evaluator.go
sed -n '130,145p' flagd/pkg/service/flag-evaluation/flag_evaluator_v1.go
sed -n '360,405p' flagd/pkg/service/flag-evaluation/flag_evaluator.go
sed -n '245,270p' flagd/pkg/service/flag-evaluation/flag_evaluator_v2.go

echo
echo "== OFREP response metadata occurrences =="
rg -n -C 5 'metadata|Metadata|Resolve.*Response|flagMetadata|flag_metadata|recordEvaluation|Evaluation\(' flagd/pkg/service/ofrep **/ofrep*.go --glob '!*vendor*' --glob '!*testdata*' --glob '!*test' || true

Repository: open-feature/flagd

Length of output: 7340


🏁 Script executed:

#!/usr/bin/env bash
set -euo pipefail

echo "== OFREP handler/source slices =="
sed -n '1,260p' flagd/pkg/service/flag-evaluation/ofrep/handler.go
sed -n '1,220p' flagd/pkg/service/flag-evaluation/ofrep/ofrep_service.go

echo
echo "== schema V1 Proto AnyFlag messages =="
rg -n -C 4 'message AnyFlag|field Metadata|Metadata' proto schema flagd --glob '*.proto' --glob '*.pb.go' --glob '*.go' || true

echo
echo "== response result interface implementations =="
rg -n -C 4 'SetResult|RecordEvaluation|func .*SetResult|RecordEvaluation\(' flagd core flagd-proxy --glob '*.go' --glob '!*vendor*' || true

Repository: open-feature/flagd

Length of output: 50375


🏁 Script executed:

#!/usr/bin/env bash
set -euo pipefail

echo "== OFREP response model slices =="
sed -n '1,260p' core/pkg/service/ofrep/models.go

echo
echo "== OFREP test cases around metadata =="
sed -n '1,320p' flagd/pkg/service/flag-evaluation/ofrep/handler_test.go
sed -n '1,160p' core/pkg/service/ofrep/models_test.go

echo
echo "== OFREP service serializer occurrences =="
rg -n -C 4 'SuccessResponseFrom|BulkEvaluationResponseFrom|AnyValue|Metadata|flagMetadata|flag_metadata' core/pkg/service/ofrep --glob '*.go' || true

Repository: open-feature/flagd

Length of output: 33279


🏁 Script executed:

#!/usr/bin/env bash
set -euo pipefail

echo "== RecordEvaluation definitions =="
sed -n '1,220p' core/pkg/telemetry/metrics.go
rg -n -C 6 'func .*RecordEvaluation|RecordEvaluation.*Metadata|metadata|Metadata' core pkg flagd --glob '*.go' --glob '!*test.go' | sed -n '1,240p'

echo
echo "== AnyFlag schema declarations in vendored/generated/proto deps =="
rg -n -C 4 'message AnyFlag|AnyFlag|Metadata.*Struct|struct FieldMetadata' .vendor $GOPATH vendor flagd --glob '*.go' --glob '*.proto' --glob '*.pb.go' 2>/dev/null | sed -n '1,240p' || true

Repository: open-feature/flagd

Length of output: 26109


Clarify the metadata contract before calling the path end to end.

OFREP single and bulk responses carry AnyValue.Metadata, and single gRPC responses carry Metadata; ResolveAll now carries it through the v1 schema but not ResolveAll in this proto layer. RecordEvaluation(...) also does not expose metadata attributes yet, so the metrics/telemetry part of the ADR needs a separate change.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@docs/architecture-decisions/targeting-variant-metadata.md` around lines 23 -
24, Revise the metadata plumbing statement to distinguish the currently
supported paths: confirm metadata for OFREP single/bulk and single gRPC
responses, note that this proto layer’s ResolveAll path does not yet expose it,
and remove the claim that RecordEvaluation telemetry already carries metadata
attributes. Limit the ADR’s end-to-end contract to these verified paths and
identify metrics/telemetry support as a separate change.

@coderabbitai

coderabbitai Bot commented Aug 5, 2026

Copy link
Copy Markdown

Note

GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer.

@aepfli

aepfli commented Aug 6, 2026

Copy link
Copy Markdown
Member

I generally like the idea, but I am missing the migration path. How do we plan to move from old version to new version, without breaking migration patterns?

I feel like we need to point out how we plan to migrate without breaking installations for others. In-process providers might be used in deprecated services and we need to give people time to migrate from one to the other.

Is it maybe time to have a version contract in the request for the flag configuration?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:M This PR changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants