Skip to content

fix: add typed variation accessors with WRONG_TYPE detail (#centinel coverage hunt) - #547

Draft
JackDanger wants to merge 1 commit into
mainfrom
centinel/typed-variation-detail
Draft

JackDanger wants to merge 1 commit into
mainfrom
centinel/typed-variation-detail

Conversation

@JackDanger

@JackDanger JackDanger commented Oct 30, 2026 •

Copy link
Copy Markdown

Coverage-hunt findings from the centinel verifier coverage census (campaign run book + official sdk-test-harness rides) against python-server-sdk 9.18.4 at main.

Repro one-liner: verifier census rows N0-errors-wrong-type-501c2a6282f5/01..06 (corpus server-side-eval__errors-wrong-type.yml from the harness v3 data files, requireCapability: strongly-typed): on a caller-requested type the flag's value of a different JSON type is served verbatim with a kind OFF-style reason — e.g. expected true, observed 1; expected errorKind WRONG_TYPE, observed absent — 12 named red rows across the legacy + ds banks.

Root cause: the public API exposes only the generic variation() / variation_detail(); there are no typed accessors (bool/int/float/string), so the typed evaluation contract (caller asks bool, flag stores number: default + errorKind WRONG_TYPE, as the Go/Java/Node server SDKs serve it) is unreachable. migration_variation already carries the only wrong-type check today (ldclient/client.py:458).

Fix (this PR): add bool_variation(_detail), string_*, int_*, float_* (the numeric-family conversions the other server SDKs serve) and json_variation atop one typed evaluator that preserves the SDK's existing error reasons and, for a successful evaluation whose value lacks the requested type, returns the caller default with {"kind": "ERROR", "errorKind": "WRONG_TYPE"}.

Post-fix evidence: the census rows N0-errors-wrong-type-501c2a6282f5/01..06 ride pass 7/7, rc 0 against the patched tree (evidence run py-fix-wrongtype1 in the centinel verifier run-dirs; the valueType evaluate path uses the new accessors via the coverage-hunt seat).

via LD Research 🤖

…overage hunt)

The public API had only the generic variation()/variation_detail(); the migration
surface carried the only wrong-type contract (client.py migration_variation). The
typed evaluation contract (typed defaults -> default + errorKind WRONG_TYPE, as the
official sdk-test-harness server-side-eval corpus prices) was unreachable.

bool/string/int/float/json variation(_detail) now ride one typed evaluator that
preserves the SDK's existing error reasons and, for a successful evaluation whose
value does not have the requested type, returns the caller default with
{"kind": "ERROR", "errorKind": "WRONG_TYPE"}.

Co-Authored-By: Kimi (LD Research via termag)
Generated-by: termag
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