Skip to content

[FEATURE] Define numeric coercion behavior across flagd implementations #1978

Closed

Description

@toddbaert

flagd's evaluators don't agree on what should happen when a numeric flag is fetched via a different numeric accessor than its parsed type, or when a value doesn't fit the requested type.

A few examples I've observed:

  • A 3.14 variant fetched as Integer returns 3 in the Go and Java implementations (silent truncation), but returns TYPE_MISMATCH in Python and .NET.
  • A 9000000000 variant fetched as Integer returns 410065408 over the flagd-java RPC path (silent int32 overflow on the wire), TYPE_MISMATCH in flagd-java in-process, and the correct value in Python and Go (within int64).
  • The same 9000000000 variant fetched as Float succeeds in Go, Python, and .NET, but returns TYPE_MISMATCH in flagd-java in-process.
  • A 10.0 variant fetched as Integer returns 10 in Go and Java, TYPE_MISMATCH in Python and .NET.

These behaviors are reachable today with simple flag definitions; users moving between SDKs hit them.

I'd like us to define a single contract for numeric coercion that all flagd implementations follow, and update the testbed to enforce it. I'll open a follow-up ADR proposing a specific contract; this issue is just to capture the problem.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementv1.0-prereq

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions