Skip to content

feat(openfeature): JavaScript openfeature provider new spec - #1129

Draft
ayushjain17 wants to merge 1 commit into
mainfrom
js/openfeature
Draft

feat(openfeature): JavaScript openfeature provider new spec#1129
ayushjain17 wants to merge 1 commit into
mainfrom
js/openfeature

Conversation

@ayushjain17

Copy link
Copy Markdown
Collaborator

Change log

Javascript provider in the new spec

Copilot AI lite review requested due to automatic review settings August 12, 2026 19:05
@ayushjain17
ayushjain17 requested a review from a team as a code owner August 12, 2026 19:05
@semanticdiff-com

semanticdiff-com Bot commented Aug 12, 2026

Copy link
Copy Markdown

Review changes with  SemanticDiff

Changed Files
File Status
  crates/superposition_core/src/lib.rs  71% smaller
  clients/javascript/bindings/test-json.ts  31% smaller
  clients/javascript/bindings/test-toml.ts  26% smaller
  clients/javascript/bindings/native-resolver.ts  21% smaller
  clients/javascript/provider-sdk-tests/index.js  21% smaller
  crates/superposition_core/src/ffi.rs  14% smaller
  clients/javascript/open-feature-provider/configuration-client.ts  13% smaller
  clients/javascript/open-feature-provider/index.ts  10% smaller
  crates/superposition_core/src/experiment.rs  5% smaller
  crates/superposition_core/src/ffi_legacy.rs  4% smaller
  crates/superposition_core/src/format.rs  2% smaller
  clients/java/bindings/src/main/kotlin/uniffi/superposition_client/superposition_client.kt Unsupported file format
  clients/javascript/bindings/tsconfig.json  0% smaller
  clients/javascript/open-feature-provider/conversions.ts  0% smaller
  clients/javascript/open-feature-provider/data-source.ts  0% smaller
  clients/javascript/open-feature-provider/errors.ts  0% smaller
  clients/javascript/open-feature-provider/file-data-source.ts  0% smaller
  clients/javascript/open-feature-provider/http-data-source.ts  0% smaller
  clients/javascript/open-feature-provider/interfaces.ts  0% smaller
  clients/javascript/open-feature-provider/local-provider.ts  0% smaller
  clients/javascript/open-feature-provider/options.ts  0% smaller
  clients/javascript/open-feature-provider/remote-provider.ts  0% smaller
  clients/javascript/open-feature-provider/superposition-provider.ts  0% smaller
  clients/javascript/open-feature-provider/tsconfig.json  0% smaller
  clients/javascript/open-feature-provider/types.ts  0% smaller
  clients/javascript/provider-sdk-tests/config.toml Unsupported file format
  clients/javascript/provider-sdk-tests/unit/test-file-if-modified.mjs  0% smaller
  clients/javascript/provider-sdk-tests/unit/test-ondemand-ttl.mjs  0% smaller
  clients/javascript/provider-sdk-tests/unit/test-type-contract.mjs  0% smaller
  clients/python/bindings/superposition_bindings/superposition_client.py  0% smaller
  makefile Unsupported file format

@coderabbitai

coderabbitai Bot commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: f68aa35c-7eb3-4817-a4c9-8bd8a968ceac

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the JavaScript OpenFeature provider to a new “spec”-aligned architecture (local vs remote resolution, data sources, refresh strategies), while extending the native Rust core and FFI surface area to support shared parse/filter logic and cache filtering/variant selection across languages.

Changes:

  • Introduces new JS provider architecture: LocalResolutionProvider (native-cache backed) and SuperpositionAPIProvider (remote-only), plus HTTP/File data sources and typed options/auth/refresh strategies.
  • Consolidates Rust parse/filter logic (parse_config_file_with_filters) and adds new C-ABI cache operations to mirror UniFFI behaviors (filter config/experiments, applicable variants).
  • Adds JS provider unit tests (type-coercion contract, on-demand TTL behavior, file if-modified behavior) and updates harness/config to exercise new providers.

Reviewed changes

