Skip to content
This repository was archived by the owner on Mar 5, 2026. It is now read-only.

feat: enhance API queries and Rust bridge functions with internal inclusion support#5

Merged
andersonleal merged 1 commit intomainfrom
feat/improves
Feb 10, 2026
Merged

feat: enhance API queries and Rust bridge functions with internal inclusion support#5
andersonleal merged 1 commit intomainfrom
feat/improves

Conversation

@andersonleal
Copy link
Copy Markdown
Contributor

@andersonleal andersonleal commented Feb 9, 2026

Summary

Adds optional include_internal support for functions and triggers across the console frontend and Rust bridge so users can toggle visibility of internal/system functions and triggers (e.g. via "Show system" on Config and Handlers pages). Also fixes bridge shutdown to use async shutdown and corrects a path parameter key in the state item set handler.

Type of Change

  • New feature (non-breaking change that adds functionality)
  • Bug fix (non-breaking change that fixes an issue)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation update

Changes

Frontend

  • API (functions.ts): fetchFunctions and fetchTriggers accept optional { include_internal?: boolean } and pass it as query params to DevTools/Management APIs.
  • Queries (queries.ts): functionsQuery and triggersQuery are now factory functions that accept the same options and include them in the query key for correct cache separation.
  • Routes: Config and Handlers pages pass include_internal: showSystem when fetching functions/triggers; dashboard (index) uses default (no internal). All prefetches updated to call functionsQuery() / triggersQuery().

Rust bridge

  • Bridge functions: Added parse_bool_param helper; handle_functions_list and handle_triggers_list read include_internal from request input and forward it to engine.functions.list and engine.triggers.list. Status and trigger-types handlers use include_internal: true where appropriate.
  • Shutdown: Replaced bridge.shutdown() with bridge.shutdown_async().await for proper async cleanup on SIGTERM/SIGINT.
  • State API: handle_state_item_set now reads path_params instead of path_parameters to match the API contract.

Checklist

  • Code follows project style guidelines (Biome/formatting)
  • Self-review performed
  • Documentation updated (if needed)
  • No new warnings introduced

Additional Context

  • Base branch: main (default). Single commit: feat: enhance API queries and Rust bridge functions with internal inclusion support.
  • 7 files changed: console-frontend (API, queries, config, handlers, index routes) and console-rust (bridge/functions.rs, main.rs).

Summary by CodeRabbit

Release Notes

  • New Features
    • Improved functions and triggers management with enhanced filtering capabilities that allow users to show or hide internal and system items based on their preference. This provides better visibility control, helping users focus on operations most relevant to their workflow while maintaining access to system-level operations when needed.

…lusion support

- Refactor functionsQuery and triggersQuery to accept an optional 'include_internal' parameter for improved data fetching.
- Update fetchFunctions and fetchTriggers to handle the new parameter, allowing for conditional inclusion of internal functions and triggers.
- Modify related route files to utilize the updated queries with the new parameter, enhancing the flexibility of data retrieval.
- Adjust Rust bridge functions to accept and process the 'include_internal' parameter, ensuring consistent behavior across the application.

These changes improve the API's capability to filter internal resources based on user preferences.
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Feb 9, 2026

📝 Walkthrough

Walkthrough

This pull request adds conditional inclusion of internal/system functions and triggers across the frontend and backend. The include_internal flag is threaded through the API layer, query builders, and route handlers to the Rust backend, allowing selective filtering based on user preferences.

Changes

Cohort / File(s) Summary
Frontend API Functions
packages/console-frontend/src/api/events/functions.ts
Added optional options parameter with include_internal flag to fetchFunctions() and fetchTriggers(), appending query string when set and providing defensive fallbacks for response data.
Frontend Query Builders
packages/console-frontend/src/api/queries.ts
Converted functionsQuery and triggersQuery from static configurations to factory functions accepting optional options parameter; builds dynamic query keys including the include_internal flag.
Frontend Routes & Components
packages/console-frontend/src/routes/config.tsx, packages/console-frontend/src/routes/handlers.tsx, packages/console-frontend/src/routes/index.tsx
Updated prefetch and query invocations to call query factories as functions and pass { include_internal: showSystem } from component state to conditionally include internal items.
Rust Backend Bridge Handlers
packages/console-rust/src/bridge/functions.rs
Added parse_bool_param() helper; refactored handle_functions_list() and handle_triggers_list() to accept and parse input: Value parameter; updated handler registration to forward input; modified handle_status() and handle_trigger_types() to explicitly request internal items.
Rust Async Shutdown
packages/console-rust/src/main.rs
Changed shutdown sequence from synchronous bridge.shutdown() to asynchronous bridge.shutdown_async().await.

Sequence Diagram(s)

sequenceDiagram
    actor User
    participant Component as ConfigPage/<br/>HandlersPage
    participant QueryBuilder as Query Builder<br/>(functionsQuery)
    participant API as API Layer<br/>(fetchFunctions)
    participant Backend as Rust Backend<br/>(handle_functions_list)
    
    User->>Component: Set showSystem state
    Component->>QueryBuilder: Call functionsQuery({<br/>include_internal: showSystem<br/>})
    QueryBuilder->>API: fetchFunctions({<br/>include_internal<br/>})
    API->>API: Build query string:<br/>?include_internal=true
    API->>Backend: GET /functions?include_internal=true
    Backend->>Backend: parse_bool_param()<br/>determine include_internal
    Backend->>Backend: Call engine.functions.list<br/>with include_internal flag
    Backend-->>API: Return filtered functions
    API-->>QueryBuilder: { functions: [], count: 0 }
    QueryBuilder-->>Component: Query results with cache
    Component-->>User: Display functions
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Poem

🐰 A flag through the stack, so neat and clean,
From query to bridge, internal's seen,
Show system items when whispered just right,
Parameter threading, a hop and a flight! ✨

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 20.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the primary change: adding support for internal item inclusion across API queries and Rust bridge functions.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feat/improves

No actionable comments were generated in the recent review. 🎉


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

@andersonleal andersonleal merged commit 5c55275 into main Feb 10, 2026
2 checks passed
@coderabbitai coderabbitai bot mentioned this pull request Feb 16, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants