Skip to content

chore: remove GRPC request and migrate to use REST API#186

Open
duyhungtnn wants to merge 41 commits intomasterfrom
chore/remove-proto-request
Open

chore: remove GRPC request and migrate to use REST API#186
duyhungtnn wants to merge 41 commits intomasterfrom
chore/remove-proto-request

Conversation

@duyhungtnn
Copy link
Copy Markdown
Collaborator

@duyhungtnn duyhungtnn commented Feb 23, 2026

This PR migrates the Node SDK from gRPC to REST API for feature flag and segment user retrieval. The migration removes gRPC dependencies, implements a REST-based APIClient with JSON payloads, and adds converters to transform REST responses into protobuf objects required by the local evaluator.

Changes:

  • Removed gRPC client implementation and dependencies (@improbable-eng/grpc-web, @improbable-eng/grpc-web-node-http-transport)
  • Removed google-protobuf
  • Added REST API endpoints for getFeatureFlags and getSegmentUsers in APIClient
  • Implemented converter functions to transform plain TypeScript objects from REST responses into protobuf objects
  • Updated cache processors to use APIClient instead of GRPCClient
  • Updated all related tests and mocks to work with REST responses

Related to bucketeer-io/bucketeer#2431

@duyhungtnn duyhungtnn changed the title chore: remove proto request chore: remove GRPC request and migrate to use REST API Feb 26, 2026
@duyhungtnn duyhungtnn requested a review from Copilot February 26, 2026 16:38
Copy link
Copy Markdown

Copilot AI left a comment

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 migrates the Node SDK from gRPC to REST API for feature flag and segment user retrieval. The migration removes gRPC dependencies, implements a REST-based APIClient with JSON payloads, and adds converters to transform REST responses into protobuf objects required by the local evaluator.

Changes:

  • Removed gRPC client implementation and dependencies (@improbable-eng/grpc-web, @improbable-eng/grpc-web-node-http-transport)
  • Added REST API endpoints for getFeatureFlags and getSegmentUsers in APIClient
  • Implemented converter functions to transform plain TypeScript objects from REST responses into protobuf objects
  • Updated cache processors to use APIClient instead of GRPCClient
  • Updated all related tests and mocks to work with REST responses

Reviewed changes

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

Show a summary per file
File Description
src/objects/segment.ts New type definitions for segment users (REST)
src/objects/feature.ts New type definitions for features (REST)
src/objects/request.ts Added request types for new REST endpoints
src/objects/response.ts Added response types for new REST endpoints
src/evaluator/converter.ts New converter logic to transform REST objects to protobuf
src/api/client.ts Added getFeatureFlags and getSegmentUsers REST endpoints
src/cache/processor/*.ts Migrated from GRPCClient to APIClient
src/index.ts Removed gRPC client initialization
src/client.ts Updated comments (gRPC → REST)
src/grpc/*.ts Deleted gRPC implementation files
src/__tests__/mocks/api.ts New mock for APIClient
src/__tests__/mocks/gprc.ts Deleted gRPC mock
src/__tests__/**/*.ts Updated all tests to use REST mocks and responses
package.json Removed gRPC dependencies
yarn.lock Updated dependencies, changed registry URLs from yarnpkg.com to npmjs.org

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

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


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/cache/processor/segmentUsersCacheProcessor.ts Outdated
Comment thread src/cache/processor/featureFlagCacheProcessor.ts Outdated
Comment thread src/evaluator/converter.ts Outdated
Comment thread src/evaluator/converter.ts Outdated
Comment thread src/evaluator/converter.ts Outdated
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

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


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/__tests__/cache/processor/segementUsersCache/polling.ts Outdated
Comment thread src/__tests__/cache/processor/featureCache/update.ts Outdated
Comment thread src/api/client.ts
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 29 out of 31 changed files in this pull request and generated no new comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

…createSegmentUsers` to `toProtoFeature` and `toProtoSegmentUsers` for clarity.
…ock async rejections in feature cache tests.
Delete two planning/analysis docs: evaluation_model_analytics.md and grpc_to_rest_migration_analytics.md. These files contained design notes for the evaluation model converter and the gRPC→REST migration for cache processors and have been removed (obsolete or relocated).
…clude `TTL` in mock cache `put` method arguments.
Delete the packageManager entry (yarn@1.22.22) from package.json to avoid pinning a specific package manager/version in the repo. This reduces tooling enforcement for contributors using different package managers and simplifies the manifest.
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

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


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/api/client.ts
Comment thread src/api/client.ts
…Protobuf format and update local evaluator to use it.
… Bucketeer proto objects within test files and update e2e configuration.
Add an early return in src/api/client.ts when the response status is not 200 to avoid setting up response handlers and attempting to parse the response body for non-success responses. This prevents unnecessary work and potential errors from processing error responses.
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 35 out of 38 changed files in this pull request and generated 2 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/api/client.ts
Comment thread TEST_DATA_MAPPING_REIMPLEMENTATION_PLAN.md Outdated
Delete unused imports (Strategy, Clause, createPrerequisite) from src/__tests__/client_local_evaluation.ts and src/__tests__/evaluator/evaluator.ts to clean up imports and silence linter/TS warnings.
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 34 out of 37 changed files in this pull request and generated 1 comment.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/api/client.ts
Replace shorthand property syntax with explicit key: value pairs in options and t.context objects within src/__tests__/cache/processor/featureCache/init.ts and update.ts to improve readability. No functional changes.
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 34 out of 36 changed files in this pull request and generated no new comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@duyhungtnn duyhungtnn marked this pull request as ready for review April 8, 2026 08:24
@duyhungtnn duyhungtnn requested a review from cre8ivejp as a code owner April 8, 2026 08:24
@duyhungtnn
Copy link
Copy Markdown
Collaborator Author

@cre8ivejp please help me to take a look

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 34 out of 36 changed files in this pull request and generated no new comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

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