docs: update desktop Feature API reference to match current source#785
Merged
jaredlockhart merged 2 commits intomainfrom Feb 24, 2026
Merged
docs: update desktop Feature API reference to match current source#785jaredlockhart merged 2 commits intomainfrom
jaredlockhart merged 2 commits intomainfrom
Conversation
Because * The `getExperimentMetaData()` method documented in feature-api.mdx no longer exists in the source code — it was replaced by `getEnrollmentMetadata()` on each NimbusFeatures instance * Three new methods (`getEnrollmentMetadata`, `getAllEnrollments`, `getAllEnrollmentMetadata`) are undocumented * Desktop supports co-enrollment via `allowCoenrollment` in the feature manifest but the docs only cover mobile * The `off()` heading didn't match the actual method name `offUpdate()` * The FeatureManifest.yaml example was missing required fields This commit * Replaces the removed `getExperimentMetaData` section with `getEnrollmentMetadata()` documenting all three query modes * Adds `getAllEnrollments()` and `getAllEnrollmentMetadata()` sections for co-enrolling features * Documents the `slug` parameter on `recordExposureEvent()` for co-enrolling features * Fixes `off()` heading to `offUpdate()` * Enriches the manifest example with `owner`, `hasExposure`, `exposureDescription`, and `allowCoenrollment` * Adds Desktop co-enrollment support to coenrolling-features.mdx with manifest example, JS API example, and cross-links Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
freshstrangemusic
approved these changes
Feb 24, 2026
|
|
||
| `getAllEnrollments(): Array<{ meta: { slug, branch, isRollout }, value: object }>` (JS Only) | ||
|
|
||
| Returns an array of all active enrollments for this feature, each with metadata and the resolved feature variable values. This is the primary data access method for [co-enrolling features](/technical-reference/fml/coenrolling-features) where a client may be enrolled in multiple experiments or rollouts for the same feature simultaneously. |
Member
There was a problem hiding this comment.
Suggested change
| Returns an array of all active enrollments for this feature, each with metadata and the resolved feature variable values. This is the primary data access method for [co-enrolling features](/technical-reference/fml/coenrolling-features) where a client may be enrolled in multiple experiments or rollouts for the same feature simultaneously. | |
| Returns an array of all active enrollments for this feature, each with metadata and the resolved feature variable values. This is the primary data access method for [co-enrolling features](/technical-reference/fml/coenrolling-features) where a client may be enrolled in multiple experiments and/or rollouts for the same feature simultaneously. |
| ### `getEnrollmentMetadata()` | ||
|
|
||
| If you need to know whether an experiment is active or get access to the experiment or branch identifier (for example, to report in `utm_params`), you can use `ExperimentAPI.getExperimentMetaData`: | ||
| `getEnrollmentMetadata(enrollmentType?: "experiment" | "rollout"): { slug: string, branch: string, isRollout: boolean } | null` (JS Only) |
Member
There was a problem hiding this comment.
lets encourage the users to use the constants
Suggested change
| `getEnrollmentMetadata(enrollmentType?: "experiment" | "rollout"): { slug: string, branch: string, isRollout: boolean } | null` (JS Only) | |
| `getEnrollmentMetadata(enrollmentType?: EnrollmentType): { slug: string, branch: string, isRollout: boolean } | null` (JS Only) |
Comment on lines
365
to
366
| - **`"experiment"`** — returns only an active experiment enrollment, or `null`. | ||
| - **`"rollout"`** — returns only an active rollout enrollment, or `null`. |
Member
There was a problem hiding this comment.
Suggested change
| - **`"experiment"`** — returns only an active experiment enrollment, or `null`. | |
| - **`"rollout"`** — returns only an active rollout enrollment, or `null`. | |
| - **`EnrollmentType.EXPERIMENT`** — returns only an active experiment enrollment, or `null`. | |
| - **`EnrollmentType.ROLLOUT`** — returns only an active rollout enrollment, or `null`. |
|
|
||
| Standard per-feature methods like `getVariable()` and `getAllVariables()` throw for co-enrolling features. Instead, use these APIs: | ||
|
|
||
| - **`getAllEnrollments()`** — returns `Array<{ meta: { slug, branch, isRollout }, value: object }>` with both metadata and resolved feature values for each enrollment. |
Member
There was a problem hiding this comment.
Suggested change
| - **`getAllEnrollments()`** — returns `Array<{ meta: { slug, branch, isRollout }, value: object }>` with both metadata and resolved feature values for each enrollment. | |
| - **`getAllEnrollments()`** — returns `{ meta: { slug, branch, isRollout }, value: object }[]` with both metadata and resolved feature values for each enrollment. |
prefer T[] over Array
| Standard per-feature methods like `getVariable()` and `getAllVariables()` throw for co-enrolling features. Instead, use these APIs: | ||
|
|
||
| - **`getAllEnrollments()`** — returns `Array<{ meta: { slug, branch, isRollout }, value: object }>` with both metadata and resolved feature values for each enrollment. | ||
| - **`getAllEnrollmentMetadata()`** — returns `Array<{ slug, branch, isRollout }>` (metadata only). |
Member
There was a problem hiding this comment.
Suggested change
| - **`getAllEnrollmentMetadata()`** — returns `Array<{ slug, branch, isRollout }>` (metadata only). | |
| - **`getAllEnrollmentMetadata()`** — returns `{ slug, branch, isRollout }[]` (metadata only). |
| } | ||
|
|
||
| // Query for a specific enrollment type: | ||
| const rollout = NimbusFeatures.myFeature.getEnrollmentMetadata("rollout"); |
Member
There was a problem hiding this comment.
Suggested change
| const rollout = NimbusFeatures.myFeature.getEnrollmentMetadata("rollout"); | |
| const rollout = NimbusFeatures.myFeature.getEnrollmentMetadata(EnrollmentType.ROLLOUT); |
|
|
||
| ### `getAllEnrollmentMetadata()` | ||
|
|
||
| `getAllEnrollmentMetadata(): Array<{ slug: string, branch: string, isRollout: boolean }>` (JS Only) |
Member
There was a problem hiding this comment.
Suggested change
| `getAllEnrollmentMetadata(): Array<{ slug: string, branch: string, isRollout: boolean }>` (JS Only) | |
| `getAllEnrollmentMetadata(): { slug: string, branch: string, isRollout: boolean }[]` (JS Only) |
|
|
||
| ### `getAllEnrollments()` | ||
|
|
||
| `getAllEnrollments(): Array<{ meta: { slug, branch, isRollout }, value: object }>` (JS Only) |
Member
There was a problem hiding this comment.
Suggested change
| `getAllEnrollments(): Array<{ meta: { slug, branch, isRollout }, value: object }>` (JS Only) | |
| `getAllEnrollments(): { meta: { slug, branch, isRollout }, value: object }[]` (JS Only) |
Because * Reviewer suggested using EnrollmentType constants instead of string literals to encourage best practices * T[] syntax preferred over Array<T> for type signatures * "and/or" more accurate than "or" for co-enrollment scenarios This commit * Uses EnrollmentType constants in getEnrollmentMetadata() signature, parameter docs, and code examples * Adds import comment showing EnrollmentType is from the same module * Switches all type signatures to T[] syntax * Updates wording to "experiments and/or rollouts" Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Updates the desktop Feature API reference and co-enrolling features docs to match the current Nimbus SDK source code.
getExperimentMetaData()→getEnrollmentMetadata()with full documentation of the three query modes (default, experiment-only, rollout-only)getAllEnrollments()andgetAllEnrollmentMetadata()for co-enrolling featurescoenrolling-features.mdxoff()→offUpdate()heading, enrichedFeatureManifest.yamlexample,recordExposureEvent({slug})for co-enrolling featuresFixes #784
🤖 Generated with Claude Code