Skip to content

feat(flagd): integrate OFREP provider for REST mode#117

Open
erenatas wants to merge 18 commits intomainfrom
eren/integrate-ofrep-into-flagd
Open

feat(flagd): integrate OFREP provider for REST mode#117
erenatas wants to merge 18 commits intomainfrom
eren/integrate-ofrep-into-flagd

Conversation

@erenatas
Copy link
Copy Markdown
Contributor

This PR

This change deduplicates OFREP bits within flagd and make full use of cargo workspaces:

  • Added open-feature-ofrep as dependency to flagd provider
  • Refactored RestResolver to wrap OfrepProvider instead of duplicate HTTP code
  • Added cert_path option to OfrepOptions for TLS support to align flagd and ofrep changes (ofrep crate was outdated, which proves why this refactoring is useful)
  • Updated rest feature to include open-feature-ofrep dependency
  • Converted ofrep crate to use workspace dependencies
  • Made RestResolver::new() async to match OfrepProvider API

In terms of benefits, in summary:

  • Eliminated duplicate HTTP client code in flagd
  • Single source of truth for OFREP implementation
  • Users can choose between RPC, REST (OFREP), or in-process evaluation
  • Consistent dependency versions via workspace

Related Issues

Followup of #106 and #105

Notes

changes will follow in optimizing ofrep crate dependencies to provide wasm compatibility.

erenatas added 15 commits March 1, 2026 11:26
Signed-off-by: Eren Atas <eren_atas@hotmail.com>
Signed-off-by: Eren Atas <eren_atas@hotmail.com>
Signed-off-by: Eren Atas <eren_atas@hotmail.com>
Signed-off-by: Eren Atas <eren_atas@hotmail.com>
Signed-off-by: Eren Atas <eren_atas@hotmail.com>
Signed-off-by: Eren Atas <eren_atas@hotmail.com>
Signed-off-by: Eren Atas <eren_atas@hotmail.com>
Signed-off-by: Eren Atas <eren_atas@hotmail.com>
Signed-off-by: Eren Atas <eren_atas@hotmail.com>
Signed-off-by: Eren Atas <eren_atas@hotmail.com>
- Add open-feature-ofrep as dependency to flagd
- Update rest feature to use open-feature-ofrep
- Add cert_path option to OfrepOptions for TLS support

Signed-off-by: Eren Atas <eren_atas@hotmail.com>
Signed-off-by: Eren Atas <eren_atas@hotmail.com>
Signed-off-by: Eren Atas <eren_atas@hotmail.com>
Signed-off-by: Eren Atas <eren_atas@hotmail.com>
Signed-off-by: Eren Atas <eren_atas@hotmail.com>
@gemini-code-assist
Copy link
Copy Markdown
Contributor

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request significantly refactors the flagd project by introducing a new flagd-evaluation-engine crate and integrating the open-feature-ofrep crate. This change aims to streamline the codebase, eliminate redundant HTTP client implementations, and establish a single source of truth for OFREP. By leveraging Cargo workspaces, dependency management is centralized, providing a more consistent and maintainable project structure. This enhancement offers users greater flexibility in choosing between RPC, REST (OFREP), or in-process evaluation methods.

Highlights

  • OFREP Integration: The open-feature-ofrep crate has been integrated into flagd to provide a standardized and deduplicated implementation for REST-based flag resolution, replacing custom HTTP client logic.
  • New Evaluation Engine Crate: A new crate, flagd-evaluation-engine, has been introduced to encapsulate the in-process evaluation logic, including JSONLogic-based targeting, fractional rollouts, and semantic versioning, promoting modularity and reusability.
  • Cargo Workspace Centralization: Dependency management has been centralized across the project by adopting Cargo workspaces, ensuring consistent versions and simplifying maintenance for shared dependencies.
  • RestResolver Refactoring: The RestResolver in flagd has been refactored to wrap the OfrepProvider from the new open-feature-ofrep crate, and its constructor is now asynchronous, supporting TLS configuration via a cert_path option.
  • In-Process Resolver Update: The in-process resolver now re-exports its core evaluation components directly from the flagd-evaluation-engine crate, streamlining its internal structure.
