Skip to content

Conversation

brendanobra
Copy link
Contributor

Summary by CodeRabbit

  • New Features

    • Introduced a new rules engine for flexible RPC request processing and endpoint routing.
    • Added an API Gateway for managing service registrations and routing requests between clients and backend services.
    • Added support for service connections and routing via WebSocket, including mock services and a test CLI for service interaction.
    • Enabled conditional Thunder plugin status checks at startup based on device manifest configuration.
  • Improvements

    • Enhanced asynchronous handling and thread safety across broker and gateway components.
    • Expanded support for aggregate service calls and dynamic service registration.
    • Improved error handling and logging for service routing and connection management.
  • Removals

    • Removed legacy authentication, account, and device ID/distributor token/session RPC endpoints.
    • Eliminated support for MAC address retrieval in device info APIs.
    • Removed session and token-related request/response types and processors from distributor and SDK modules.
  • Bug Fixes

    • Fixed logging and request handling for Thunder async client and plugin status management.
  • Tests

    • Added comprehensive contract tests for Thunder TextTrack and UserSettings interfaces.
    • Introduced extensive tests for HTTP broker and mock service gateway functionality.
  • Chores

    • Updated dependencies and workspace configurations.
    • Added .gitignore and toolchain files for new workspaces and packages.

@brendanobra
Copy link
Contributor Author

Walkthrough

The changes introduce a substantial overhaul to the platform’s API gateway, service registration, and session/token management. New modules for an SSDA API gateway system are added, including foundational types, client/server logic, and a mock application gateway for testing. Session and token-related code is removed from the main and distributor modules, and the rules engine is modernized and integrated more tightly. Thunder plugin status checks are now configurable, and several device and authentication RPC endpoints are retired. Numerous supporting files, test modules, and configuration updates accompany these architectural changes.

Changes

Files / Groups Change Summary
core/main/src/broker/endpoint_broker.rs, related broker files Refactored broker state to use async rule engine access; methods updated for async/await; added support for service broker endpoint; manual Debug impl; new async methods for rule handling and endpoint building.
core/main/src/broker/service_broker.rs Introduced new ServiceBroker struct and trait implementation for service endpoint handling, including async request/response routing via platform state and gateway API.
core/main/src/broker/thunder_broker.rs, core/main/src/broker/thunder/thunder_plugins_status_mgr.rs Extended Thunder broker to support plugin status checks at startup based on config; refactored status request/response logic to handle multiple plugins and optional plugin names; added Display impl for plugin enum.
core/main/src/broker/http_broker.rs Changed send_broker_response to return a Result; added comprehensive async tests for HTTP broker behavior; improved error propagation and logging.
core/main/src/broker/mod.rs Replaced rules_engine module with new service_broker module declaration.
core/main/src/bootstrap/start_ws_step.rs, core/main/src/bootstrap/start_communication_broker.rs Updated setup methods to support new async signatures and additional parameters for gateway API integration.
core/main/src/bootstrap/start_fbgateway_step.rs Conditionalized and removed certain RPC provider initializations, aligning with updated provider registration logic.
core/main/src/firebolt/firebolt_gateway.rs, core/main/src/firebolt/firebolt_ws.rs Enhanced WebSocket handling to distinguish service/API gateway connections; added async service connection management; updated signature for gateway integration.
core/main/src/firebolt/handlers/account_rpc.rs, core/main/src/firebolt/handlers/authentication_rpc.rs Deleted account and authentication RPC handlers, removing related exported traits and providers.
core/main/src/firebolt/handlers/device_rpc.rs, core/main/src/firebolt/handlers/second_screen_rpc.rs Removed device/distributor and second screen device RPC methods and implementations.
core/main/src/firebolt/mod.rs Removed public module declarations for account and authentication RPC handlers.
core/main/src/state/bootstrap_state.rs, core/main/src/state/platform_state.rs Integrated async rules engine and API gateway server into bootstrap and platform state; updated constructors, struct fields, and debug output; removed device token support.
core/main/src/state/openrpc_state.rs Made is_provider_enabled method public.
core/main/Cargo.toml, core/sdk/Cargo.toml Added/updated dependencies for new features (strum, jaq, mock service, local path dependencies); updated workspace dependencies.
core/sdk/src/api/mod.rs, core/sdk/src/api/rules_engine/mod.rs Added new public rules engine module; removed distributor platform/token and authentication modules; implemented new rules engine with JQ support, rule matching, and unit tests.
core/sdk/src/api/device/device_info_request.rs Removed MacAddress variant from DeviceInfoRequest enum; updated related tests.
core/sdk/src/api/distributor/distributor_platform.rs, core/sdk/src/api/distributor/distributor_token.rs, core/sdk/src/api/firebolt/fb_authentication.rs Deleted distributor platform/token and authentication modules, including all related structs, traits, payload providers, and tests.
core/sdk/src/api/manifest/device_manifest.rs, core/sdk/src/api/manifest/cascaded_device_manifest.rs Added new feature flag for Thunder plugin status check at broker startup; updated tests and default implementations.
core/sdk/src/api/manifest/extn_manifest.rs Added "Keyboard." to default provider registration prefixes.
core/sdk/src/api/observability/log_signal.rs Removed "gateway_secure" from JSON logs; improved log formatting.
core/sdk/src/api/session.rs, core/sdk/src/extn/extn_client_message.rs Removed all session/token types, enums, and related message variants; simplified session adjective enum.
core/sdk/src/extn/client/extn_client.rs, core/sdk/src/extn/client/extn_processor.rs Updated test code to use SessionAdjective::Account instead of Device.
core/sdk/src/service/mock_app_gw/ (multiple new files) Added a complete mock application gateway implementation: binaries, main logic, internal API config, routing, types, and test CLI; includes JSON config and static API responses for testing.
ssda/ (multiple new files) Introduced new SSDA workspace with client, service, transport, and types crates; implemented API gateway, service registration, websocket client/server, and foundational types; included example service and toolchain configs.
device/thunder_ripple_sdk/ (multiple files) Added/updated plugin status check logic at startup; propagated new boolean parameter through Thunder client, pool, and builder; added new test modules for Thunder contracts; removed MAC address handling from device info processor.
distributor/general/ (multiple files) Removed all session/token processors and related modules; updated FFI to exclude session contracts and processors.
examples/reference-manifest/IpStb/firebolt-extn-manifest.json Removed distributor and platform session contracts from manifest requirements; cleaned up whitespace and array formatting.
.github/workflows/Build.yml, Cargo.toml Updated build workflow branch trigger and dependency versions.

Sequence Diagram(s)

sequenceDiagram
    participant Service as Example Service
    participant SSDA_Client as SSDA Client
    participant SSDA_Gateway as SSDA API Gateway
    participant Main as Platform Main Process

    Service->>SSDA_Client: Register service handlers
    SSDA_Client->>SSDA_Gateway: Connect via WebSocket, send registration
    SSDA_Gateway-->>SSDA_Client: Registration response

    Main->>SSDA_Gateway: Route ServiceRoutingRequest (for method)
    SSDA_Gateway->>SSDA_Client: Forward request to appropriate service
    SSDA_Client->>Service: Dispatch ServiceCall
    Service-->>SSDA_Client: ServiceCallSuccessResponse / ErrorResponse
    SSDA_Client-->>SSDA_Gateway: Forward response
    SSDA_Gateway-->>Main: ServiceRoutingResponse (Success/Error)
Loading
sequenceDiagram
    participant ThunderBroker
    participant PlatformState
    participant ThunderClient
    participant PluginManager

    PlatformState->>ThunderBroker: Start broker (with plugin status check flag)
    ThunderBroker->>ThunderClient: Start Thunder client (status_check flag)
    ThunderClient->>PluginManager: If status_check, send plugin status request(s)
    PluginManager-->>ThunderClient: Status responses (for all or specific plugins)
    ThunderClient-->>ThunderBroker: Status update(s)
Loading

Poem

Engage the engines, overhaul complete,
Old tokens and sessions now in retreat.
A gateway arises, robust and new,
With mock services standing in the test crew.
Thunder checks plugins on startup’s bright dawn,
While rules engines parse as the platform moves on.
Make it so! The system’s evolved—warp speed, carry on!

 🚀🖖

Note

⚡️ AI Code Reviews for VS Code, Cursor, Windsurf

CodeRabbit now has a plugin for VS Code, Cursor and Windsurf. This brings AI code reviews directly in the code editor. Each commit is reviewed immediately, finding bugs before the PR is raised. Seamless context handoff to your AI code agent ensures that you can easily incorporate review feedback.
Learn more here.


Note

⚡️ Faster reviews with caching

CodeRabbit now supports caching for code and dependencies, helping speed up reviews. This means quicker feedback, reduced wait times, and a smoother review experience overall. Cached data is encrypted and stored securely. This feature will be automatically enabled for all accounts on May 16th. To opt out, configure Review - Disable Cache at either the organization or repository level. If you prefer to disable all data retention across your organization, simply turn off the Data Retention setting under your Organization Settings.
Enjoy the performance boost—your workflow just got faster.

✨ Finishing Touches
  • 📝 Generate Docstrings

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
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@brendanobra brendanobra changed the title Small Serviec Discovery Architecture: Client/Transport/Service registry etc. for out of process handlers Small Service Discovery Architecture: Client/Transport/Service registry etc. for out of process handlers May 20, 2025
@CLAassistant
Copy link

CLAassistant commented Jun 13, 2025

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you all sign our Contributor License Agreement before we can accept your contribution.
1 out of 2 committers have signed the CLA.

✅ brendanobra
❌ bobra200


bobra200 seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account.
You have signed the CLA already but the status is still pending? Let us recheck it.

Copy link

Code Coverage

Package Line Rate Health
core.sdk.src.api.rules 95%
core.main.src.utils 30%
core.sdk.src.extn.ffi 0%
ssda.ssda_service.src 50%
core.main.src.state 36%
core.sdk.src.api.device 77%
core.sdk.src.api.distributor 68%
core.sdk.src.utils 61%
core.sdk.src.service.mock_app_gw 0%
core.sdk.src.api 46%
core.sdk.src.processor 0%
core.main.src.broker.thunder 37%
core.sdk.src.api.observability 57%
device.mock_device.src 57%
device.thunder_ripple_sdk.src.client 67%
core.sdk.src.extn.client 82%
core.sdk.src.api.firebolt 78%
device.thunder_ripple_sdk.src.processors 17%
core.main.src.service.extn 26%
core.main.src.firebolt.handlers 12%
core.main.src.bootstrap.extn 0%
core.sdk.src.api.manifest 75%
core.tdk.src.utils 0%
device.thunder_ripple_sdk.src.bootstrap 0%
core.tdk.src.gateway 100%
ssda.ssda_client.src 0%
ssda.ssda_types.src 56%
core.sdk.src.service 0%
core.main.src 0%
core.main.src.bootstrap.manifest 0%
core.main.src.service 35%
core.main.src.service.apps 25%
core.main.src.broker 71%
core.sdk.src.api.rules_engine 66%
core.main.src.processor.storage 0%
core.main.src.firebolt 2%
core.main.src.bootstrap 0%
core.main.src.state.cap 43%
core.main.src.service.ripple_service 0%
core.main.src.processor 0%
core.sdk.src.manifest 0%
core.main.src.broker.test 90%
core.sdk.src.framework 64%
device.thunder_ripple_sdk.src.processors.events 0%
device.thunder_ripple_sdk.src.events 4%
device.thunder_ripple_sdk.src 17%
core.sdk.src.api.gateway 67%
core.sdk.src.extn 77%
openrpc_validator.src 67%
core.sdk.src.service.mock_app_gw.appgw 0%
Summary 48% (21139 / 43710)

Minimum allowed line rate is 48%

Comment on lines +410 to +417
info!(
"Creating new service connection_id={} app_id={} session_id={}, gateway_secure={}, port={}",
connection_id,
app_id_c,
session_id_c,
gateway_secure,
_client_addr.port()
);

Check failure

Code scanning / CodeQL

Cleartext logging of sensitive information High

This operation writes
session_id_c
to a log file.
Comment on lines +428 to +435
info!(
"Creating new connection_id={} app_id={} session_id={}, gateway_secure={}, port={}",
connection_id,
app_id_c,
session_id_c,
gateway_secure,
_client_addr.port()
);

Check failure

Code scanning / CodeQL

Cleartext logging of sensitive information High

This operation writes
session_id_c
to a log file.
Comment on lines +582 to +585
info!(
"Unregistering service connection_id={} app_id={} session_id={}",
connection_id, app_id_c, session_id_c
);

Check failure

Code scanning / CodeQL

Cleartext logging of sensitive information High

This operation writes
session_id_c
to a log file.
@tfarz123 tfarz123 requested a review from a team July 11, 2025 22:24
Copy link

@tfarz123 tfarz123 left a comment

Choose a reason for hiding this comment

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

No-Harm testing done.

@tfarz123 tfarz123 requested review from tfarz123 and a team July 11, 2025 22:25
tfarz123
tfarz123 previously approved these changes Jul 11, 2025
Copy link

@tfarz123 tfarz123 left a comment

Choose a reason for hiding this comment

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

No-Harm testing done.

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