Copilot reviewed 31 out of 31 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
makefile Runs new JS provider unit tests before the integration harness.
crates/superposition_core/src/lib.rs Re-exports new parse/filter and cache-related legacy FFI functions.
crates/superposition_core/src/format.rs Adds shared parse_config_file_with_filters helper.
crates/superposition_core/src/ffi.rs Removes legacy UniFFI parse APIs; routes parse+filter through shared helper; factors cache logic into shared inner methods.
crates/superposition_core/src/ffi_legacy.rs Adds new C-ABI cache filter/variant APIs and a unified parse+filter entrypoint.
crates/superposition_core/src/experiment.rs Makes ExperimentConfig serializable for JSON return paths.
clients/python/bindings/superposition_bindings/superposition_client.py Removes checksums and wrappers for removed UniFFI parse functions.
clients/javascript/provider-sdk-tests/unit/test-type-contract.mjs Adds type-coercion contract unit test.
clients/javascript/provider-sdk-tests/unit/test-ondemand-ttl.mjs Adds on-demand TTL “checked-at clock” unit test.
clients/javascript/provider-sdk-tests/unit/test-file-if-modified.mjs Adds FileDataSource if_modified_since unit test.
clients/javascript/provider-sdk-tests/index.js Updates integration harness to run scenarios against multiple providers/data sources/strategies.
clients/javascript/provider-sdk-tests/config.toml Adds file-backed config used by new integration flows.
clients/javascript/open-feature-provider/types.ts Re-exports canonical native binding types from superposition-bindings.
clients/javascript/open-feature-provider/tsconfig.json Updates TS lib and bindings path mapping.
clients/javascript/open-feature-provider/superposition-provider.ts Aligns legacy provider option types to canonical Config type.
clients/javascript/open-feature-provider/remote-provider.ts Adds SuperpositionAPIProvider implementation.
clients/javascript/open-feature-provider/options.ts Adds auth/options/refresh-strategy model and SDK auth wiring.
clients/javascript/open-feature-provider/local-provider.ts Adds LocalResolutionProvider implementation with caching + refresh strategies.
clients/javascript/open-feature-provider/interfaces.ts Adds shared resolution/type-contract base (AllFeatureProvider) and experiment meta interface.
clients/javascript/open-feature-provider/index.ts Updates exports to include new architecture components.
clients/javascript/open-feature-provider/http-data-source.ts Adds HTTP data source with 304 handling.
clients/javascript/open-feature-provider/file-data-source.ts Adds file data source with if_modified_since + watch support.
clients/javascript/open-feature-provider/errors.ts Adds typed provider/data source error model.
clients/javascript/open-feature-provider/data-source.ts Adds data-source abstraction and FetchResponse sum type.
clients/javascript/open-feature-provider/conversions.ts Adds conversion helpers from SDK responses to native-cache shapes.
clients/javascript/open-feature-provider/configuration-client.ts Reuses conversion helper and switches defaults/current config typing to canonical Config.
clients/javascript/bindings/tsconfig.json Adds esnext.disposable lib for Symbol.dispose typing.
clients/javascript/bindings/test-toml.ts Updates tests to use unified parse+filter API.
clients/javascript/bindings/test-json.ts Updates tests to use unified parse+filter API.
clients/javascript/bindings/native-resolver.ts Adds cache wrapper class + new FFI function bindings (parse+filter, cache filtering, variants).
clients/java/bindings/.../superposition_client.kt Removes bindings for removed UniFFI parse functions.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines +978 to 982
let file_content = match c_str_to_string(file_content) {
Ok(s) => s,
Err(e) => {
copy_string(ebuf, format!("Invalid UTF-8 in toml_content: {}", e));
copy_string(ebuf, format!("Invalid UTF-8 in file_content: {}", e));
return ptr::null_mut();
Comment on lines +985 to 989
let format = match c_str_to_string(format) {
Ok(s) => s,
Err(e) => {
copy_string(ebuf, e.to_string());
copy_string(ebuf, format!("Invalid UTF-8 in format: {}", e));
return ptr::null_mut();
Comment on lines +4 to +7
* Mirrors Rust/Python/Java `FileDataSource`. Honours `if_modified_since` via the file's last-modified
* time (a 304-equivalent), and supports watching the file for changes via `fs.watch`. Filtering is
* not applied here (the file is parsed whole); the local provider filters during evaluation.
*/
Comment on lines +118 to +122
this.status = ProviderStatus.NOT_READY;
this.globalContext = context ?? {};

this.ffiCache = this.resolver.createProviderCache();
cacheRegistry.register(this, this.ffiCache, this);
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.

2 participants