Changelog
  • Cargo.toml
    • Updated workspace configuration to use resolver v2 and introduced workspace dependencies for centralized management, adding flagd-evaluation-engine to workspace members.
  • crates/flagd-evaluation-engine/Cargo.toml
    • Added a new Cargo.toml file for the flagd-evaluation-engine crate, defining its metadata and dependencies using workspace inheritance.
  • crates/flagd-evaluation-engine/README.md
    • Added a README.md file detailing the purpose, features, installation, and usage of the flagd-evaluation-engine crate.
  • crates/flagd-evaluation-engine/src/error.rs
    • Added a new error module defining FlagdEvaluationError for the evaluation engine, using the thiserror crate.
  • crates/flagd-evaluation-engine/src/lib.rs
    • Added the main library file for flagd-evaluation-engine, defining its modules and re-exporting core types.
  • crates/flagd-evaluation-engine/src/model/feature_flag.rs
    • Moved the feature_flag module to the new flagd-evaluation-engine crate.
  • crates/flagd-evaluation-engine/src/model/flag_parser.rs
    • Moved the flag_parser module to the new flagd-evaluation-engine crate and updated its error type to FlagdEvaluationError.
  • crates/flagd-evaluation-engine/src/model/mod.rs
    • Added the model module for flagd-evaluation-engine, organizing and re-exporting its sub-modules and types.
  • crates/flagd-evaluation-engine/src/model/value_converter.rs
    • Moved the value_converter module to the new flagd-evaluation-engine crate.
  • crates/flagd-evaluation-engine/src/targeting/fractional.rs
    • Moved the fractional targeting module to the new flagd-evaluation-engine crate.
  • crates/flagd-evaluation-engine/src/targeting/mod.rs
    • Moved the targeting module to the new flagd-evaluation-engine crate and updated its error type.
  • crates/flagd-evaluation-engine/src/targeting/semver.rs
    • Moved the semver targeting module to the new flagd-evaluation-engine crate.
  • crates/flagd/Cargo.toml
    • Updated feature dependencies for rest and in-process to use the new open-feature-ofrep and flagd-evaluation-engine crates, respectively, and migrated many direct dependencies to workspace inheritance.
  • crates/flagd/src/error.rs
    • Added a conversion implementation to map FlagdEvaluationError from the new evaluation engine crate to the existing FlagdError.
  • crates/flagd/src/lib.rs
    • Updated the RestResolver instantiation to be an asynchronous call.
  • crates/flagd/src/resolver/in_process/mod.rs
    • Refactored the in-process resolver module to re-export components from the new flagd-evaluation-engine crate, centralizing evaluation logic.
  • crates/flagd/src/resolver/in_process/resolver/file.rs
    • Updated imports for ValueConverter and FileConnector to align with the new module structure.
  • crates/flagd/src/resolver/in_process/resolver/grpc.rs
    • Updated imports for storage components to align with the new module structure.
  • crates/flagd/src/resolver/in_process/storage/connector/file.rs
    • Improved the file watcher test in FileConnector to handle timing variations more robustly.
  • crates/flagd/src/resolver/in_process/storage/connector/mod.rs
    • Exported FileConnector and GrpcStreamConnector directly from the connector module.
  • crates/flagd/src/resolver/in_process/storage/mod.rs
    • Exported FileConnector and GrpcStreamConnector from the storage module.
  • crates/flagd/src/resolver/rest.rs
    • Rewrote the RestResolver to delegate all OFREP logic to the open-feature-ofrep crate, simplifying its implementation and making its constructor asynchronous.
  • crates/ofrep/Cargo.toml
    • Updated all dependencies to use workspace inheritance for consistent versioning.
  • crates/ofrep/src/lib.rs
    • Added a cert_path option to OfrepOptions to support TLS certificate configuration.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Signed-off-by: Eren Atas <eren_atas@hotmail.com>
Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request is a significant and valuable refactoring that centralizes the OFREP implementation and evaluation logic into dedicated crates, open-feature-ofrep and flagd-evaluation-engine respectively. This greatly improves code structure, reduces duplication, and makes the codebase more maintainable. The use of cargo workspaces for dependency management is also a welcome improvement.

I've found a critical issue where the new cert_path option in the ofrep crate is not actually used, which will prevent TLS connections with custom certificates from working. I've also noted a minor dependency cleanup opportunity in the flagd crate's Cargo.toml. Overall, this is a very positive change.

@erenatas erenatas changed the title Eren/integrate ofrep into flagd feat(flagd): integrate OFREP provider for REST mode Mar 17, 2026
…er implementation

Signed-off-by: Eren Atas <eren.atas@booking.com>
Signed-off-by: Eren Atas <eren.atas@booking.com>
@erenatas erenatas requested review from beeme1mr and removed request for Rahul-Baradol and sheepduke March 19, 2026 20:15
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.

3 participants