Skip to content

[FFL-3355] Add standalone rules configuration fetch helper - #1508

Draft
sameerank wants to merge 3 commits into
sameerank/FFL-3355/native-tracking-hooksfrom
sameerank/rn-rules-configuration-fetch
Draft

sameerank wants to merge 3 commits into
sameerank/FFL-3355/native-tracking-hooksfrom
sameerank/rn-rules-configuration-fetch

Conversation

@sameerank

@sameerank sameerank commented Oct 21, 2026 •

Copy link
Copy Markdown

What does this PR do?

Add fetchRulesConfiguration, RulesConfigurationFetchOptions, and the FlagSelection type to the React Native OpenFeature /rules-based entry point (FFL-3355).

  • Fetch client-distributed protobuf rules with a client token, environment, supported site domain, optional flag selection, optional fetch implementation, and optional abort signal.
  • Decode a portable FlagsConfiguration and attach the retrieval timestamp without initializing the native SDK or registering tracking.
  • Support tags and key patterns using the shared canonicalizer from the exactly pinned @datadog/flagging-core 3.3.0 dependency. Send canonical values as repeated, RFC 3986-encoded query parameters without requiring URL or URLSearchParams.
  • Drop malformed or over-limit selections, including selections that make the encoded URL exceed 8,192 bytes, and request the full configuration with a diagnostic. Omit empty selections quietly. Report nonempty DD-Flag-Selection-Ignored headers when a selection was sent. An optional logger defaults to console; diagnostics do not initialize the native SDK or send telemetry.
  • Validate sites before sending the token and preserve useful HTTP errors, network errors, cancellation, and decoding failures.
  • Make one request per call, without implicit polling, retries, persistence, tracking, or local filtering of the returned configuration.
  • Add documentation and regression coverage for explicit refresh, preserved configuration after refresh failure, refreshed tracking metadata with active hooks, and selection behavior.

Motivation

The RN core provider supports local rules-based evaluation, but applications also need a client-side fetch helper to obtain its portable configuration. This follows the browser helper pattern while avoiding URL APIs that are incomplete on supported RN versions. Tag/key-pattern selection addresses the missing fetch-helper support noted in the ticket discussion.

Additional Notes

This is stacked on #1507 and intentionally targets sameerank/FFL-3355/native-tracking-hooks. The PR diff contains the fetch helper, its OpenFeature package dependency update, and related documentation/tests. Retarget to develop after the tracking PR lands.

The helper itself does not require native SDK initialization. The active-hook integration tests use the tracking functionality from the base branch. Native dependency/release blockers for the combined branch are documented in the tracking PR. Native precomputed filtering is outside this PR's scope.

Temporary Shared Fixtures

This PR temporarily checks in an unchanged copy of flag-selection/selection-vectors.json from ffe-system-test-data at caa6d1ac3e5fbda0ce57ef3ffff3772901f3f466, with provenance in SOURCE.md. The RN tests exercise all 38 SDK expectations, not the server-side selectedKeys or raw-query decoding expectations. This provides immediate regression coverage without adding submodule setup to this repository.

Follow-up: add equivalent fetch/selection integration coverage in FLEX, using its existing ffe-system-test-data submodule. The current RN adapter PR #230 does not yet cover fetch/refresh scenarios.

  • Once FLEX exercises equivalent selection cases through the real RN fetchRulesConfiguration helper on both iOS and Android, remove the copied fixture, its provenance file, and the corpus-driven tests from this repository. Retain focused RN unit tests for encoding, URL API independence, fallback diagnostics, limits, cancellation, and decoding failures. Do not remove the temporary coverage before the replacement is working.

Validation

  • Full OpenFeature package Jest suite: 254 tests passed across 14 suites, including all 38 shared SDK selection vectors.
  • Selection tests run with global URL and URLSearchParams disabled. Additional cases cover RFC 3986 encoding, malformed inputs, throwing getters/proxies, 8,192/8,193-byte URL boundaries, ignored-selection headers, retained full responses, and throwing loggers.
  • Existing tests cover supported/invalid domains, environment encoding, headers, cancellation, HTTP/network/body/decode failures, local evaluation after context changes, and failed/successful refresh with active tracking hooks.
  • TypeScript --noEmit, CommonJS/ESM/declaration builds, ESLint on changed TypeScript files, and git diff --check: passed.
  • The copied selection fixture matches the pinned upstream file byte-for-byte.
  • These are local Jest/build checks, not native-device or FLEX end-to-end validation. Full repository CI remains to be reviewed on this draft.

Review checklist (to be filled by reviewers)

  • Feature or bugfix MUST have appropriate tests
  • Make sure you discussed the feature or bugfix with the maintaining team in an Issue
  • Make sure each commit and the PR mention the Issue number (cf the CONTRIBUTING doc)
  • If this PR is auto-generated, please make sure also to manually update the code related to the change

@datadog-prod-us1-6

datadog-prod-us1-6 Bot commented Oct 21, 2026 •

Copy link
Copy Markdown

Pipelines  Tests

🎉 All green!

🧪 All tests passed
❄️ No new flaky tests detected

This comment will be updated automatically if new data arrives.
🔗 Commit SHA: 85302cb | Docs | View more details | Give us feedback!

Reuse core 3.3.0 selection canonicalization, preserve best-effort fallback with diagnostics, and encode selection without URL polyfills. Cover shared SDK vectors and RN transport edge cases.
@sameerank
sameerank force-pushed the sameerank/rn-rules-configuration-fetch branch from e501bc9 to 85302cb Compare November 3, 2026 21:11

This branch has not been deployed

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants