Skip to content

apollo_infra: refactor client struct to be an enum#13570

Open
ArniStarkware wants to merge 1 commit intomainfrom
arni/infra/component_client_client_as_enum
Open

apollo_infra: refactor client struct to be an enum#13570
ArniStarkware wants to merge 1 commit intomainfrom
arni/infra/component_client_client_as_enum

Conversation

@ArniStarkware
Copy link
Copy Markdown
Contributor

@ArniStarkware ArniStarkware commented Mar 30, 2026

Note

Medium Risk
Medium risk because this changes the core Client type and construction/retrieval logic used across node components, which could break wiring or disable clients if match arms are missed.

Overview
Refactors the component Client<Request, Response> from a struct holding optional local/remote clients into an enum with explicit Local, Remote, and Disabled variants, removing the Client::new constructor and the “both set” panic.

Updates client creation and access helpers in apollo_node to pattern-match on the new enum: create_client! now returns a concrete Client variant (including Client::Disabled), and get_shared_client! builds an Arc from the active variant or returns None when disabled.

Written by Cursor Bugbot for commit 2b86e25. This will update automatically on new commits. Configure here.

@reviewable-StarkWare
Copy link
Copy Markdown

This change is Reviewable

@ArniStarkware ArniStarkware marked this pull request as ready for review March 30, 2026 07:02
@ArniStarkware
Copy link
Copy Markdown
Contributor Author

crates/apollo_node/src/clients.rs line 323 at r1 (raw file):

/// // LocalBatcherClient and RemoteBatcherClient have new methods that accept a channel and config,
/// // respectively.
/// let batcher_client: Option<Client<BatcherRequest, BatcherResponse>> = create_client!(

This is a typo from before this PR.

Suggestion:

/// let batcher_client: Client<BatcherRequest, BatcherResponse> = create_client!(

Copy link
Copy Markdown

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.

@ArniStarkware ArniStarkware force-pushed the arni/infra/component_client_client_as_enum branch from 8868d60 to 00e3f97 Compare March 30, 2026 11:20
Copy link
Copy Markdown
Collaborator

@nadin-Starkware nadin-Starkware left a comment

Choose a reason for hiding this comment

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

@nadin-Starkware reviewed 2 files and all commit messages, and made 1 comment.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on ArniStarkware and Itay-Tsabary-Starkware).


crates/apollo_infra/src/component_client/definitions.rs line 32 at r2 (raw file):

    Local(LocalComponentClient<Request, Response>),
    Remote(RemoteComponentClient<Request, Response>),
    None,

Please rename Disabled for clarity and to avoid Option::None shadowing

Code quote:

None

@ArniStarkware ArniStarkware force-pushed the arni/infra/component_client_client_as_enum branch from 00e3f97 to dceb597 Compare March 30, 2026 16:33
@ArniStarkware
Copy link
Copy Markdown
Contributor Author

crates/apollo_infra/src/component_client/definitions.rs line 32 at r2 (raw file):

Previously, nadin-Starkware (Nadin Jbara) wrote…

Please rename Disabled for clarity and to avoid Option::None shadowing

Done. Removed this option. Looks like it is never used. If it is needed, we will add it.

@ArniStarkware ArniStarkware force-pushed the arni/infra/component_client_client_as_enum branch 3 times, most recently from 3be4b39 to 5046eba Compare March 30, 2026 17:26
Copy link
Copy Markdown
Contributor Author

@ArniStarkware ArniStarkware left a comment

Choose a reason for hiding this comment

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

@ArniStarkware made 1 comment.
Reviewable status: 0 of 2 files reviewed, 1 unresolved discussion (waiting on Itay-Tsabary-Starkware and nadin-Starkware).


crates/apollo_infra/src/component_client/definitions.rs line 32 at r2 (raw file):

Previously, ArniStarkware (Arnon Hod) wrote…

Done. Removed this option. Looks like it is never used. If it is needed, we will add it.

Returned the Disabled option (it is very much used).

Copy link
Copy Markdown
Collaborator

@nadin-Starkware nadin-Starkware left a comment

Choose a reason for hiding this comment

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

@nadin-Starkware reviewed 2 files and all commit messages, and resolved 1 discussion.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on Itay-Tsabary-Starkware).

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