Skip to content

Commit 3e50e8f

Browse files
committed
test(ofrep): claim the standard resolution reasons
spec@c342461a moved every resolution-reason assertion into a new gated gherkin/reason.feature, so the reasons are now a claim a provider declares rather than a house rule every adopter is held to. Declare @standard-reasons. Eight of the file's nine scenarios run here and all eight pass: the four rule-less rows as STATIC, an unknown flag and a type mismatch as ERROR beside their error codes, and -- because @targeting is declared -- TARGETING_MATCH for the matched rule and DEFAULT for the miss. The ninth composes with @disabled-flags, which stays withheld, so it is skipped with that reason. The obstacle expected here is not the one that exists, and it was measured rather than reasoned about. ofrep/__init__.py:159 indexes `Reason[data["reason"]]` by name, so a reason outside the SDK's enum raises KeyError -- which made this capability look like the risky one. It is not: every reason reason.feature asserts is an enum member, DISABLED included. Declaring @disabled-flags beside this one and running the ninth scenario shows that index surviving the DISABLED reason and the next keyword argument failing instead -- `variant=data["variant"]` on line 160, KeyError: 'variant', reported to the application as GENERAL. That is the same one-line defect the @disabled-flags note already records, and it is unrelated to the reason vocabulary. The tally moves from 2 failed, 37 passed, 16 skipped, 1 xfailed to 2 failed, 45 passed, 17 skipped, 1 xfailed. The two failures are unchanged -- large-integer-flag is still not seeded by flagd-testbed v3.8.0. Collection moves from 56 to 65. Signed-off-by: Simon Schrottner <simon.schrottner@flagsmith.com>
1 parent 70b4f50 commit 3e50e8f

2 files changed

Lines changed: 28 additions & 1 deletion

File tree

‎providers/openfeature-provider-ofrep/README.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ with the reason in a comment above them. Why a conformance suite is not a requir
4444
Two things that are this provider's rather than the policy's:
4545

4646
- **Docker is not what decides it.** The flagd package's `tests/e2e` needs Docker too and does run in
47-
the default build. What decides it is the run: **2 failed, 37 passed, 16 skipped, 1 xfailed** —
47+
the default build. What decides it is the run: **2 failed, 45 passed, 17 skipped, 1 xfailed** —
4848
both failures are canonical flags that flagd-testbed v3.8.0 does not seed yet, and the `xfail` is
4949
the one genuine provider gap, recorded as a `KnownDeviation` rather than hidden.
5050
`tests/tck/conftest.py` and `tests/tck/test_ofrep_conformance.py` account for each one, so a

‎providers/openfeature-provider-ofrep/tests/tck/test_ofrep_conformance.py‎

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,32 @@
7575
# is verified is that the key reached flagd, since nothing else about the
7676
# context is keyed on by any canonical flag.
7777
#
78+
# STANDARD_REASONS
79+
# New at spec@c342461a, which moved every resolution-reason assertion out of
80+
# the other feature files and into reason.feature, gated as a whole. A claim
81+
# rather than an exemption: 2.2.5 is a SHOULD that permits "some other
82+
# string", so declaring the tag says this provider uses the standard
83+
# vocabulary with the standard meanings.
84+
#
85+
# Eight of the file's nine scenarios run here and all eight pass: the four
86+
# rule-less rows as STATIC, an unknown flag and a type mismatch as ERROR
87+
# beside their error codes, and -- because TARGETING is declared above --
88+
# TARGETING_MATCH for the matched rule and DEFAULT for the miss. The ninth
89+
# composes with @disabled-flags, withheld below, so it is skipped with that
90+
# reason.
91+
#
92+
# The obstacle that was expected here is not the one that exists, and it was
93+
# measured rather than reasoned about. ofrep/__init__.py:159 indexes
94+
# `Reason[data["reason"]]` by *name*, so a server reporting a reason outside
95+
# the SDK's enum raises KeyError -- which is why this capability looked like
96+
# the risky one. It is not: every reason reason.feature asserts is an enum
97+
# member, DISABLED included. Declaring @disabled-flags alongside this one and
98+
# running the ninth scenario shows the index surviving the DISABLED reason
99+
# and the *next* keyword argument failing, `variant=data["variant"]` on line
100+
# 160, with KeyError: 'variant' reported to the application as GENERAL. That
101+
# is the same one-line defect the @disabled-flags note below records, and it
102+
# is unrelated to the reason vocabulary.
103+
#
78104
# NUMERIC_COERCION is withheld, and the reason is worth recording because two
79105
# other languages answered it differently over the same protocol.
80106
#
@@ -228,6 +254,7 @@
228254
Capability.OBJECT,
229255
Capability.VARIANTS,
230256
Capability.TARGETING,
257+
Capability.STANDARD_REASONS,
231258
}
232259
)
233260

0 commit comments

Comments
 (0)