You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
docs: add missing FeatureHolder methods to FML spec
Because
* Several FeatureHolder methods in the source are undocumented in
the FML spec: recordExperimentExposure, recordMalformedConfiguration,
toJSONObject, and the testing helpers
* Co-enrollment exposure recording pattern was only in the co-enrollment
doc, not the main FML reference
This commit
* Adds recordExperimentExposure(slug) for co-enrolling features with
Swift and Kotlin examples
* Adds recordMalformedConfiguration(partId) for reporting invalid
experiment configurations as Glean telemetry
* Adds toJSONObject() for getting raw JSON representation
* Adds testing helpers section: withCachedValue, withInitializer,
withSdk, isUnderTest with examples and cross-link to Android
integration guide
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
If your app detects that a feature configuration from an experiment is invalid, you can report it as telemetry. The `partId` parameter identifies which part of the configuration is malformed.
-**`withCachedValue(value)`** — overwrite the cached configuration with a test value.
283
+
-**`withInitializer(create)`** — change how `Variables` are mapped to the feature object (clears cache).
284
+
-**`withSdk(getSdk)`** — reset the SDK connection (clears cache).
285
+
-**`isUnderTest()`** — returns `true` when the SDK is a `HardcodedNimbusFeatures` instance.
286
+
287
+
See the [Android integration guide](/platform-guides/android/integration#unit-and-ui-testing-with-hardcodednimbusfeatures) for a complete testing example using `HardcodedNimbusFeatures`.
288
+
163
289
### Identifier cases
164
290
165
291
All the examples below use `kebab-case` for identifiers. When these identifiers are used to generate code, they are transformed to the language-specific casing. For example, a feature is specified in the FML as being called `spotlight-search`, but would be referred to in Swift as `spotlightSearch`.
0 commit comments